|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.jdbc2xml.schema.impl.DDLHelper
public abstract class DDLHelper
Static helper methods to construct SQL queries for schema manipulations.
Constructor Summary | |
---|---|
DDLHelper()
|
Method Summary | |
---|---|
static String |
buildAddColumn(String tableName,
ColumnInfo ci,
Dialect dialect,
String addColumnCommand,
boolean addStmtInBrackets)
|
static String |
buildAddForeignKey(String tableName,
ForeignKeyInfo foreignKeyInfo,
boolean addStmtInBrackets)
|
static String |
buildAddIndex(TableInfo ti,
IndexInfo indexInfo,
boolean allowsMultipleNullsInUniqueIndizes)
|
static String |
buildCreateTable(TableInfo ti,
Dialect dialect,
String suffix)
Construct a create table statement. |
static String |
buildDropColumn(String tableName,
String columnName)
|
static String |
buildDropForeignKey(String tableName,
String foreignKeyName,
String dropForeignKeyCommand)
|
static String |
buildDropIndex(String tableName,
String indexName,
boolean needsOnTableSuffix)
|
static String |
buildDropTable(String tableName)
Build a drop table statement. |
static String |
buildHexSuffix()
|
static SqlCommand |
buildRenameTable(String renameTableCommand,
String tableName,
String newTableName)
Generate a rename table command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DDLHelper()
Method Detail |
---|
public static String buildCreateTable(TableInfo ti, Dialect dialect, String suffix)
ti
- the table information.dialect
- The dialect for creating column specs.suffix
- An RDBMS-specific suffix, which will be appended
after the create table clause.
public static String buildDropTable(String tableName)
tableName
- The name of the table to drop.
public static String buildAddIndex(TableInfo ti, IndexInfo indexInfo, boolean allowsMultipleNullsInUniqueIndizes) throws SQLException
ti
- the table information.indexInfo
- The description of the index to be created.allowsMultipleNullsInUniqueIndizes
- Specifies if a UNIQUE INDEX may contain multiple NULL values.
If false, INDEXes for NULLable columns must be created non-UNIQUE.
SQLException
- If the index does not contain a name.public static String buildDropIndex(String tableName, String indexName, boolean needsOnTableSuffix) throws SQLException
tableName
- The name of the table on which to drop the index.indexName
- The name of the index to drop.needsOnTableSuffix
- Specifies if DROP INDEX needs (or at least allows) the ON tableName suffix
SQLException
- If the index does not contain a name.public static String buildAddForeignKey(String tableName, ForeignKeyInfo foreignKeyInfo, boolean addStmtInBrackets) throws SQLException
tableName
- The name of the table on which to add a foreign key.foreignKeyInfo
- The description of the foreign key.addStmtInBrackets
- true
will produce ADD (statement)
, false for: ADD statement
.
SQLException
- If the foreign key uses unimplemented features.public static String buildDropForeignKey(String tableName, String foreignKeyName, String dropForeignKeyCommand)
tableName
- The name of the table on which to add a foreign key.foreignKeyName
- The name of the foreign key to drop.dropForeignKeyCommand
- The RDBMS-specific command after ALTER TABLE
needed to drop a foreign key.
public static String buildAddColumn(String tableName, ColumnInfo ci, Dialect dialect, String addColumnCommand, boolean addStmtInBrackets)
tableName
- the table name.ci
- The description of the column to be created.dialect
- The dialect for creating column specs.addColumnCommand
- The RDBMS specific command after ALTER TABLER
for adding a column.
public static String buildDropColumn(String tableName, String columnName)
tableName
- The name of the table on which to drop the column.columnName
- The name of the column to drop.
public static SqlCommand buildRenameTable(String renameTableCommand, String tableName, String newTableName)
renameTableComman
- The dialect specific command to rename a table, which must contain
two %s
placeholders, the first one for the original
table name, second one for the new table name.
If set to null
, the ISO SQL command
RENAME TABLE %s TO %s
is used for renaming the table.tableName
- The name of the table which will be renamed.newTableName
- The name of the table after renaming.
public static String buildHexSuffix()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |