|
||||||||||
| 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.MySqlDDLGenerator
public class MySqlDDLGenerator
| 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 | |
|---|---|
MySqlDDLGenerator()
|
|
| Method Summary | |
|---|---|
void |
addIndex(SQLIndex index)
Adds a DDL statement to this generator that will create the given index. |
protected void |
addPrimaryKeysToCreateTable(SQLTable t)
|
java.lang.String |
columnType(SQLColumn c)
Adds support for the MySQL auto_increment feature. |
protected void |
createTypeMap()
Creates and populates typeMap using
DatabaseMetaData. |
void |
dropRelationship(SQLRelationship r)
Appends the DDL statement for dropping the given FK relationship in this DDL Generator's target schema/catalog. |
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.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 |
getDeleteActionClause(SQLRelationship r)
Returns the ON DELETE clause for the given relationship, with no extra whitespace or newline characters around it. |
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 |
getUpdateActionClause(SQLRelationship r)
Returns the ON UPDATE clause for the given relationship, with no extra whitespace or newline characters around it. |
boolean |
isReservedWord(java.lang.String word)
Subroutine for toIdentifier(). |
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. |
boolean |
supportsDeferrabilityPolicy(SQLRelationship r)
Returns true if the platform supports the deferrability policy of the given relationship, false otherwise. |
boolean |
supportsDeleteAction(SQLRelationship r)
Returns true if this DDL generator supports the given relationship's delete action. |
boolean |
supportsRollback()
The generic DDL generator claims to support rollback operation, so specific platforms that don't support it should override this method. |
boolean |
supportsUpdateAction(SQLRelationship r)
Returns true if this DDL generator supports the given relationship's update action. |
java.lang.String |
toIdentifier(java.lang.String name)
Converts space to underscore in name and returns
the possibly-modified string. |
protected void |
writePrimaryKey(SQLTable t)
|
| 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 MySqlDDLGenerator()
throws java.sql.SQLException
java.sql.SQLException| Method Detail |
|---|
public java.lang.String getName()
DDLGenerator
getName in interface DDLGeneratorgetName 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 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 boolean isReservedWord(java.lang.String word)
isReservedWord in interface DDLGeneratorisReservedWord in class GenericDDLGeneratorpublic java.lang.String getCatalogTerm()
GenericDDLGenerator
getCatalogTerm in interface DDLGeneratorgetCatalogTerm in class GenericDDLGeneratorpublic java.lang.String getSchemaTerm()
GenericDDLGenerator
getSchemaTerm in interface DDLGeneratorgetSchemaTerm in class GenericDDLGenerator
protected void addPrimaryKeysToCreateTable(SQLTable t)
throws ArchitectException
addPrimaryKeysToCreateTable in class GenericDDLGeneratorArchitectExceptionpublic void dropRelationship(SQLRelationship r)
DDLGenerator
dropRelationship in interface DDLGeneratordropRelationship in class GenericDDLGenerator
protected void writePrimaryKey(SQLTable t)
throws ArchitectException
writePrimaryKey in class GenericDDLGeneratorArchitectExceptionpublic java.lang.String columnType(SQLColumn c)
columnType in interface DDLGeneratorcolumnType in class GenericDDLGenerator
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 GenericDDLGeneratorpublic boolean supportsDeleteAction(SQLRelationship r)
GenericDDLGenerator
supportsDeleteAction in class GenericDDLGeneratorpublic java.lang.String getDeleteActionClause(SQLRelationship r)
GenericDDLGeneratorIf you are overriding this method for a platform-specific DDL generator and you need this clause to be empty, return the empty string--not null.
getDeleteActionClause in class GenericDDLGeneratorr - The relationship whose delete action clause to generate
public boolean supportsUpdateAction(SQLRelationship r)
GenericDDLGenerator
supportsUpdateAction in class GenericDDLGeneratorpublic java.lang.String getUpdateActionClause(SQLRelationship r)
GenericDDLGeneratorIf you are overriding this method for a platform-specific DDL generator and you need this clause to be empty, return the empty string--not null.
getUpdateActionClause in class GenericDDLGeneratorr - The relationship whose update action clause to generate
public void modifyColumn(SQLColumn c)
DDLGenerator
modifyColumn in interface DDLGeneratormodifyColumn in class GenericDDLGeneratorc - The column to create a MODIFY or ALTER COLUMN statement for.public boolean supportsRollback()
GenericDDLGenerator
supportsRollback in interface DDLGeneratorsupportsRollback in class GenericDDLGenerator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||