Class Table
java.lang.Object
com.inductiveautomation.ignition.gateway.localdb.Table
- Direct Known Subclasses:
HsqlTable,SQLiteTable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassclass -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Table.Column>protected List<Table.ForeignKey>protected StringThe name of the tableprotected Table.PrimaryKey -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildFor(String tableName, DataSource db) buildFor(SRecordMeta<? extends SRecordInstance> meta) booleancanAlterFrom(Table existingTable) Returns true if all of the modifications required can be handled through altering.colQC()findColumn(String name) findSequences(String tableName, Connection conn) protected StringgetColumnDdl(Table.Column col) protected StringgetColumnTypeSql(SFieldScalar field) getIndexName(Table.Column column) getPhase1AlterDdl(Table existing) Does all alter column statementsgetPhase1Transfer(Table originalTable) getPhase2AlterDdl(Table existing) Does all constraint and sequence modificationgetPhase2Transfer(Table originalTable) getTransferCommand(Table originalTable, String sourceName) qc()protected voidsqlDefinition_CreateForeignKeys(List<String> commands, List<Table.ForeignKey> fks) Should create the sql for adding the foreign keys and add them to the "commands" listprotected StringsqlDefinition_CreateIndex(String indexName, String tableName, String columnName) protected StringsqlDefinition_CreateSequence(String sequence, String table) Returns the full "CREATE SEQUENCE seqName"protected StringsqlDefinition_DropIndex(String indexName) protected StringReturns the keyword(s) to use for create TABLE.protected booleanprotected booleanbooleanprotected StringvalueToQueryLiteral(Object value, String columnType) protected StringvalueToQueryLiteral(Object value, SFieldScalar field) In some cases, we put the value of the column directly into the query.
-
Field Details
-
name
The name of the table -
columns
-
pk
-
fks
-
sequences
-
-
Constructor Details
-
Table
public Table()
-
-
Method Details
-
tableExists
public boolean tableExists() -
buildFor
-
buildFor
-
buildFor
- Throws:
SQLException
-
buildNew
-
colQC
-
qc
-
canAlterFrom
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
-
findSequences
protected abstract List<String> findSequences(String tableName, Connection conn) throws SQLException - Throws:
SQLException
-
findColumn
-
getTableName
-
getPhase1AlterDdl
Does all alter column statements -
getPhase2AlterDdl
Does all constraint and sequence modification -
sqlDefinition_Table
Returns the keyword(s) to use for create TABLE. Default is "TABLE", but HSQL would use "CACHED TABLE" -
sqlDefinition_CreateSequence
Returns the full "CREATE SEQUENCE seqName" -
sqlDefinition_CreateIndex
-
sqlDefinition_DropIndex
-
supportsDropColumn
protected boolean supportsDropColumn() -
getColumns
-
getPrimaryKey
-
getForeignKeys
-
getColumnDdl
-
getTableCreateDdl
-
getIndexName
-
getConstraintDdl
-
sqlDefinition_CreateForeignKeys
Should create the sql for adding the foreign keys and add them to the "commands" list -
getColumnTypeSql
-
valueToQueryLiteral
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
-
getPhase1Transfer
-
getPhase2Transfer
-