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 voidcreateTable(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 StringCreates a reasonably unique identifier only consisting of hexadecimal characters and underscores.voiddropExternalForeignKeys(Table table, StringBuilder ddl) Creates external foreign key drop statements.protected voiddropTable(Table table, StringBuilder ddl, boolean temporary, boolean recreate) Outputs the DDL to drop the table.protected Stringprotected Stringprotected StringgetNativeDefaultValue(Column column) Returns the native default value for the column.protected StringgetSelectLastIdentityValues(Table table) Generates the SQL for querying the id that was created in the last insertion operation.booleanprotected voidprocessChange(Database currentModel, Database desiredModel, AddColumnChange change, StringBuilder ddl) protected voidprocessChange(Database currentModel, Database desiredModel, ColumnDefaultValueChange change, StringBuilder ddl) protected voidprocessChange(Database currentModel, Database desiredModel, RemoveColumnChange change, StringBuilder ddl) protected voidprocessChange(Database currentModel, Database desiredModel, RemovePrimaryKeyChange change, StringBuilder ddl) protected voidprocessChanges(Database currentModel, Database desiredModel, List<IModelChange> changes, StringBuilder ddl) Processes the changes.protected voidprocessColumnChange(Table sourceTable, Table targetTable, Column sourceColumn, Column targetColumn, StringBuilder ddl) protected voidprocessTableStructureChanges(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.voidsetUsingJtds(boolean usingJtds) protected voidprotected voidwriteCastExpression(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 voidwriteColumn(Table table, Column column, StringBuilder ddl) Outputs the DDL for the specified column.voidwriteCopyDataStatement(Table sourceTable, Table targetTable, StringBuilder ddl) Writes a statement that copies the data from the source to the target table.protected voidwriteExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey, StringBuilder ddl) Generates the statement to drop a foreignkey constraint from the database using an alter table statement.voidwriteExternalIndexDropStmt(Table table, IIndex index, StringBuilder ddl) Generates the statement to drop a non-embedded index from the database.protected voidwriteGeneratedColumn(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, 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, processChanges, processTableStructureChanges, processTableStructureChanges, renameTable, restoreTableFromBackup, setCaseSensitive, setDelimitedIdentifierModeOn, setIndent, setScriptModeOn, setSqlCommentsOn, setValueDateFormat, setValueLocale, setValueNumberFormat, setValueTimeFormat, shortenName, shouldGeneratePrimaryKeys, shouldUseQuotes, writeAlterColumnDataTypeToBigInt, writeCascadeAttributesForForeignKeyDelete, writeCascadeAttributesForForeignKeyUpdate, writeColumnAutoIncrementStmt, 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, writeTableCreationStmt, writeTableCreationStmtEnding
-
Constructor Details
-
AseDdlBuilder
public AseDdlBuilder()
-
-
Method Details
-
isUsingJtds
public boolean isUsingJtds() -
setUsingJtds
public void setUsingJtds(boolean usingJtds) -
createTable
Description copied from class:AbstractDdlBuilderOutputs 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:
createTablein classAbstractDdlBuilderrecreate- TODO
-
writeColumn
Description copied from class:AbstractDdlBuilderOutputs the DDL for the specified column.- Overrides:
writeColumnin classAbstractDdlBuilder
-
writeGeneratedColumn
- Overrides:
writeGeneratedColumnin classAbstractDdlBuilder
-
getNativeDefaultValue
Description copied from class:AbstractDdlBuilderReturns the native default value for the column.- Overrides:
getNativeDefaultValuein classAbstractDdlBuilder- Parameters:
column- The column- Returns:
- The native default value
-
dropTable
Description copied from class:AbstractDdlBuilderOutputs 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:
dropTablein classAbstractDdlBuilderrecreate- TODO
-
writeExternalForeignKeyDropStmt
protected void writeExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey, StringBuilder ddl) Description copied from class:AbstractDdlBuilderGenerates the statement to drop a foreignkey constraint from the database using an alter table statement.- Overrides:
writeExternalForeignKeyDropStmtin classAbstractDdlBuilder- Parameters:
table- The tableforeignKey- The foreign key
-
writeExternalIndexDropStmt
Description copied from class:AbstractDdlBuilderGenerates the statement to drop a non-embedded index from the database.- Overrides:
writeExternalIndexDropStmtin classAbstractDdlBuilder
-
dropExternalForeignKeys
Description copied from class:AbstractDdlBuilderCreates external foreign key drop statements.- Overrides:
dropExternalForeignKeysin classAbstractDdlBuilder- Parameters:
table- The table
-
getSelectLastIdentityValues
Description copied from class:AbstractDdlBuilderGenerates 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:
getSelectLastIdentityValuesin classAbstractDdlBuilder- Parameters:
table- The table- Returns:
- The sql, or
nullif the database does not support this
-
getEnableIdentityOverrideSql
-
getDisableIdentityOverrideSql
-
getQuotationOnStatement
-
writeCopyDataStatement
Description copied from class:AbstractDdlBuilderWrites 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:
writeCopyDataStatementin classAbstractDdlBuilder- Parameters:
sourceTable- The source tabletargetTable- The target table
-
writeCastExpression
Description copied from class:AbstractDdlBuilderWrites 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:
writeCastExpressionin classAbstractDdlBuilder
-
processChanges
protected void processChanges(Database currentModel, Database desiredModel, List<IModelChange> changes, StringBuilder ddl) Description copied from class:AbstractDdlBuilderProcesses the changes. The default argument performs several passes:RemoveForeignKeyChangeandRemoveIndexChangecome first to allow for e.g. subsequent primary key changes or column removal.RemoveTableChangecomes 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.AddForeignKeyChangeandAddIndexChangecome last after table/column/primary key additions or changes.
- Overrides:
processChangesin classAbstractDdlBuilder
-
processTableStructureChanges
protected void processTableStructureChanges(Database currentModel, Database desiredModel, Table sourceTable, Table targetTable, List<TableChange> changes, StringBuilder ddl) Description copied from class:AbstractDdlBuilderAllows 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, allAddPrimaryKeyChangechanges are applied via anALTER TABLE ADD CONSTRAINTstatement.- Overrides:
processTableStructureChangesin 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__8000and is 48 characters long.- Returns:
- The identifier
-
writeCascadeAttributesForForeignKey
- Overrides:
writeCascadeAttributesForForeignKeyin classAbstractDdlBuilder
-