public abstract class SqlBuilder extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
_log
The Log to which logging calls will be made.
|
protected static String |
SIZE_PLACEHOLDER
The placeholder for the size value in the native type spec.
|
| Constructor and Description |
|---|
SqlBuilder(Platform platform)
Creates a new sql builder.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addEscapedCharSequence(String charSequence,
String escapedVersion)
Adds a char sequence that needs escaping, and its escaped version.
|
void |
alterDatabase(Database currentModel,
Database desiredModel,
CreationParameters params)
Generates the DDL to modify an existing database so the schema matches
the specified database schema by using drops, modifications and additions.
|
protected void |
applyForSelectedChanges(Collection changes,
Class[] changeTypes,
org.apache.commons.collections.Closure closure)
Calls the given closure for all changes that are of one of the given types, and
then removes them from the changes collection.
|
protected boolean |
areEqual(String string1,
String string2,
boolean caseMatters)
Compares the two strings.
|
protected boolean |
columnsDiffer(Column currentColumn,
Column desiredColumn)
Compares the current column in the database with the desired one.
|
void |
createExternalForeignKeys(Database database)
Creates the external foreignkey creation statements for all tables in the database.
|
void |
createExternalForeignKeys(Database database,
Table table)
Creates external foreignkey creation statements if necessary.
|
void |
createTable(Database database,
Table table)
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).
|
void |
createTable(Database database,
Table table,
Map parameters)
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).
|
void |
createTables(Database database)
Outputs the DDL required to drop and (re)create all tables in the database model.
|
void |
createTables(Database database,
boolean dropTables)
Outputs the DDL required to drop (if requested) and (re)create all tables in the database model.
|
void |
createTables(Database database,
CreationParameters params,
boolean dropTables)
Outputs the DDL required to drop (if requested) and (re)create all tables in the database model.
|
protected void |
createTemporaryTable(Database database,
Table table,
Map parameters)
Outputs the DDL to create the given temporary table.
|
protected String |
createUniqueIdentifier()
Creates a reasonably unique identifier only consisting of hexadecimal characters and underscores.
|
void |
dropExternalForeignKeys(Table table)
Creates external foreignkey drop statements.
|
void |
dropTable(Database database,
Table table)
Outputs the DDL required to drop the given table.
|
void |
dropTable(Table table)
Outputs the DDL to drop the table.
|
void |
dropTables(Database database)
Outputs the DDL required to drop the database.
|
protected void |
dropTemporaryTable(Database database,
Table table)
Outputs the DDL to drop the given temporary table.
|
protected String |
escapeStringValue(String value)
Escapes the necessary characters in given string value.
|
protected ForeignKey |
findCorrespondingForeignKey(Table table,
ForeignKey fk)
Searches in the given table for a corresponding foreign key.
|
protected String |
getBareNativeType(Column column)
Returns the bare database-native type for the given column without any size specifies.
|
protected String |
getColumnName(Column column)
Returns the column name.
|
String |
getConstraintName(String prefix,
Table table,
String secondPart,
String suffix)
Returns the constraint name.
|
DefaultValueHelper |
getDefaultValueHelper()
Returns the default value helper.
|
String |
getDeleteSql(Table table,
Map pkValues,
boolean genPlaceholders)
Creates the SQL for deleting an object from the specified table.
|
protected String |
getDelimitedIdentifier(String identifier)
Returns the delimited version of the identifier (if configured).
|
String |
getForeignKeyName(Table table,
ForeignKey fk)
Returns the name to be used for the given foreign key.
|
String |
getIndent()
Returns the string used to indent the SQL.
|
String |
getIndexName(Index index)
Returns the index name.
|
String |
getInsertSql(Table table,
Map columnValues,
boolean genPlaceholders)
Creates the SQL for inserting an object into the specified table.
|
int |
getMaxColumnNameLength()
Returns the maximum number of characters that a column name can have.
|
int |
getMaxConstraintNameLength()
Returns the maximum number of characters that a constraint name can have.
|
int |
getMaxForeignKeyNameLength()
Returns the maximum number of characters that a foreign key name can have.
|
int |
getMaxTableNameLength()
Returns the maximum number of characters that a table name can have.
|
protected String |
getNativeDefaultValue(Column column)
Returns the native default value for the column.
|
protected String |
getNativeType(Column column)
Returns the database-native type for the given column.
|
Platform |
getPlatform()
Returns the platform object.
|
PlatformInfo |
getPlatformInfo()
Returns the platform info object.
|
protected Table |
getRealTargetTableFor(Database targetModel,
Table sourceTable,
Table targetTable)
Creates the target table object that differs from the given target table only in the
indices.
|
String |
getSelectLastIdentityValues(Table table)
Generates the SQL for querying the id that was created in the last insertion
operation.
|
protected String |
getSqlType(Column column)
Returns the full SQL type specification (including size and precision/scale) for the
given column.
|
String |
getTableName(Table table)
Returns the table name.
|
protected Table |
getTemporaryTableFor(Database targetModel,
Table targetTable)
Creates a temporary table object that corresponds to the given table.
|
String |
getUpdateSql(Table table,
Map columnValues,
boolean genPlaceholders)
Creates the SQL for updating an object in the specified table.
|
protected String |
getValueAsString(Column column,
Object value)
Generates the string representation of the given value.
|
protected DateFormat |
getValueDateFormat()
Returns the format object for formatting dates in the specified locale.
|
String |
getValueLocale()
Returns the locale that is used for number and date formatting
(when printing default values and in generates insert/update/delete
statements).
|
protected NumberFormat |
getValueNumberFormat()
Returns the format object for formatting numbers in the specified locale.
|
protected DateFormat |
getValueTimeFormat()
Returns the format object for formatting times in the specified locale.
|
Writer |
getWriter()
Returns the writer that the DDL is printed to.
|
protected boolean |
isValidDefaultValue(String defaultSpec,
int typeCode)
Determines whether the given default spec is a non-empty spec that shall be used in a DEFAULT
expression.
|
protected void |
print(String text)
Prints some text.
|
protected void |
printComment(String text)
Prints an SQL comment to the current stream.
|
protected void |
printDefaultValue(Object defaultValue,
int typeCode)
Prints the default value of the column.
|
protected void |
printEndOfStatement()
Prints the end of statement text, which is typically a semi colon followed by
a carriage return.
|
protected void |
printIdentifier(String identifier)
Prints the given identifier.
|
protected void |
printIndent()
Prints the characters used to indent SQL.
|
protected void |
println()
Prints a newline.
|
protected void |
println(String text)
Prints some text followed by a newline.
|
protected void |
printlnIdentifier(String identifier)
Prints the given identifier followed by a newline.
|
protected void |
printStartOfEmbeddedStatement()
Prints the start of an embedded statement.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
AddPrimaryKeyChange change)
Processes the addition of a primary key to a table.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
AddForeignKeyChange change)
Processes the change representing the addition of a foreign key.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
AddIndexChange change)
Processes the change representing the addition of an index.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
AddTableChange change)
Processes the change representing the addition of a table.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
ModelChange change)
This is a fall-through callback which generates a warning because a specific
change type wasn't handled.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
RemoveForeignKeyChange change)
Processes the change representing the removal of a foreign key.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
RemoveIndexChange change)
Processes the change representing the removal of an index.
|
protected void |
processChange(Database currentModel,
Database desiredModel,
CreationParameters params,
RemoveTableChange change)
Processes the change representing the removal of a table.
|
protected void |
processChanges(Database currentModel,
Database desiredModel,
List changes,
CreationParameters params)
Processes the changes.
|
protected void |
processTableStructureChanges(Database currentModel,
Database desiredModel,
CreationParameters params,
Collection changes)
Processes the changes to the structure of tables.
|
protected void |
processTableStructureChanges(Database currentModel,
Database desiredModel,
String tableName,
Map parameters,
List changes)
Processes the changes to the structure of a single table.
|
protected void |
processTableStructureChanges(Database currentModel,
Database desiredModel,
Table sourceTable,
Table targetTable,
Map parameters,
List changes)
Allows database-specific implementations to handle changes in a database
specific manner.
|
void |
setIndent(String indent)
Sets the string used to indent the SQL.
|
protected void |
setValueDateFormat(DateFormat format)
Sets the format object for formatting dates in the specified locale.
|
void |
setValueLocale(String localeStr)
Sets the locale that is used for number and date formatting
(when printing default values and in generates insert/update/delete
statements).
|
protected void |
setValueNumberFormat(NumberFormat format)
Returns a new date format object for formatting numbers in the specified locale.
|
protected void |
setValueTimeFormat(DateFormat format)
Sets the date format object for formatting times in the specified locale.
|
void |
setWriter(Writer writer)
Sets the writer for printing the DDL to.
|
String |
shortenName(String name,
int desiredLength)
Generates a version of the name that has at most the specified
length.
|
protected boolean |
shouldGeneratePrimaryKeys(Column[] primaryKeyColumns)
Determines whether we should generate a primary key constraint for the given
primary key columns.
|
protected void |
writeCastExpression(Column sourceColumn,
Column targetColumn)
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)
Outputs the DDL for the specified column.
|
protected void |
writeColumnAutoIncrementStmt(Table table,
Column column)
Prints that the column is an auto increment column.
|
protected void |
writeColumnDefaultValue(Table table,
Column column)
Prints the default value of the column.
|
protected void |
writeColumnDefaultValueStmt(Table table,
Column column)
Prints the default value stmt part for the column.
|
protected void |
writeColumnNotNullableStmt()
Prints that a column is not nullable.
|
protected void |
writeColumnNullableStmt()
Prints that a column is nullable.
|
protected void |
writeColumns(Table table)
Writes the columns of the given table.
|
protected void |
writeCopyDataStatement(Table sourceTable,
Table targetTable)
Writes a statement that copies the data from the source to the target table.
|
protected void |
writeEmbeddedForeignKeysStmt(Database database,
Table table)
Writes the foreign key constraints inside a create table () clause.
|
protected void |
writeEmbeddedIndexCreateStmt(Table table,
Index index)
Writes the given embedded index of the table.
|
protected void |
writeEmbeddedIndicesStmt(Table table)
Writes the indexes embedded within the create table statement.
|
protected void |
writeEmbeddedPrimaryKeysStmt(Table table)
Writes the primary key constraints of the table inside its definition.
|
protected void |
writeExternalForeignKeyCreateStmt(Database database,
Table table,
ForeignKey key)
Writes a single foreign key constraint using a alter table statement.
|
protected void |
writeExternalForeignKeyDropStmt(Table table,
ForeignKey foreignKey)
Generates the statement to drop a foreignkey constraint from the database using an
alter table statement.
|
protected void |
writeExternalIndexCreateStmt(Table table,
Index index)
Writes the given index of the table.
|
void |
writeExternalIndexDropStmt(Table table,
Index index)
Generates the statement to drop a non-embedded index from the database.
|
protected void |
writeExternalIndicesCreateStmt(Table table)
Writes the indexes of the given table.
|
protected void |
writeExternalPrimaryKeysCreateStmt(Table table,
Column[] primaryKeyColumns)
Writes the primary key constraints of the table as alter table statements.
|
protected void |
writeForeignReferences(ForeignKey key)
Writes a list of foreign references for the given foreign key.
|
protected void |
writeLocalReferences(ForeignKey key)
Writes a list of local references for the given foreign key.
|
protected void |
writePrimaryKeyStmt(Table table,
Column[] primaryKeyColumns)
Writes a primary key statement for the given columns.
|
protected void |
writeTableAlterStmt(Table table)
Generates the first part of the ALTER TABLE statement including the
table name.
|
protected void |
writeTableComment(Table table)
Outputs a comment for the table.
|
protected void |
writeTableCreationStmt(Database database,
Table table,
Map parameters)
Writes the table creation statement without the statement end.
|
protected void |
writeTableCreationStmtEnding(Table table,
Map parameters)
Writes the end of the table creation statement.
|
protected static final String SIZE_PLACEHOLDER
protected final org.apache.commons.logging.Log _log
public SqlBuilder(Platform platform)
platform - The plaftform this builder belongs topublic Platform getPlatform()
public PlatformInfo getPlatformInfo()
public Writer getWriter()
public void setWriter(Writer writer)
writer - The writerpublic DefaultValueHelper getDefaultValueHelper()
public String getIndent()
public void setIndent(String indent)
indent - The indentation stringpublic String getValueLocale()
null if default formatting is usedpublic void setValueLocale(String localeStr)
localeStr - The new locale or null if default formatting
should be used; Format is "language[_country[_variant]]"protected DateFormat getValueDateFormat()
protected void setValueDateFormat(DateFormat format)
format - The date format objectprotected DateFormat getValueTimeFormat()
protected void setValueTimeFormat(DateFormat format)
format - The time format objectprotected NumberFormat getValueNumberFormat()
protected void setValueNumberFormat(NumberFormat format)
format - The number format objectprotected void addEscapedCharSequence(String charSequence, String escapedVersion)
charSequence - The char sequenceescapedVersion - The escaped versionpublic int getMaxTableNameLength()
public int getMaxColumnNameLength()
public int getMaxConstraintNameLength()
public int getMaxForeignKeyNameLength()
public void createTables(Database database) throws IOException
database - The database modelIOExceptionpublic void createTables(Database database, boolean dropTables) throws IOException
database - The databasedropTables - Whether to drop tables before creating themIOExceptionpublic void createTables(Database database, CreationParameters params, boolean dropTables) throws IOException
database - The databaseparams - The parameters used in the creationdropTables - Whether to drop tables before creating themIOExceptionpublic void alterDatabase(Database currentModel, Database desiredModel, CreationParameters params) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedIOExceptionprotected void applyForSelectedChanges(Collection changes, Class[] changeTypes, org.apache.commons.collections.Closure closure)
changes - The changeschangeTypes - The types to search forclosure - The closure to invokeprotected void processChanges(Database currentModel, Database desiredModel, List changes, CreationParameters params) throws IOException
RemoveForeignKeyChange and
RemoveIndexChange come first
to allow for e.g. subsequent primary key changes or column removal.RemoveTableChange
comes after the removal of foreign keys and indices.RemovePrimaryKeyChangeAddPrimaryKeyChangePrimaryKeyChangeRemoveColumnChangeAddColumnChangeColumnAutoIncrementChangeColumnDefaultValueChangeColumnRequiredChangeColumnDataTypeChangeColumnSizeChangeAddTableChangeAddForeignKeyChange and
AddIndexChange come last
after table/column/primary key additions or changes.currentModel - The current database schemadesiredModel - The desired database schemachanges - The changesparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, ModelChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, RemoveForeignKeyChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, RemoveIndexChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, RemoveTableChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, AddTableChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, AddForeignKeyChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processChange(Database currentModel, Database desiredModel, CreationParameters params, AddIndexChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchange - The change objectIOExceptionprotected void processTableStructureChanges(Database currentModel, Database desiredModel, CreationParameters params, Collection changes) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemaparams - The parameters used in the creation of new tables. Note that for existing
tables, the parameters won't be appliedchanges - The change objectsIOExceptionprotected void processTableStructureChanges(Database currentModel, Database desiredModel, String tableName, Map parameters, List changes) throws IOException
processTableStructureChanges(Database, Database, Table, Table, Map, List)
method instead.currentModel - The current database schemadesiredModel - The desired database schematableName - The name of the changed tableparameters - The creation parameters for the desired tablechanges - The change objects for this tableIOExceptionprotected void processTableStructureChanges(Database currentModel, Database desiredModel, Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException
AddPrimaryKeyChange changes are
applied via an ALTER TABLE ADD CONSTRAINT statement.currentModel - The current database schemadesiredModel - The desired database schemasourceTable - The original tabletargetTable - The desired tableparameters - The creation parameters for the tablechanges - The change objects for the target tableIOExceptionprotected Table getTemporaryTableFor(Database targetModel, Table targetTable) throws IOException
targetModel - The target databasetargetTable - The target tableIOExceptionprotected void createTemporaryTable(Database database, Table table, Map parameters) throws IOException
createTable(Database, Table, Map).database - The database modeltable - The tableparameters - Additional platform-specific parameters for the table creationIOExceptionprotected void dropTemporaryTable(Database database, Table table) throws IOException
dropTable(Table).database - The database modeltable - The tableIOExceptionprotected Table getRealTargetTableFor(Database targetModel, Table sourceTable, Table targetTable) throws IOException
targetModel - The target databasesourceTable - The source tabletargetTable - The target tableIOExceptionprotected void writeCopyDataStatement(Table sourceTable, Table targetTable) throws IOException
writeCastExpression(Column, Column) method.sourceTable - The source tabletargetTable - The target tableIOExceptionprotected void writeCastExpression(Column sourceColumn, Column targetColumn) throws IOException
sourceColumn - The source columntargetColumn - The target columnIOExceptionprotected void processChange(Database currentModel, Database desiredModel, AddPrimaryKeyChange change) throws IOException
currentModel - The current database schemadesiredModel - The desired database schemachange - The change objectIOExceptionprotected ForeignKey findCorrespondingForeignKey(Table table, ForeignKey fk)
table - The table to search infk - The original foreign keyprotected boolean areEqual(String string1, String string2, boolean caseMatters)
string1 - The first stringstring2 - The second stringcaseMatters - Whether case matters in the comparisontrue if the string are equalpublic void createTable(Database database, Table table) throws IOException
database - The database modeltable - The tableIOExceptionpublic void createTable(Database database, Table table, Map parameters) throws IOException
database - The database modeltable - The tableparameters - Additional platform-specific parameters for the table creationIOExceptionpublic void createExternalForeignKeys(Database database) throws IOException
database - The databaseIOExceptionpublic void createExternalForeignKeys(Database database, Table table) throws IOException
database - The database modeltable - The tableIOExceptionpublic void dropTables(Database database) throws IOException
database - The databaseIOExceptionpublic void dropTable(Database database, Table table) throws IOException
database - The databasetable - The tableIOExceptionpublic void dropTable(Table table) throws IOException
dropTable(Database, Table)
if you want that.table - The table to dropIOExceptionpublic void dropExternalForeignKeys(Table table) throws IOException
table - The tableIOExceptionpublic String getInsertSql(Table table, Map columnValues, boolean genPlaceholders)
table - The tablecolumnValues - The columns values indexed by the column namesgenPlaceholders - Whether to generate value placeholders for a
prepared statementpublic String getUpdateSql(Table table, Map columnValues, boolean genPlaceholders)
table - The tablecolumnValues - Contains the values for the columns to update, and should also
contain the primary key values to identify the object to update
in case genPlaceholders is falsegenPlaceholders - Whether to generate value placeholders for a
prepared statement (both for the pk values and the object values)public String getDeleteSql(Table table, Map pkValues, boolean genPlaceholders)
table - The tablepkValues - The primary key values indexed by the column names, can be emptygenPlaceholders - Whether to generate value placeholders for a
prepared statementprotected String getValueAsString(Column column, Object value)
column - The columnvalue - The valuepublic String getSelectLastIdentityValues(Table table)
null.table - The tablenull if the database does not support thispublic String shortenName(String name, int desiredLength)
name - The original namedesiredLength - The desired maximum lengthpublic String getTableName(Table table)
table - The tableprotected void writeTableComment(Table table) throws IOException
table - The tableIOExceptionprotected void writeTableAlterStmt(Table table) throws IOException
table - The table being alteredIOExceptionprotected void writeTableCreationStmt(Database database, Table table, Map parameters) throws IOException
database - The modeltable - The tableparameters - Additional platform-specific parameters for the table creationIOExceptionprotected void writeTableCreationStmtEnding(Table table, Map parameters) throws IOException
table - The tableparameters - Additional platform-specific parameters for the table creationIOExceptionprotected void writeColumns(Table table) throws IOException
table - The tableIOExceptionprotected String getColumnName(Column column) throws IOException
column - The columnIOExceptionprotected void writeColumn(Table table, Column column) throws IOException
table - The table containing the columncolumn - The columnIOExceptionprotected String getSqlType(Column column)
column - The columnprotected String getNativeType(Column column)
column - The columnprotected String getBareNativeType(Column column)
column - The columnprotected String getNativeDefaultValue(Column column)
column - The columnprotected String escapeStringValue(String value)
value - The valueprotected boolean isValidDefaultValue(String defaultSpec, int typeCode)
defaultSpec - The default value spectypeCode - The JDBC type codetrue if the default value spec is validprotected void writeColumnDefaultValueStmt(Table table, Column column) throws IOException
table - The tablecolumn - The columnIOExceptionprotected void writeColumnDefaultValue(Table table, Column column) throws IOException
table - The tablecolumn - The columnIOExceptionprotected void printDefaultValue(Object defaultValue, int typeCode) throws IOException
defaultValue - The default valuetypeCode - The type code to write the default value forIOExceptionprotected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException
table - The tablecolumn - The columnIOExceptionprotected void writeColumnNullableStmt()
throws IOException
IOExceptionprotected void writeColumnNotNullableStmt()
throws IOException
IOExceptionprotected boolean columnsDiffer(Column currentColumn, Column desiredColumn)
currentColumn - The current column as it is in the databasedesiredColumn - The desired columntrue if the column specifications differpublic String getForeignKeyName(Table table, ForeignKey fk)
table - The table for whith the foreign key is definedfk - The foreign keypublic String getConstraintName(String prefix, Table table, String secondPart, String suffix)
prefix - The constraint prefix, can be nulltable - The table that the constraint belongs tosecondPart - The second name part, e.g. the name of the constraint columnsuffix - The constraint suffix, e.g. a counter (can be null)protected void writeEmbeddedPrimaryKeysStmt(Table table) throws IOException
table - The tableIOExceptionprotected void writeExternalPrimaryKeysCreateStmt(Table table, Column[] primaryKeyColumns) throws IOException
table - The tableprimaryKeyColumns - The primary key columnsIOExceptionprotected boolean shouldGeneratePrimaryKeys(Column[] primaryKeyColumns)
primaryKeyColumns - The pk columnstrue if a pk statement should be generated for the columnsprotected void writePrimaryKeyStmt(Table table, Column[] primaryKeyColumns) throws IOException
table - The tableprimaryKeyColumns - The primary columnsIOExceptionpublic String getIndexName(Index index)
index - The indexprotected void writeExternalIndicesCreateStmt(Table table) throws IOException
table - The tableIOExceptionprotected void writeEmbeddedIndicesStmt(Table table) throws IOException
table - The tableIOExceptionprotected void writeExternalIndexCreateStmt(Table table, Index index) throws IOException
table - The tableindex - The indexIOExceptionprotected void writeEmbeddedIndexCreateStmt(Table table, Index index) throws IOException
table - The tableindex - The indexIOExceptionpublic void writeExternalIndexDropStmt(Table table, Index index) throws IOException
table - The table the index is onindex - The index to dropIOExceptionprotected void writeEmbeddedForeignKeysStmt(Database database, Table table) throws IOException
database - The database modeltable - The tableIOExceptionprotected void writeExternalForeignKeyCreateStmt(Database database, Table table, ForeignKey key) throws IOException
database - The database modeltable - The tablekey - The foreign keyIOExceptionprotected void writeLocalReferences(ForeignKey key) throws IOException
key - The foreign keyIOExceptionprotected void writeForeignReferences(ForeignKey key) throws IOException
key - The foreign keyIOExceptionprotected void writeExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey) throws IOException
table - The tableforeignKey - The foreign keyIOExceptionprotected void printComment(String text) throws IOException
text - The comment textIOExceptionprotected void printStartOfEmbeddedStatement()
throws IOException
IOExceptionprotected void printEndOfStatement()
throws IOException
IOExceptionprotected void println()
throws IOException
IOExceptionprotected void print(String text) throws IOException
text - The text to printIOExceptionprotected String getDelimitedIdentifier(String identifier)
identifier - The identifierprotected void printIdentifier(String identifier) throws IOException
identifier - The identifierIOExceptionprotected void printlnIdentifier(String identifier) throws IOException
identifier - The identifierIOExceptionprotected void println(String text) throws IOException
text - The text to printIOExceptionprotected void printIndent()
throws IOException
IOExceptionprotected String createUniqueIdentifier()
d578271282b42fce__2955b56e_107df3fbc96__8000 and is 48 characters long.Copyright © 2005-2013 Apache Software Foundation. All Rights Reserved.