Package org.jumpmind.db.platform.ase
Class AseDdlBuilder
java.lang.Object
org.jumpmind.db.platform.AbstractDdlBuilder
org.jumpmind.db.platform.ase.AseDdlBuilder
- All Implemented Interfaces:
IDdlBuilder
-
Field Summary
Fields inherited from class org.jumpmind.db.platform.AbstractDdlBuilder
caseSensitive, databaseInfo, databaseName, delimitedIdentifierModeOn, log, scriptModeOn, SIZE_PLACEHOLDER, sqlCommentsOn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
createTable
(Table table, StringBuilder ddl, boolean temporary, boolean recreate) Outputs the DDL to create the table along with any non-external constraints as well as with external primary keys and indices (but not foreign keys).protected String
Creates a reasonably unique identifier only consisting of hexadecimal characters and underscores.void
dropExternalForeignKeys
(Table table, StringBuilder ddl) Creates external foreign key drop statements.protected void
dropTable
(Table table, StringBuilder ddl, boolean temporary, boolean recreate) Outputs the DDL to drop the table.protected String
protected String
protected String
getNativeDefaultValue
(Column column) Returns the native default value for the column.protected String
getSelectLastIdentityValues
(Table table) Generates the SQL for querying the id that was created in the last insertion operation.boolean
protected void
processChange
(Database currentModel, Database desiredModel, AddColumnChange change, StringBuilder ddl) protected void
processChange
(Database currentModel, Database desiredModel, ColumnDefaultValueChange change, StringBuilder ddl) protected void
processChange
(Database currentModel, Database desiredModel, RemoveColumnChange change, StringBuilder ddl) protected void
processChange
(Database currentModel, Database desiredModel, RemovePrimaryKeyChange change, StringBuilder ddl) protected void
processChanges
(Database currentModel, Database desiredModel, List<IModelChange> changes, StringBuilder ddl) Processes the changes.protected void
processColumnChange
(Table sourceTable, Table targetTable, Column sourceColumn, Column targetColumn, StringBuilder ddl) protected void
processTableStructureChanges
(Database currentModel, Database desiredModel, Table sourceTable, Table targetTable, List<TableChange> changes, StringBuilder ddl) Allows database-specific implementations to handle changes in a database specific manner.void
setUsingJtds
(boolean usingJtds) protected void
protected void
writeCastExpression
(Column sourceColumn, Column targetColumn, StringBuilder ddl) Writes a cast expression that converts the value of the source column to the data type of the target column.protected void
writeColumn
(Table table, Column column, StringBuilder ddl) Outputs the DDL for the specified column.void
writeCopyDataStatement
(Table sourceTable, Table targetTable, StringBuilder ddl) Writes a statement that copies the data from the source to the target table.protected void
writeExternalForeignKeyDropStmt
(Table table, ForeignKey foreignKey, StringBuilder ddl) Generates the statement to drop a foreignkey constraint from the database using an alter table statement.void
writeExternalIndexDropStmt
(Table table, IIndex index, StringBuilder ddl) Generates the statement to drop a non-embedded index from the database.protected void
writeGeneratedColumn
(Table table, Column column, StringBuilder ddl) Methods inherited from class org.jumpmind.db.platform.AbstractDdlBuilder
addEscapedCharSequence, alterDatabase, alterDatabase, alterTable, areColumnSizesTheSame, areEqual, areMappedTypesTheSame, copy, createBackupTableFor, createExternalForeignKeys, createExternalForeignKeys, createTable, createTables, createTables, createTemporaryTable, dropTable, dropTables, dropTables, dropTemporaryTable, escapeStringValue, filterChanges, filterColumnSqlType, findCorrespondingForeignKey, findForeignKey, findTable, fixLastIdentityValues, getBackupTableFor, getBareNativeType, getColumnName, getColumnTypeDdl, getConstraintName, getCopyDataColumnMapping, getCopyDataColumnOrderedMapping, getDatabaseInfo, getDefaultValueHelper, getDefinitionForGeneratedColumn, getDeleteSql, getDelimitedIdentifier, getDetectedChanges, getForeignKeyName, getFullyQualifiedIndexNameShorten, getFullyQualifiedTableNameShorten, getGapLimitSize, getIndent, getIndexName, getInsertSql, getNativeType, getRealTargetTableFor, getSize, getSqlType, getTableName, getTemporaryTableFor, getTemporaryTableFor, getTriggerDelimiterReplacementCharacters, getUpdateSql, getValueAsString, getValueDateFormat, getValueLocale, getValueNumberFormat, getValueTimeFormat, hasSize, initCteExpression, isAlterDatabase, isCaseSensitive, isDelimitedIdentifierModeOn, isFullTextIndex, isScriptModeOn, isSpecifyIdentityGapLimit, isSqlCommentsOn, isValidDefaultValue, mapDefaultValue, mergeOrRemovePlatformTypes, printComment, printDefaultValue, printEndOfStatement, printIdentifier, printIndent, println, println, printlnIdentifier, printStartOfEmbeddedStatement, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChange, processChanges, processTableStructureChanges, processTableStructureChanges, renameTable, replaceDelimiterWithEscapeCharacters, restoreTableFromBackup, setCaseSensitive, setDelimitedIdentifierModeOn, setIndent, setScriptModeOn, setSqlCommentsOn, setTriggerDelimiterReplacementCharacters, setValueDateFormat, setValueLocale, setValueNumberFormat, setValueTimeFormat, shortenName, shouldGeneratePrimaryKeys, shouldUseQuotes, writeAlterColumnDataTypeToBigInt, writeCascadeAttributesForForeignKeyDelete, writeCascadeAttributesForForeignKeyUpdate, writeColumnAutoIncrementStmt, writeColumnAutoUpdateStmt, writeColumnDefaultValue, writeColumnDefaultValueStmt, writeColumnEmbeddedPrimaryKey, writeColumnNotNullableStmt, writeColumnNullableStmt, writeColumns, writeColumnType, writeColumnTypeDefaultRequired, writeColumnUniqueStmt, writeCopyDataStatement, writeEmbeddedForeignKeysStmt, writeEmbeddedIndexCreateStmt, writeEmbeddedIndicesStmt, writeEmbeddedPrimaryKeysStmt, writeExternalForeignKeyCreateStmt, writeExternalIndexCreate, writeExternalIndexCreateStmt, writeExternalIndicesCreateStmt, writeExternalPrimaryKeysCreateStmt, writeFixLastIdentityValues, writeForeignReferences, writeIdentityGapLimit, writeLocalReferences, writePrimaryKeyStmt, writeTableAlterStmt, writeTableComment, writeTableCreateOpeningStmt, writeTableCreationStmt, writeTableCreationStmtEnding
-
Constructor Details
-
AseDdlBuilder
public AseDdlBuilder()
-
-
Method Details
-
isUsingJtds
public boolean isUsingJtds() -
setUsingJtds
public void setUsingJtds(boolean usingJtds) -
createTable
Description copied from class:AbstractDdlBuilder
Outputs the DDL to create the table along with any non-external constraints as well as with external primary keys and indices (but not foreign keys).- Overrides:
createTable
in classAbstractDdlBuilder
recreate
- TODO
-
writeColumn
Description copied from class:AbstractDdlBuilder
Outputs the DDL for the specified column.- Overrides:
writeColumn
in classAbstractDdlBuilder
-
writeGeneratedColumn
- Overrides:
writeGeneratedColumn
in classAbstractDdlBuilder
-
getNativeDefaultValue
Description copied from class:AbstractDdlBuilder
Returns the native default value for the column.- Overrides:
getNativeDefaultValue
in classAbstractDdlBuilder
- Parameters:
column
- The column- Returns:
- The native default value
-
dropTable
Description copied from class:AbstractDdlBuilder
Outputs the DDL to drop the table. Note that this method does not drop foreign keys to this table. Use#dropTable(Database, Table)
if you want that.- Overrides:
dropTable
in classAbstractDdlBuilder
recreate
- TODO
-
writeExternalForeignKeyDropStmt
protected void writeExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey, StringBuilder ddl) Description copied from class:AbstractDdlBuilder
Generates the statement to drop a foreignkey constraint from the database using an alter table statement.- Overrides:
writeExternalForeignKeyDropStmt
in classAbstractDdlBuilder
- Parameters:
table
- The tableforeignKey
- The foreign key
-
writeExternalIndexDropStmt
Description copied from class:AbstractDdlBuilder
Generates the statement to drop a non-embedded index from the database.- Overrides:
writeExternalIndexDropStmt
in classAbstractDdlBuilder
-
dropExternalForeignKeys
Description copied from class:AbstractDdlBuilder
Creates external foreign key drop statements.- Overrides:
dropExternalForeignKeys
in classAbstractDdlBuilder
- Parameters:
table
- The table
-
getSelectLastIdentityValues
Description copied from class:AbstractDdlBuilder
Generates the SQL for querying the id that was created in the last insertion operation. This is obviously only useful for pk fields that are auto-incrementing. A database that does not support this, will returnnull
.- Overrides:
getSelectLastIdentityValues
in classAbstractDdlBuilder
- Parameters:
table
- The table- Returns:
- The sql, or
null
if the database does not support this
-
getEnableIdentityOverrideSql
-
getDisableIdentityOverrideSql
-
getQuotationOnStatement
-
writeCopyDataStatement
Description copied from class:AbstractDdlBuilder
Writes a statement that copies the data from the source to the target table. Note that this copies only those columns that are in both tables. Database-specific implementations might redefine this method though they usually it suffices to redefine the#writeCastExpression(Column, Column)
method.- Overrides:
writeCopyDataStatement
in classAbstractDdlBuilder
- Parameters:
sourceTable
- The source tabletargetTable
- The target table
-
writeCastExpression
Description copied from class:AbstractDdlBuilder
Writes a cast expression that converts the value of the source column to the data type of the target column. Per default, simply the name of the source column is written thereby assuming that any casts happen implicitly.- Overrides:
writeCastExpression
in classAbstractDdlBuilder
-
processChanges
protected void processChanges(Database currentModel, Database desiredModel, List<IModelChange> changes, StringBuilder ddl) Description copied from class:AbstractDdlBuilder
Processes the changes. The default argument performs several passes:RemoveForeignKeyChange
andRemoveIndexChange
come first to allow for e.g. subsequent primary key changes or column removal.RemoveTableChange
comes after the removal of foreign keys and indices.- These are all handled together:
RemovePrimaryKeyChange
AddPrimaryKeyChange
PrimaryKeyChange
RemoveColumnChange
AddColumnChange
ColumnAutoIncrementChange
ColumnDefaultValueChange
ColumnRequiredChange
ColumnDataTypeChange
ColumnSizeChange
The reason for this is that the default algorithm rebuilds the table for these changes and thus their order is irrelevant. AddTableChange
needs to come after the table removal (so that tables of the same name are removed) and before the addition of foreign keys etc.AddForeignKeyChange
andAddIndexChange
come last after table/column/primary key additions or changes.RemoveTriggerChange
come after the tables are completely built.AddTriggerChange
is done last.
- Overrides:
processChanges
in classAbstractDdlBuilder
-
processTableStructureChanges
protected void processTableStructureChanges(Database currentModel, Database desiredModel, Table sourceTable, Table targetTable, List<TableChange> changes, StringBuilder ddl) Description copied from class:AbstractDdlBuilder
Allows database-specific implementations to handle changes in a database specific manner. Any handled change should be applied to the given current model (which is a copy of the real original model) and be removed from the list of changes.
In the default implementation, allAddPrimaryKeyChange
changes are applied via anALTER TABLE ADD CONSTRAINT
statement.- Overrides:
processTableStructureChanges
in classAbstractDdlBuilder
- Parameters:
currentModel
- The current database schemadesiredModel
- The desired database schemasourceTable
- The original tabletargetTable
- The desired tablechanges
- The change objects for the target table
-
processChange
protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change, StringBuilder ddl) -
processChange
protected void processChange(Database currentModel, Database desiredModel, RemoveColumnChange change, StringBuilder ddl) -
processChange
protected void processChange(Database currentModel, Database desiredModel, RemovePrimaryKeyChange change, StringBuilder ddl) -
processChange
protected void processChange(Database currentModel, Database desiredModel, ColumnDefaultValueChange change, StringBuilder ddl) -
processColumnChange
protected void processColumnChange(Table sourceTable, Table targetTable, Column sourceColumn, Column targetColumn, StringBuilder ddl) -
createUniqueIdentifier
Creates a reasonably unique identifier only consisting of hexadecimal characters and underscores. It looks liked578271282b42fce__2955b56e_107df3fbc96__8000
and is 48 characters long.- Returns:
- The identifier
-
writeCascadeAttributesForForeignKey
- Overrides:
writeCascadeAttributesForForeignKey
in classAbstractDdlBuilder
-