public abstract class DBDDLGenerator<T extends DBDatabaseDriver> extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
alterColumnPhrase |
protected String |
databaseObjectName |
protected String |
DATATYPE_BLOB |
protected String |
DATATYPE_BOOLEAN |
protected String |
DATATYPE_CHAR |
protected String |
DATATYPE_CLOB |
protected String |
DATATYPE_DATE |
protected String |
DATATYPE_DECIMAL |
protected String |
DATATYPE_FLOAT |
protected String |
DATATYPE_INT_BIG |
protected String |
DATATYPE_INT_SMALL |
protected String |
DATATYPE_INTEGER |
protected String |
DATATYPE_TIMESTAMP |
protected String |
DATATYPE_UNIQUEID |
protected String |
DATATYPE_VARCHAR |
protected T |
driver |
protected boolean |
namePrimaryKeyConstraint |
Modifier | Constructor and Description |
---|---|
protected |
DBDDLGenerator(T driver) |
Modifier and Type | Method and Description |
---|---|
protected void |
addAlterTableStmt(DBColumn col,
StringBuilder sql,
DBSQLScript script) |
protected void |
addCreateIndexStmt(DBIndex index,
StringBuilder sql,
DBSQLScript script) |
protected void |
addCreateRelationStmt(DBRelation rel,
StringBuilder sql,
DBSQLScript script) |
protected void |
addCreateTableStmt(DBTable table,
StringBuilder sql,
DBSQLScript script) |
protected void |
addCreateViewStmt(DBView v,
StringBuilder sql,
DBSQLScript script) |
protected void |
alterTable(DBTableColumn col,
DBCmdType type,
DBSQLScript script)
Appends the DDL-Script for altering a table to an SQL-Script
|
protected boolean |
appendColumnDataType(DataType type,
double size,
DBTableColumn c,
StringBuilder sql)
appends the data type of a column
|
protected void |
appendColumnDesc(DBTableColumn c,
boolean alter,
StringBuilder sql)
Appends a table column definition to a ddl statement
|
protected void |
appendElementName(StringBuilder sql,
String name) |
protected void |
createDatabase(DBDatabase db,
DBSQLScript script)
Appends the DDL-Script for creating the given database to an SQL-Script
This includes the generation of all tables, views and relations. |
protected void |
createIndex(DBTable t,
DBIndex idx,
DBSQLScript script)
Appends the DDL-Script for creating a single index to an SQL-Script
|
protected void |
createRelation(DBRelation r,
DBSQLScript script)
Appends the DDL-Script for creating the given foreign-key relation to an SQL-Script
|
protected void |
createTable(DBTable t,
DBSQLScript script)
Appends the DDL-Script for creating the given table to an SQL-Script
|
protected void |
createTableIndexes(DBTable t,
DBIndex pk,
DBSQLScript script)
Appends the DDL-Script for creating all indexes of table (except the primary key) to an SQL-Script
|
protected void |
createView(DBView v,
DBSQLScript script)
Appends the DDL-Script for creating the given view to an SQL-Script
|
protected boolean |
detectQuoteName(String name) |
protected void |
dropDatabase(DBDatabase db,
DBSQLScript script)
Appends the DDL-Script for dropping a database to the given script object
|
protected void |
dropObject(String schema,
String name,
String objType,
DBSQLScript script)
Appends the DDL-Script for dropping a database object to an SQL-Script
|
void |
getDDLScript(DBCmdType type,
DBObject dbo,
DBSQLScript script)
Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.
|
protected T extends DBDatabaseDriver driver
protected String DATATYPE_INT_SMALL
protected String DATATYPE_INTEGER
protected String DATATYPE_INT_BIG
protected String DATATYPE_CHAR
protected String DATATYPE_VARCHAR
protected String DATATYPE_DATE
protected String DATATYPE_TIMESTAMP
protected String DATATYPE_BOOLEAN
protected String DATATYPE_DECIMAL
protected String DATATYPE_FLOAT
protected String DATATYPE_CLOB
protected String DATATYPE_BLOB
protected String DATATYPE_UNIQUEID
protected boolean namePrimaryKeyConstraint
protected String alterColumnPhrase
protected String databaseObjectName
protected DBDDLGenerator(T driver)
protected void addCreateTableStmt(DBTable table, StringBuilder sql, DBSQLScript script)
protected void addCreateIndexStmt(DBIndex index, StringBuilder sql, DBSQLScript script)
protected void addCreateRelationStmt(DBRelation rel, StringBuilder sql, DBSQLScript script)
protected void addCreateViewStmt(DBView v, StringBuilder sql, DBSQLScript script)
protected void addAlterTableStmt(DBColumn col, StringBuilder sql, DBSQLScript script)
protected boolean appendColumnDataType(DataType type, double size, DBTableColumn c, StringBuilder sql)
type
- the typesize
- the sizesql
- the builder that we will append toprotected void appendColumnDesc(DBTableColumn c, boolean alter, StringBuilder sql)
c
- the column which description to appendalter
- true if altering an existing column or false otherwisesql
- the sql builder objectpublic void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
type
- operation to perform (CREATE, DROP, ALTER)dbo
- the object for which to perform the operation (DBDatabase, DBTable, DBView, DBColumn, DBRelation)script
- the script to which to add the DDL command(s)protected void createDatabase(DBDatabase db, DBSQLScript script)
db
- the database to createscript
- the sql script to which to append the dll command(s)protected void dropDatabase(DBDatabase db, DBSQLScript script)
db
- the database to dropscript
- the sql script to which to append the dll command(s)protected void createTable(DBTable t, DBSQLScript script)
t
- the table to createscript
- the sql script to which to append the dll command(s)protected void createTableIndexes(DBTable t, DBIndex pk, DBSQLScript script)
t
- the table to createpk
- the primary key index to ignorescript
- the sql script to which to append the dll command(s)protected void createIndex(DBTable t, DBIndex idx, DBSQLScript script)
t
- the tableidx
- the index to createscript
- the sql script to which to append the dll command(s)protected void createRelation(DBRelation r, DBSQLScript script)
r
- the relation to createscript
- the sql script to which to append the dll command(s)protected void alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
col
- the column which to add, modify or droptype
- the type of operation to perform (CREATE | MODIFY | DROP)script
- the sql script to which to append the dll command(s)protected void createView(DBView v, DBSQLScript script)
v
- the view to createscript
- the sql script to which to append the dll command(s)protected void dropObject(String schema, String name, String objType, DBSQLScript script)
name
- the name of the object to deleteobjType
- the type of object to delete (TABLE, COLUMN, VIEW, RELATION, etc)script
- the sql script to which to append the dll command(s)protected boolean detectQuoteName(String name)
protected void appendElementName(StringBuilder sql, String name)
Copyright © 2008–2022 Apache Software Foundation. All rights reserved.