|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.architect.ddl.GenericDDLGenerator
ca.sqlpower.architect.ddl.SQLServerDDLGenerator
public abstract class SQLServerDDLGenerator
The base class for version-specific SQL Server DDL generators. This class is marked abstract because it is not appropriate to use it directly on any version of SQL Server.
| Field Summary | |
|---|---|
static java.lang.String |
GENERATOR_VERSION
|
| Fields inherited from class ca.sqlpower.architect.ddl.GenericDDLGenerator |
|---|
allowConnection, con, EOL, profileFunctionMap, targetCatalog, targetSchema, topLevelNames, typeMap, warnings |
| Constructor Summary | |
|---|---|
SQLServerDDLGenerator()
|
|
| 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 index)
Adds a DDL statement to this generator that will create the given index. |
java.lang.String |
columnType(SQLColumn c)
Adds support for the SQL Server identity feature. |
protected void |
createTypeMap()
Creates and populates typeMap using
DatabaseMetaData. |
java.lang.String |
getCatalogTerm()
Returns the string "Database". |
java.lang.String |
getDeferrabilityClause(SQLRelationship r)
Returns the correct syntax for setting the deferrability of a foreign key relationship on this DDL Generator's target platform. |
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()
Returns the string "Owner". |
java.lang.String |
getStatementTerminator()
Returns an empty string because SS2k doesn't need DDL statement terminators. |
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)
Generates a command for dropping a foreign key which works on some platforms. |
boolean |
supportsDeferrabilityPolicy(SQLRelationship r)
Returns true if the platform supports the deferrability policy of the given relationship, false otherwise. |
java.lang.String |
toIdentifier(java.lang.String name)
Converts space to underscore in name and returns
the possibly-modified string. |
void |
writeDDLTransactionBegin()
Does nothing. |
void |
writeDDLTransactionEnd()
Prints "GO" on its own line. |
void |
writeHeader()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String GENERATOR_VERSION
| Constructor Detail |
|---|
public SQLServerDDLGenerator()
throws java.sql.SQLException
java.sql.SQLException| Method Detail |
|---|
public java.lang.String getName()
DDLGenerator
getName in interface DDLGeneratorgetName in class GenericDDLGeneratorpublic boolean isReservedWord(java.lang.String word)
GenericDDLGenerator
isReservedWord in interface DDLGeneratorisReservedWord in class GenericDDLGeneratorpublic void writeHeader()
writeHeader in class GenericDDLGeneratorpublic void writeDDLTransactionBegin()
GenericDDLGenerator
writeDDLTransactionBegin in class GenericDDLGeneratorpublic void writeDDLTransactionEnd()
writeDDLTransactionEnd in class GenericDDLGeneratorpublic java.lang.String getStatementTerminator()
getStatementTerminator in interface DDLGeneratorgetStatementTerminator in class GenericDDLGenerator
protected void createTypeMap()
throws java.sql.SQLException
GenericDDLGeneratortypeMap using
DatabaseMetaData. Subclasses for specific DB platforms will be
able to override this implementation with one that uses a
static, pre-defined type map.
createTypeMap in class GenericDDLGeneratorjava.sql.SQLExceptionpublic java.lang.String getCatalogTerm()
getCatalogTerm in interface DDLGeneratorgetCatalogTerm in class GenericDDLGeneratorpublic java.lang.String getSchemaTerm()
getSchemaTerm in interface DDLGeneratorgetSchemaTerm in class GenericDDLGeneratorpublic java.lang.String toIdentifier(java.lang.String name)
GenericDDLGeneratorname and returns
the possibly-modified string. This will not be completely
sufficient because it leaves ".", "%", and lots of other
non-alphanumeric characters alone. Subclasses might choose to
quote and leave everything alone, or whatever.
toIdentifier in interface DDLGeneratortoIdentifier in class GenericDDLGeneratorpublic java.lang.String columnType(SQLColumn c)
identity feature.
columnType in interface DDLGeneratorcolumnType in class GenericDDLGeneratorpublic void addColumn(SQLColumn c)
DDLGenerator
addColumn in interface DDLGeneratoraddColumn in class GenericDDLGeneratorc - The column to create a ADD statement for.
public void addIndex(SQLIndex index)
throws ArchitectException
GenericDDLGenerator
addIndex in interface DDLGeneratoraddIndex in class GenericDDLGeneratorindex - The specification of the index to create. Note,
if the index type is STATISTIC, no DDL will be generated because
STATISTIC indices are just artificial JDBC constructs to describe
table statistics (you can't create or drop them).
ArchitectExceptionpublic java.lang.String getDeferrabilityClause(SQLRelationship r)
GenericDDLGeneratorUnsupportedOperationException if the platform does not
support the given relationship's deferrability policy.
getDeferrabilityClause in class GenericDDLGeneratorr - The relationship the deferrability clause is for
public boolean supportsDeferrabilityPolicy(SQLRelationship r)
GenericDDLGenerator
supportsDeferrabilityPolicy in class GenericDDLGenerator
public java.lang.String makeDropForeignKeySQL(java.lang.String fkTable,
java.lang.String fkName)
GenericDDLGeneratorALTER TABLE $fktable DROP FOREIGN KEY $fkname.
makeDropForeignKeySQL in interface DDLGeneratormakeDropForeignKeySQL in class GenericDDLGeneratorfkTable - The name of the FK table whose relationship should be dropped.fkName - The name of the key to drop.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||