java.lang.Object
com.inductiveautomation.ignition.gateway.localdb.Table
Direct Known Subclasses:
HsqlTable, SQLiteTable

public abstract class Table extends Object
  • Field Details

  • Constructor Details

    • Table

      public Table()
  • Method Details

    • tableExists

      public boolean tableExists()
    • buildFor

      public Table buildFor(Table other)
    • buildFor

      public Table buildFor(SRecordMeta<? extends SRecordInstance> meta)
    • buildFor

      public Table buildFor(String tableName, DataSource db) throws SQLException
      Throws:
      SQLException
    • buildNew

      public Table buildNew(String name)
    • colQC

      public String colQC()
    • qc

      public String qc()
    • canAlterFrom

      public boolean canAlterFrom(Table existingTable)
      Returns true if all of the modifications required can be handled through altering. If not, a new version of the table will be made.
    • supportsConstraintModification

      protected boolean supportsConstraintModification()
    • getTransferCommand

      public String getTransferCommand(Table originalTable, String sourceName)
    • findSequences

      protected abstract List<String> findSequences(String tableName, Connection conn) throws SQLException
      Throws:
      SQLException
    • findColumn

      public Table.Column findColumn(String name)
    • getTableName

      public String getTableName()
    • getPhase1AlterDdl

      public List<String> getPhase1AlterDdl(Table existing)
      Does all alter column statements
    • getPhase2AlterDdl

      public List<String> getPhase2AlterDdl(Table existing)
      Does all constraint and sequence modification
    • sqlDefinition_Table

      protected String sqlDefinition_Table()
      Returns the keyword(s) to use for create TABLE. Default is "TABLE", but HSQL would use "CACHED TABLE"
    • sqlDefinition_CreateSequence

      protected String sqlDefinition_CreateSequence(String sequence, String table)
      Returns the full "CREATE SEQUENCE seqName"
    • sqlDefinition_CreateIndex

      protected String sqlDefinition_CreateIndex(String indexName, String tableName, String columnName)
    • sqlDefinition_DropIndex

      protected String sqlDefinition_DropIndex(String indexName)
    • supportsDropColumn

      protected boolean supportsDropColumn()
    • getColumns

      public List<Table.Column> getColumns()
    • getPrimaryKey

      public Table.PrimaryKey getPrimaryKey()
    • getForeignKeys

      public List<Table.ForeignKey> getForeignKeys()
    • getColumnDdl

      protected String getColumnDdl(Table.Column col)
    • getTableCreateDdl

      public String getTableCreateDdl()
    • getIndexName

      public String getIndexName(Table.Column column)
    • getConstraintDdl

      public List<String> getConstraintDdl()
    • sqlDefinition_CreateForeignKeys

      protected void sqlDefinition_CreateForeignKeys(List<String> commands, List<Table.ForeignKey> fks)
      Should create the sql for adding the foreign keys and add them to the "commands" list
    • getColumnTypeSql

      protected String getColumnTypeSql(SFieldScalar field)
    • valueToQueryLiteral

      protected String valueToQueryLiteral(Object value, SFieldScalar field)
      In some cases, we put the value of the column directly into the query. This allows us to override how it is represented in the query.
    • valueToQueryLiteral

      protected String valueToQueryLiteral(Object value, String columnType)
    • getPhase1Transfer

      public List<String> getPhase1Transfer(Table originalTable)
    • getPhase2Transfer

      public List<String> getPhase2Transfer(Table originalTable)