ca.sqlpower.architect.ddl
Class DB2DDLGenerator

java.lang.Object
  extended by ca.sqlpower.architect.ddl.GenericDDLGenerator
      extended by ca.sqlpower.architect.ddl.DB2DDLGenerator
All Implemented Interfaces:
DDLGenerator

public class DB2DDLGenerator
extends GenericDDLGenerator


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
DB2DDLGenerator()
           
 
Method Summary
protected  void createTypeMap()
          Creates and populates typeMap using DatabaseMetaData.
 java.lang.String getCatalogTerm()
          No catalogs in DB2.
 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 "Schema".
 boolean supportsDeferrabilityPolicy(SQLRelationship r)
          DB2 does not support a deferrability clause on FK constraints, but its default behaviour is like DEFERRABLE on other platforms.
 boolean supportsDeleteAction(SQLRelationship r)
          Returns true if this DDL generator supports the given relationship's delete action.
 boolean supportsUpdateAction(SQLRelationship r)
          Returns true if this DDL generator supports the given relationship's update action.
 void writeHeader()
           
 
Methods inherited from class ca.sqlpower.architect.ddl.GenericDDLGenerator
addColumn, addIndex, addPrimaryKey, addPrimaryKeysToCreateTable, addRelationship, addTable, columnDefinition, columnNullability, columnType, createPhysicalName, createSeqPhysicalName, dropColumn, dropPrimaryKey, dropRelationship, dropTable, endStatement, failsafeGetTypeDescriptor, generateDDLScript, generateDDLStatements, getAllowConnection, getColumnDataTypeName, getCon, getDdlStatements, getDefaultType, getDeleteActionClause, getProfileFunctionMap, getStatementTerminator, getTargetCatalog, getTargetSchema, getTypeMap, getUpdateActionClause, getWarnings, isReservedWord, makeDropForeignKeySQL, makeDropTableSQL, modifyColumn, print, println, setAllowConnection, setCon, setProfileFunctionMap, setTargetCatalog, setTargetSchema, setTypeMap, supportsRollback, toIdentifier, toQualifiedName, toQualifiedName, toQualifiedName, writeCreateDB, writeDDLTransactionBegin, writeDDLTransactionEnd, writeExportedRelationships, writePrimaryKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERATOR_VERSION

public static final java.lang.String GENERATOR_VERSION
See Also:
Constant Field Values
Constructor Detail

DB2DDLGenerator

public DB2DDLGenerator()
                throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

getName

public java.lang.String getName()
Description copied from interface: DDLGenerator
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.

Specified by:
getName in interface DDLGenerator
Overrides:
getName in class GenericDDLGenerator

writeHeader

public void writeHeader()
Overrides:
writeHeader in class GenericDDLGenerator

createTypeMap

protected void createTypeMap()
                      throws java.sql.SQLException
Description copied from class: GenericDDLGenerator
Creates and populates typeMap using DatabaseMetaData. Subclasses for specific DB platforms will be able to override this implementation with one that uses a static, pre-defined type map.

Overrides:
createTypeMap in class GenericDDLGenerator
Throws:
java.sql.SQLException

getCatalogTerm

public java.lang.String getCatalogTerm()
No catalogs in DB2.

Specified by:
getCatalogTerm in interface DDLGenerator
Overrides:
getCatalogTerm in class GenericDDLGenerator

getSchemaTerm

public java.lang.String getSchemaTerm()
Returns the string "Schema".

Specified by:
getSchemaTerm in interface DDLGenerator
Overrides:
getSchemaTerm in class GenericDDLGenerator

supportsDeleteAction

public boolean supportsDeleteAction(SQLRelationship r)
Description copied from class: GenericDDLGenerator
Returns true if this DDL generator supports the given relationship's delete action. The generic DDL generator claims to support all delete actions, so specific platforms that don't support all delete actions should override this method.

Overrides:
supportsDeleteAction in class GenericDDLGenerator

supportsUpdateAction

public boolean supportsUpdateAction(SQLRelationship r)
Description copied from class: GenericDDLGenerator
Returns true if this DDL generator supports the given relationship's update action. The generic DDL generator claims to support all update actions, so specific platforms that don't support all update actions should override this method.

Overrides:
supportsUpdateAction in class GenericDDLGenerator

supportsDeferrabilityPolicy

public boolean supportsDeferrabilityPolicy(SQLRelationship r)
DB2 does not support a deferrability clause on FK constraints, but its default behaviour is like DEFERRABLE on other platforms. So this method says DEFERRABLE is supported, and the other options are not.

Overrides:
supportsDeferrabilityPolicy in class GenericDDLGenerator
Returns:
Whether the chosen platform supports the deferrability.

getDeferrabilityClause

public java.lang.String getDeferrabilityClause(SQLRelationship r)
Description copied from class: GenericDDLGenerator
Returns the correct syntax for setting the deferrability of a foreign key relationship on this DDL Generator's target platform. Throws an UnsupportedOperationException if the platform does not support the given relationship's deferrability policy.

Overrides:
getDeferrabilityClause in class GenericDDLGenerator
Parameters:
r - The relationship the deferrability clause is for
Returns:
The SQL clause for declaring the deferrability policy in r.


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca