Class Table
java.lang.Object
com.inductiveautomation.ignition.gateway.localdb.Table
- Direct Known Subclasses:
HsqlTable
,SQLiteTable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
class
class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Table.Column>
protected List<Table.ForeignKey>
protected String
The name of the tableprotected Table.PrimaryKey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildFor
(String tableName, DataSource db) buildFor
(SRecordMeta<? extends SRecordInstance> meta) boolean
canAlterFrom
(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 String
getColumnDdl
(Table.Column col) protected String
getColumnTypeSql
(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 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" listprotected String
sqlDefinition_CreateIndex
(String indexName, String tableName, String columnName) protected String
sqlDefinition_CreateSequence
(String sequence, String table) Returns the full "CREATE SEQUENCE seqName"protected String
sqlDefinition_DropIndex
(String indexName) protected String
Returns the keyword(s) to use for create TABLE.protected boolean
protected boolean
boolean
protected String
valueToQueryLiteral
(Object value, String columnType) protected String
valueToQueryLiteral
(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
-