Class DataTableDef


  • public class DataTableDef
    extends java.lang.Object
    A definition of a table. Every table in the database has a definition that describes how it is stored on disk, the column definitions, primary keys/foreign keys, and any check constraints.
    Author:
    Tobias Downer
    • Constructor Detail

      • DataTableDef

        public DataTableDef()
        Constructs this DataTableDef file.
      • DataTableDef

        public DataTableDef​(DataTableDef table_def)
        Copy constructor.
    • Method Detail

      • setImmutable

        public void setImmutable()
        Sets this DataTableDef to immutable which means nothing is able to change it.
      • immutable

        public boolean immutable()
        Returns true if this is immutable.
      • dump

        public void dump​(java.io.PrintStream out)
        Outputs to the PrintStream for debugging.
      • resolveColumnName

        public java.lang.String resolveColumnName​(java.lang.String col_name,
                                                  boolean ignore_case)
                                           throws DatabaseException
        Resolves a single column name to its correct form. For example, if the database is in case insensitive mode it'll resolve ID to 'id' if 'id' is in this table. Throws a database exception if a column couldn't be resolved (ambiguous or not found).
        Throws:
        DatabaseException
      • resolveColumnsInArray

        public void resolveColumnsInArray​(DatabaseConnection connection,
                                          java.util.ArrayList list)
                                   throws DatabaseException
        Given a list of column names referencing entries in this table, this will resolve each one to its correct form. Throws a database exception if a column couldn't be resolved.
        Throws:
        DatabaseException
      • setTableName

        public void setTableName​(TableName name)
      • setTableClass

        public void setTableClass​(java.lang.String clazz)
      • addVirtualColumn

        public void addVirtualColumn​(DataTableColumnDef col_def)
        Same as 'addColumn' only this does not perform a check to ensure no two columns are the same.
      • getSchema

        public java.lang.String getSchema()
      • getName

        public java.lang.String getName()
      • getTableName

        public TableName getTableName()
      • getTableClass

        public java.lang.String getTableClass()
      • columnCount

        public int columnCount()
      • findColumnName

        public int findColumnName​(java.lang.String column_name)
      • fastFindColumnName

        public final int fastFindColumnName​(java.lang.String col)
        A faster way to find a column index given a string column name. This caches column name -> column index in a HashMap.
      • noColumnCopy

        public DataTableDef noColumnCopy()
        Returns a copy of this object, except with no columns or constraints.