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 String
CID
Index columnstatic int
CID_INDEX
Index column indexstatic String
DEFAULT_NULL
Default of NULL valuestatic String
DFLT_VALUE
Default value columnstatic int
DFLT_VALUE_INDEX
Default value column indexstatic String
NAME
Name columnstatic int
NAME_INDEX
Name column indexstatic String
NOT_NULL
Not null columnstatic int
NOT_NULL_INDEX
Not null column indexstatic String
PK
Primary key columnstatic int
PK_INDEX
Primary key column indexstatic String
TYPE
Type columnstatic int
TYPE_INDEX
Type column index
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TableColumn
getColumn(int index)
Get the column at the indexTableColumn
getColumn(String name)
Get the column with the nameList<TableColumn>
getColumns()
Get the columnsstatic GeoPackageDataType
getDataType(String type)
Get the data type from the type valuestatic Object
getDefaultValue(String defaultValue, String type)
Get the default object value for the string default value and typestatic Object
getDefaultValue(String defaultValue, GeoPackageDataType type)
Get the default object value for the string default value with the data typeTableColumn
getPrimaryKey()
Get the single or first primary key if one existsList<TableColumn>
getPrimaryKeys()
Get the primary key columnsString
getTableName()
Get the table nameboolean
hasColumn(String name)
Check if the table has the columnboolean
hasPrimaryKey()
Check if the table has one or more primary keysstatic TableInfo
info(GeoPackageCoreConnection db, String tableName)
Query for the table_info of the table nameint
numColumns()
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
-
-