Package mil.nga.geopackage.db.table
Class TableInfo
- java.lang.Object
-
- mil.nga.geopackage.db.table.TableInfo
-
public class TableInfo extends Object
Table Info queries (table_info)- Since:
- 3.3.0
- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description static StringCIDIndex columnstatic intCID_INDEXIndex column indexstatic StringDEFAULT_NULLDefault of NULL valuestatic StringDFLT_VALUEDefault value columnstatic intDFLT_VALUE_INDEXDefault value column indexstatic StringNAMEName columnstatic intNAME_INDEXName column indexstatic StringNOT_NULLNot null columnstatic intNOT_NULL_INDEXNot null column indexstatic StringPKPrimary key columnstatic intPK_INDEXPrimary key column indexstatic StringTYPEType columnstatic intTYPE_INDEXType column index
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TableColumngetColumn(int index)Get the column at the indexTableColumngetColumn(String name)Get the column with the nameList<TableColumn>getColumns()Get the columnsstatic GeoPackageDataTypegetDataType(String type)Get the data type from the type valuestatic ObjectgetDefaultValue(String defaultValue, String type)Get the default object value for the string default value and typestatic ObjectgetDefaultValue(String defaultValue, GeoPackageDataType type)Get the default object value for the string default value with the data typeTableColumngetPrimaryKey()Get the single or first primary key if one existsList<TableColumn>getPrimaryKeys()Get the primary key columnsStringgetTableName()Get the table namebooleanhasColumn(String name)Check if the table has the columnbooleanhasPrimaryKey()Check if the table has one or more primary keysstatic TableInfoinfo(GeoPackageCoreConnection db, String tableName)Query for the table_info of the table nameintnumColumns()Number of columns
-
-
-
Field Detail
-
CID
public static final String CID
Index column- See Also:
- Constant Field Values
-
CID_INDEX
public static final int CID_INDEX
Index column index- See Also:
- Constant Field Values
-
NAME
public static final String NAME
Name column- See Also:
- Constant Field Values
-
NAME_INDEX
public static final int NAME_INDEX
Name column index- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
Type column- See Also:
- Constant Field Values
-
TYPE_INDEX
public static final int TYPE_INDEX
Type column index- See Also:
- Constant Field Values
-
NOT_NULL
public static final String NOT_NULL
Not null column- See Also:
- Constant Field Values
-
NOT_NULL_INDEX
public static final int NOT_NULL_INDEX
Not null column index- See Also:
- Constant Field Values
-
DFLT_VALUE
public static final String DFLT_VALUE
Default value column- See Also:
- Constant Field Values
-
DFLT_VALUE_INDEX
public static final int DFLT_VALUE_INDEX
Default value column index- See Also:
- Constant Field Values
-
PK
public static final String PK
Primary key column- See Also:
- Constant Field Values
-
PK_INDEX
public static final int PK_INDEX
Primary key column index- See Also:
- Constant Field Values
-
DEFAULT_NULL
public static final String DEFAULT_NULL
Default of NULL value- See Also:
- Constant Field Values
-
-
Method Detail
-
getTableName
public String getTableName()
Get the table name- Returns:
- table name
-
numColumns
public int numColumns()
Number of columns- Returns:
- column count
-
getColumns
public List<TableColumn> getColumns()
Get the columns- Returns:
- columns
-
getColumn
public TableColumn getColumn(int index)
Get the column at the index- Parameters:
index- column index- Returns:
- column
-
hasColumn
public boolean hasColumn(String name)
Check if the table has the column- Parameters:
name- column name- Returns:
- true if has column
-
getColumn
public TableColumn getColumn(String name)
Get the column with the name- Parameters:
name- column name- Returns:
- column or null if does not exist
-
hasPrimaryKey
public boolean hasPrimaryKey()
Check if the table has one or more primary keys- Returns:
- true if has at least one primary key
-
getPrimaryKeys
public List<TableColumn> getPrimaryKeys()
Get the primary key columns- Returns:
- primary key columns
-
getPrimaryKey
public TableColumn getPrimaryKey()
Get the single or first primary key if one exists- Returns:
- single or first primary key, null if no primary key
-
info
public static TableInfo info(GeoPackageCoreConnection db, String tableName)
Query for the table_info of the table name- Parameters:
db- connectiontableName- table name- Returns:
- table info or null if no table
-
getDataType
public static GeoPackageDataType getDataType(String type)
Get the data type from the type value- Parameters:
type- type value- Returns:
- data type or null
-
getDefaultValue
public static Object getDefaultValue(String defaultValue, String type)
Get the default object value for the string default value and type- Parameters:
defaultValue- default valuetype- type- Returns:
- default value
-
getDefaultValue
public static Object getDefaultValue(String defaultValue, GeoPackageDataType type)
Get the default object value for the string default value with the data type- Parameters:
defaultValue- default valuetype- data type- Returns:
- default value
-
-