|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DDLGenerator
The DDLGenerator interface is a generic API for turning a SQLObject hierarchy into a series of SQL statements which create the corresponding data model in a physical database.
| Method Summary | |
|---|---|
void |
addColumn(SQLColumn c)
Appends the DDL statement for adding the given column to its parent table in this DDL Generator's target schema/catalog. |
void |
addIndex(SQLIndex idx)
Appends the DDL statements for creating the given index this DDL Generator's current catalog and schema. |
void |
addPrimaryKey(SQLTable t)
|
void |
addRelationship(SQLRelationship r)
Appends the DDL statement for creating the given FK relationship in this DDL Generator's target schema/catalog. |
void |
addTable(SQLTable t)
Appends the DDL statements for creating a table in this DDL Generator's current catalog and schema using SQLTable t as a template. |
java.lang.String |
columnType(SQLColumn col)
get the datatype with scale and percision of the column, example: "decimal(10,5)" |
void |
dropColumn(SQLColumn c)
Appends the DDL statement for dropping the given column from its parent table in this DDL Generator's target schema/catalog. |
void |
dropPrimaryKey(SQLTable t)
|
void |
dropRelationship(SQLRelationship r)
Appends the DDL statement for dropping the given FK relationship in this DDL Generator's target schema/catalog. |
void |
dropTable(SQLTable t)
Appends the DDL statements for dropping the table in this DDL Generator's current catalog and schema using SQLTable t's physical name. |
java.lang.String |
generateDDLScript(java.util.Collection<SQLTable> tables)
Generates the series of DDL Statements as in generateDDLStatements(Collection),
then compiles them into a formatted script complete with statement terminators
and transaction start and end statements (if supported by the target platform). |
java.util.List<DDLStatement> |
generateDDLStatements(java.util.Collection<SQLTable> tables)
Creates a list of DDLStatement objects which create all of the tables, their columns and primary keys, and the foreign key relationships of the given database. |
boolean |
getAllowConnection()
Tells the generator whether or not it can connect to the target database and ask for additional information during the generation process. |
java.lang.String |
getCatalogTerm()
The name that the target database gives to the JDBC idea of "catalog." For Oracle, this would be null (no catalogs) and for SQL Server it would be "Database". |
java.util.List<DDLStatement> |
getDdlStatements()
Returns the list of DDL statements that have been created so far. |
java.lang.String |
getName()
Returns the name of this DDL Generator, which should be a human-readable string with the vendor and/or product name (and version if the generator doesn't work with all versions) of the database platform this generator targets. |
java.lang.String |
getSchemaTerm()
The name that the target database gives to the JDBC idea of "schema." For Oracle, this would be "Schema" and for SQL Server it would be "Owner". |
java.lang.String |
getStatementTerminator()
Returns the string that should be used at the end of each statement. |
java.lang.String |
getTargetCatalog()
See #targetCatalog. |
java.lang.String |
getTargetSchema()
See #targetSchema. |
java.util.Map |
getTypeMap()
Gets the value of typeMap |
java.util.List |
getWarnings()
Returns #warnings. |
boolean |
isReservedWord(java.lang.String word)
Check to see if the word word is on the list of reserved words for this database |
java.lang.String |
makeDropForeignKeySQL(java.lang.String fkTable,
java.lang.String fkName)
Creates and returns a DDL statement which will drop a foreign key relationship in this DDL Generator's current catalog and schema. |
java.lang.String |
makeDropTableSQL(java.lang.String table)
Creates and returns a DDL statement which will drop the given table in this DDL Generator's current catalog and schema. |
void |
modifyColumn(SQLColumn c)
Appends the DDL statement for modifying the given column's datatype and nullability in its parent table in this DDL Generator's target schema/catalog. |
void |
setAllowConnection(boolean argAllowConnection)
See getAllowConnection(). |
void |
setTargetCatalog(java.lang.String argTargetCatalog)
See #targetCatalog. |
void |
setTargetSchema(java.lang.String argTargetSchema)
See #targetSchema. |
void |
setTypeMap(java.util.Map argTypeMap)
Sets the value of typeMap |
boolean |
supportsRollback()
Returns true if this DDL generator supports the rollback operation to return the database to some previous state. |
java.lang.String |
toIdentifier(java.lang.String name)
Converts an arbitrary string (which may contain spaces, mixed case, punctuation, and so on) into a valid identifier in the target database system. |
| Method Detail |
|---|
java.lang.String getName()
java.util.List<DDLStatement> generateDDLStatements(java.util.Collection<SQLTable> tables)
throws java.sql.SQLException,
ArchitectException
source - The database to generate a DDL representation of.
java.sql.SQLException - If there is a problem getting type info from the target DB.
ArchitectException - If there are problems with the Architect objects.
java.lang.String generateDDLScript(java.util.Collection<SQLTable> tables)
throws java.sql.SQLException,
ArchitectException
generateDDLStatements(Collection),
then compiles them into a formatted script complete with statement terminators
and transaction start and end statements (if supported by the target platform).
This script is appropriate to feed into a target database using a vendor-supplied
tool for executing SQL scripts.
tables - The collection of tables the generated script should create.
java.sql.SQLException - If there is a problem getting type info from the target DB.
ArchitectException - If there are problems with the Architect objects.void dropColumn(SQLColumn c)
c - The column to create a DROP statement for.void addColumn(SQLColumn c)
c - The column to create a ADD statement for.void modifyColumn(SQLColumn c)
c - The column to create a MODIFY or ALTER COLUMN statement for.void addRelationship(SQLRelationship r)
c - The relationship to create a FOREIGN KEY statement for.void dropRelationship(SQLRelationship r)
c - The relationship to create a DROP FOREIGN KEY statement for.void dropTable(SQLTable t)
void addTable(SQLTable t)
throws java.sql.SQLException,
ArchitectException
java.sql.SQLException
ArchitectException
void addIndex(SQLIndex idx)
throws ArchitectException
ArchitectExceptionjava.util.List<DDLStatement> getDdlStatements()
generateDDLStatements(Collection) to populate this list.
java.lang.String toIdentifier(java.lang.String name)
java.lang.String makeDropTableSQL(java.lang.String table)
table - The name of the table to be dropped.
java.lang.String makeDropForeignKeySQL(java.lang.String fkTable,
java.lang.String fkName)
fkTable - The name of the FK table whose relationship should be dropped.fkName - The name of the key to drop.
boolean getAllowConnection()
void setAllowConnection(boolean argAllowConnection)
getAllowConnection().
java.util.Map getTypeMap()
void setTypeMap(java.util.Map argTypeMap)
argTypeMap - Value to assign to this.typeMapjava.util.List getWarnings()
#warnings.
java.lang.String getTargetCatalog()
#targetCatalog.
void setTargetCatalog(java.lang.String argTargetCatalog)
#targetCatalog.
argTargetCatalog - Value to assign to this.targetCatalogjava.lang.String getTargetSchema()
#targetSchema.
void setTargetSchema(java.lang.String argTargetSchema)
#targetSchema.
argTargetSchema - Value to assign to this.targetSchemajava.lang.String getCatalogTerm()
java.lang.String getSchemaTerm()
void dropPrimaryKey(SQLTable t)
void addPrimaryKey(SQLTable t)
throws ArchitectException
ArchitectExceptionjava.lang.String getStatementTerminator()
boolean isReservedWord(java.lang.String word)
java.lang.String columnType(SQLColumn col)
col -
boolean supportsRollback()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||