Class TableInfo


  • public class TableInfo
    extends Object
    Table Info queries (table_info)
    Since:
    3.3.0
    Author:
    osbornb
    • 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 - connection
        tableName - 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 value
        type - 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 value
        type - data type
        Returns:
        default value