ca.sqlpower.architect.ddl
Class HSQLDBDDLGenerator

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

public class HSQLDBDDLGenerator
extends GenericDDLGenerator

Implements the quirks required for successful DDL generation that targets HSQLDB versions 1.8 and newer.

Sorry about the class name.. we kind of got painted into a corner with our naming convention, and by the time HSQLDB support came along, it was too late to change it.


Field Summary
 
Fields inherited from class ca.sqlpower.architect.ddl.GenericDDLGenerator
allowConnection, con, EOL, GENERATOR_VERSION, profileFunctionMap, targetCatalog, targetSchema, topLevelNames, typeMap, warnings
 
Constructor Summary
HSQLDBDDLGenerator()
           
 
Method Summary
 java.lang.String columnType(SQLColumn c)
          Columnn type
protected  void createTypeMap()
          Creates and populates typeMap using DatabaseMetaData.
 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 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 supportsUpdateAction(SQLRelationship r)
          Returns true if this DDL generator supports the given relationship's update action.
 
Methods inherited from class ca.sqlpower.architect.ddl.GenericDDLGenerator
addColumn, addIndex, addPrimaryKey, addPrimaryKeysToCreateTable, addRelationship, addTable, columnDefinition, columnNullability, createPhysicalName, createSeqPhysicalName, dropColumn, dropPrimaryKey, dropRelationship, dropTable, endStatement, failsafeGetTypeDescriptor, generateDDLScript, generateDDLStatements, getAllowConnection, getColumnDataTypeName, getCon, getDdlStatements, getDefaultType, getProfileFunctionMap, getStatementTerminator, getTargetCatalog, getTargetSchema, getTypeMap, getWarnings, isReservedWord, makeDropForeignKeySQL, makeDropTableSQL, modifyColumn, print, println, setAllowConnection, setCon, setProfileFunctionMap, setTargetCatalog, setTargetSchema, setTypeMap, supportsRollback, toIdentifier, toQualifiedName, toQualifiedName, toQualifiedName, writeCreateDB, writeDDLTransactionBegin, writeDDLTransactionEnd, writeExportedRelationships, writeHeader, writePrimaryKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSQLDBDDLGenerator

public HSQLDBDDLGenerator()
                   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

getCatalogTerm

public java.lang.String getCatalogTerm()
Description copied from class: GenericDDLGenerator
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".

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

getSchemaTerm

public java.lang.String getSchemaTerm()
Description copied from class: GenericDDLGenerator
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".

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

columnType

public java.lang.String columnType(SQLColumn c)
Description copied from class: GenericDDLGenerator
Columnn type

Specified by:
columnType in interface DDLGenerator
Overrides:
columnType in class GenericDDLGenerator
Returns:

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.

supportsDeferrabilityPolicy

public boolean supportsDeferrabilityPolicy(SQLRelationship r)
Description copied from class: GenericDDLGenerator
Returns true if the platform supports the deferrability policy of the given relationship, false otherwise. This generic method assumes support for all deferrability policies.

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

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

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

getUpdateActionClause

public java.lang.String getUpdateActionClause(SQLRelationship r)
Description copied from class: GenericDDLGenerator
Returns the ON UPDATE clause for the given relationship, with no extra whitespace or newline characters around it.

If 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.

Overrides:
getUpdateActionClause in class GenericDDLGenerator
Parameters:
r - The relationship whose update action clause to generate
Returns:
The update action clause

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

getDeleteActionClause

public java.lang.String getDeleteActionClause(SQLRelationship r)
Description copied from class: GenericDDLGenerator
Returns the ON DELETE clause for the given relationship, with no extra whitespace or newline characters around it.

If 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.

Overrides:
getDeleteActionClause in class GenericDDLGenerator
Parameters:
r - The relationship whose delete action clause to generate
Returns:
The delete action clause


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