You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2006/03/04 16:09:02 UTC
svn commit: r383130 [1/2] - in /db/ddlutils/trunk/src:
java/org/apache/ddlutils/ java/org/apache/ddlutils/platform/
java/org/apache/ddlutils/platform/axion/
java/org/apache/ddlutils/platform/cloudscape/
java/org/apache/ddlutils/platform/db2/ java/org/a...
Author: tomdz
Date: Sat Mar 4 07:08:59 2006
New Revision: 383130
URL: http://svn.apache.org/viewcvs?rev=383130&view=rev
Log:
Refactored platform-info properties
Moved property specifying whether delimited identifiers shall be used, to the platform, and changed its initial value to false
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Platform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbasePlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mssql/MSSqlPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySql50ModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySql50Platform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mysql/MySqlPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Builder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle10Platform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle8Builder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle8ModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/oracle/Oracle8Platform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sapdb/SapDbBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sapdb/SapDbModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sapdb/SapDbPlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybaseModelReader.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/sybase/SybasePlatform.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/PlatformConfiguration.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaSqlToFileCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToDatabaseCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/util/DatabaseTestHelper.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/TestDatabaseWriterBase.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestConstraints.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatatypes.java
db/ddlutils/trunk/src/test/org/apache/ddlutils/platform/SqlBuilderTest.java
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java Sat Mar 4 07:08:59 2006
@@ -111,6 +111,23 @@
public void setPassword(String password);
/**
+ * Determines whether delimited identifiers are used or normal SQL92 identifiers
+ * (which may only contain alphanumerical characters and the underscore, must start
+ * with a letter and cannot be a reserved keyword).
+ * Per default, delimited identifiers are not used
+ *
+ * @return <code>true</code> if delimited identifiers are used
+ */
+ public boolean isDelimitedIdentifierModeOn();
+
+ /**
+ * Determines whether delimited identifiers are used or normal SQL92 identifiers.
+ *
+ * @param delimitedIdentifierModeOn <code>true</code> if delimited identifiers shall be used
+ */
+ public void setDelimitedIdentifierModeOn(boolean delimitedIdentifierModeOn);
+
+ /**
* Returns a (new) JDBC connection from the data source.
*
* @return The connection
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/PlatformInfo.java Sat Mar 4 07:08:59 2006
@@ -35,48 +35,63 @@
/** The Log to which logging calls will be made. */
private final Log _log = LogFactory.getLog(PlatformInfo.class);
+ // properties influencing the definition of columns
+
/** Whether the database requires the explicit stating of NULL as the default value. */
- private boolean _requiringNullAsDefaultValue = false;
+ private boolean _nullAsDefaultValueRequired = false;
/** Whether default values can be defined for LONGVARCHAR/LONGVARBINARY columns. */
- private boolean _supportingDefaultValuesForLongTypes = true;
+ private boolean _defaultValuesForLongTypesSupported = true;
+ // properties influencing the specification of table constraints
+
/** Whether primary key constraints are embedded inside the create table statement. */
private boolean _primaryKeyEmbedded = true;
/** Whether foreign key constraints are embedded inside the create table statement. */
private boolean _foreignKeysEmbedded = false;
+ /** Whether embedded foreign key constraints are explicitly named. */
+ private boolean _embeddedForeignKeysNamed = false;
+
/** Whether non-unique indices are supported. */
- private boolean _supportingNonUniqueIndices = true;
+ private boolean _nonUniqueIndicesSupported = true;
/** Whether indices are embedded inside the create table statement. */
private boolean _indicesEmbedded = false;
- /** Whether embedded foreign key constraints are explicitly named. */
- private boolean _embeddedForeignKeysNamed = false;
-
/** Whether identity specification is supported for non-primary key columns. */
- private boolean _supportingNonPKIdentityColumns = true;
+ private boolean _nonPKIdentityColumnsSupported = true;
/** Whether the auto-increment definition is done via the DEFAULT part of the column definition. */
- private boolean _identitySpecUsesDefaultValue = false;
+ private boolean _defaultValueUsedForIdentitySpec = false;
- /** Whether an ALTER TABLE is needed to drop indexes. */
- private boolean _useAlterTableForDrop = false;
+ // properties influencing the reading of models from live databases
+
+ /** Whether system indices (database-generated indices for primary and foreign keys) are returned when
+ reading a model from a database. */
+ private boolean _systemIndicesReturned = true;
- /** Specifies the maximum length that an identifier (name of a table, column, constraint etc.)
- can have for this database; use -1 if there is no limit. */
- private int _maxIdentifierLength = -1;
+ /** Whether the database returns a synthetic default value for non-identity required columns. */
+ private boolean _syntheticDefaultValueForRequiredReturned = false;
+
+ /** Whether the platform is able to determine auto increment status from an existing database. */
+ private boolean _autoIncrementStatusReadingSupported = true;
- /** Whether identifiers are case sensitive or not. */
- private boolean _caseSensitive = false;
+ // other ddl properties
+
+ /** Whether comments are supported. */
+ private boolean _commentsSupported = true;
/** Whether delimited identifiers are supported or not. */
- private boolean _supportingDelimitedIdentifiers = true;
+ private boolean _delimitedIdentifiersSupported = true;
+
+ /** Whether an ALTER TABLE is needed to drop indexes. */
+ private boolean _alterTableForDropUsed = false;
- /** Whether delimited identifiers are used or not. */
- private boolean _useDelimitedIdentifiers = true;
+ /** Specifies the maximum length that an identifier (name of a table, column, constraint etc.)
+ can have for this database; use -1 if there is no limit. */
+ private int _maxIdentifierLength = -1;
/** The string used for delimiting SQL identifiers, eg. table names, column names etc. */
private String _delimiterToken = "\"";
@@ -84,9 +99,6 @@
/** The string used for escaping values when generating textual SQL statements. */
private String _valueQuoteToken = "'";
- /** Whether comments are supported. */
- private boolean _commentsSupported = true;
-
/** The string that starts a comment. */
private String _commentPrefix = "--";
@@ -114,16 +126,6 @@
/** Contains those JDBC types whose corresponding native types are types that have precision and scale on this platform. */
private HashSet _typesWithPrecisionAndScale = new HashSet();
- /** Whether system indices (database-generated indices for primary and foreign keys) are returned when
- reading a model from a database. */
- private boolean _returningSystemIndices = true;
-
- /** Whether the database returns a synthetic default value for non-identity required columns. */
- private boolean _returningDefaultValueForRequired = false;
-
- /** Whether the platform is able to determine auto increment status from an existing database. */
- private boolean _canReadAutoIncrementStatus = true;
-
/**
* Creates a new platform info object.
*/
@@ -147,15 +149,17 @@
_typesWithPrecisionAndScale.add(new Integer(Types.NUMERIC));
}
+ // properties influencing the definition of columns
+
/**
* Determines whether a NULL needs to be explicitly stated when the column
* has no specified default value. Default is false.
*
* @return <code>true</code> if NULL must be written for empty default values
*/
- public boolean isRequiringNullAsDefaultValue()
+ public boolean isNullAsDefaultValueRequired()
{
- return _requiringNullAsDefaultValue;
+ return _nullAsDefaultValueRequired;
}
/**
* Specifies whether a NULL needs to be explicitly stated when the column
@@ -164,9 +168,9 @@
* @param requiresNullAsDefaultValue Whether NULL must be written for empty
* default values
*/
- public void setRequiringNullAsDefaultValue(boolean requiresNullAsDefaultValue)
+ public void setNullAsDefaultValueRequired(boolean requiresNullAsDefaultValue)
{
- _requiringNullAsDefaultValue = requiresNullAsDefaultValue;
+ _nullAsDefaultValueRequired = requiresNullAsDefaultValue;
}
/**
@@ -174,9 +178,9 @@
*
* @return <code>true</code> if default values are allowed
*/
- public boolean isSupportingDefaultValuesForLongTypes()
+ public boolean isDefaultValuesForLongTypesSupported()
{
- return _supportingDefaultValuesForLongTypes;
+ return _defaultValuesForLongTypesSupported;
}
/**
@@ -184,11 +188,13 @@
*
* @param isSupported <code>true</code> if default values are supported
*/
- public void setSupportingDefaultValuesForLongTypes(boolean isSupported)
+ public void setDefaultValuesForLongTypesSupported(boolean isSupported)
{
- _supportingDefaultValuesForLongTypes = isSupported;
+ _defaultValuesForLongTypesSupported = isSupported;
}
+ // properties influencing the specification of table constraints
+
/**
* Determines whether primary key constraints are embedded in the create
* table clause or as seperate alter table statements. The default is
@@ -236,13 +242,33 @@
}
/**
+ * Returns whether embedded foreign key constraints should have a name.
+ *
+ * @return <code>true</code> if embedded fks have name
+ */
+ public boolean isEmbeddedForeignKeysNamed()
+ {
+ return _embeddedForeignKeysNamed;
+ }
+
+ /**
+ * Specifies whether embedded foreign key constraints should be named.
+ *
+ * @param embeddedForeignKeysNamed Whether embedded fks shall have a name
+ */
+ public void setEmbeddedForeignKeysNamed(boolean embeddedForeignKeysNamed)
+ {
+ _embeddedForeignKeysNamed = embeddedForeignKeysNamed;
+ }
+
+ /**
* Determines whether non-unique indices are supported.
*
* @return <code>true</code> if non-unique indices are supported
*/
- public boolean isSupportingNonUniqueIndices()
+ public boolean isNonUniqueIndicesSupported()
{
- return _supportingNonUniqueIndices;
+ return _nonUniqueIndicesSupported;
}
/**
@@ -251,9 +277,9 @@
* @param supportingNonUniqueIndices <code>true</code> if non-unique indices
* are supported
*/
- public void setSupportingNonUniqueIndices(boolean supportingNonUniqueIndices)
+ public void setNonUniqueIndicesSupported(boolean supportingNonUniqueIndices)
{
- _supportingNonUniqueIndices = supportingNonUniqueIndices;
+ _nonUniqueIndicesSupported = supportingNonUniqueIndices;
}
/**
@@ -279,33 +305,13 @@
}
/**
- * Returns whether embedded foreign key constraints should have a name.
- *
- * @return <code>true</code> if embedded fks have name
- */
- public boolean isEmbeddedForeignKeysNamed()
- {
- return _embeddedForeignKeysNamed;
- }
-
- /**
- * Specifies whether embedded foreign key constraints should be named.
- *
- * @param embeddedForeignKeysNamed Whether embedded fks shall have a name
- */
- public void setEmbeddedForeignKeysNamed(boolean embeddedForeignKeysNamed)
- {
- _embeddedForeignKeysNamed = embeddedForeignKeysNamed;
- }
-
- /**
* Determines whether non-primary key columns can be auto-incrementing (IDENTITY columns).
*
* @return <code>true</code> if normal non-PK columns can be auto-incrementing
*/
- public boolean isSupportingNonPKIdentityColumns()
+ public boolean isNonPKIdentityColumnsSupported()
{
- return _supportingNonPKIdentityColumns;
+ return _nonPKIdentityColumnsSupported;
}
/**
@@ -314,9 +320,9 @@
* @param supportingNonPKIdentityColumns <code>true</code> if normal non-PK columns can
* be auto-incrementing
*/
- public void setSupportingNonPKIdentityColumns(boolean supportingNonPKIdentityColumns)
+ public void setNonPKIdentityColumnsSupported(boolean supportingNonPKIdentityColumns)
{
- _supportingNonPKIdentityColumns = supportingNonPKIdentityColumns;
+ _nonPKIdentityColumnsSupported = supportingNonPKIdentityColumns;
}
/**
@@ -325,9 +331,9 @@
*
* @return <code>true</code> if the auto-increment spec is done via the DEFAULT value
*/
- public boolean isIdentitySpecUsesDefaultValue()
+ public boolean isDefaultValueUsedForIdentitySpec()
{
- return _identitySpecUsesDefaultValue;
+ return _defaultValueUsedForIdentitySpec;
}
/**
@@ -337,71 +343,104 @@
* @param identitySpecUsesDefaultValue <code>true</code> if the auto-increment spec is
* done via the DEFAULT value
*/
- public void setIdentitySpecUsesDefaultValue(boolean identitySpecUsesDefaultValue)
+ public void setDefaultValueUsedForIdentitySpec(boolean identitySpecUsesDefaultValue)
{
- _identitySpecUsesDefaultValue = identitySpecUsesDefaultValue;
+ _defaultValueUsedForIdentitySpec = identitySpecUsesDefaultValue;
}
+ // properties influencing the reading of models from live databases
+
/**
- * Determines whether an ALTER TABLE statement shall be used for dropping indices
- * or constraints. The default is false.
- *
- * @return <code>true</code> if ALTER TABLE is required
+ * Determines whether database-generated indices for primary and foreign keys are
+ * returned when reading a model from a database.
+ *
+ * @return <code>true</code> if system indices are read from a live database
*/
- public boolean isUseAlterTableForDrop()
+ public boolean isSystemIndicesReturned()
{
- return _useAlterTableForDrop;
+ return _systemIndicesReturned;
}
/**
- * Specifies whether an ALTER TABLE statement shall be used for dropping indices
- * or constraints.
- *
- * @param useAlterTableForDrop Whether ALTER TABLE will be used
+ * Specifies whether database-generated indices for primary and foreign keys are
+ * returned when reading a model from a database.
+ *
+ * @param returningSystemIndices <code>true</code> if system indices are read from
+ * a live database
*/
- public void setUseAlterTableForDrop(boolean useAlterTableForDrop)
+ public void setSystemIndicesReturned(boolean returningSystemIndices)
{
- _useAlterTableForDrop = useAlterTableForDrop;
+ _systemIndicesReturned = returningSystemIndices;
}
/**
- * Returns the maximum length of identifiers that this database allows.
+ * Determines whether the platform returns synthetic default values (e.g. 0 for numeric
+ * columns etc.) for non-identity required columns when reading a model from a database.
+ *
+ * @return <code>true</code> if synthetic default values are returned for non-identity
+ * required columns
+ */
+ public boolean isSyntheticDefaultValueForRequiredReturned()
+ {
+ return _syntheticDefaultValueForRequiredReturned;
+ }
+
+ /**
+ * Specifies whether the platform returns synthetic default values (e.g. 0 for numeric
+ * columns etc.) for non-identity required columns when reading a model from a database.
+ *
+ * @param returningDefaultValue <code>true</code> if synthetic default values are returned for
+ * non-identity required columns
+ */
+ public void setSyntheticDefaultValueForRequiredReturned(boolean returningDefaultValue)
+ {
+ _syntheticDefaultValueForRequiredReturned = returningDefaultValue;
+ }
+
+ /**
+ * Determines whether the platform is able to read the auto-increment status for columns
+ * from an existing database.
*
- * @return The maximum identifier length, -1 if unlimited
+ * @return <code>true</code> if the auto-increment status can be determined from an existing
+ * database
*/
- public int getMaxIdentifierLength()
+ public boolean getAutoIncrementStatusReadingSupported()
{
- return _maxIdentifierLength;
+ return _autoIncrementStatusReadingSupported;
}
/**
- * Sets the maximum length of identifiers that this database allows.
+ * Specifies whether the platform is able to read the auto-increment status for columns
+ * from an existing database.
*
- * @param maxIdentifierLength The maximum identifier length, -1 if unlimited
+ * @param canReadAutoIncrementStatus <code>true</code> if the auto-increment status can be
+ * determined from an existing database
*/
- public void setMaxIdentifierLength(int maxIdentifierLength)
+ public void setAutoIncrementStatusReadingSupported(boolean canReadAutoIncrementStatus)
{
- _maxIdentifierLength = maxIdentifierLength;
+ _autoIncrementStatusReadingSupported = canReadAutoIncrementStatus;
}
+ // other ddl properties
+
/**
- * Determines whether the database has case sensitive identifiers.
+ * Determines whether the database supports comments.
*
- * @return <code>true</code> if case of the the identifiers is important
+ * @return <code>true</code> if comments are supported
*/
- public boolean isCaseSensitive()
+ public boolean isCommentsSupported()
{
- return _caseSensitive;
+ return _commentsSupported;
}
/**
- * Specifies whether the database has case sensitive identifiers.
- *
- * @param caseSensitive <code>true</code> if case of the the identifiers is important
+ * Specifies whether comments are supported by the database.
+ *
+ * @param commentsSupported <code>true</code> if comments are supported
*/
- public void setCaseSensitive(boolean caseSensitive)
+ public void setCommentsSupported(boolean commentsSupported)
{
- _caseSensitive = caseSensitive;
+ _commentsSupported = commentsSupported;
}
/**
@@ -409,9 +448,9 @@
*
* @return <code>true</code> if delimited identifiers are supported
*/
- public boolean isSupportingDelimitedIdentifiers()
+ public boolean isDelimitedIdentifiersSupported()
{
- return _supportingDelimitedIdentifiers;
+ return _delimitedIdentifiersSupported;
}
/**
@@ -419,32 +458,51 @@
*
* @param areSupported <code>true</code> if delimited identifiers are supported
*/
- public void setSupportingDelimitedIdentifiers(boolean areSupported)
+ public void setDelimitedIdentifiersSupported(boolean areSupported)
{
- _supportingDelimitedIdentifiers = areSupported;
+ _delimitedIdentifiersSupported = areSupported;
}
/**
- * Determines whether delimited identifiers are used or normal SQL92 identifiers
- * (which may only contain alphanumerical characters and the underscore, must start
- * with a letter and cannot be a reserved keyword).
- * Per default, delimited identifiers are used
- *
- * @return <code>true</code> if delimited identifiers are used
+ * Determines whether an ALTER TABLE statement shall be used for dropping indices
+ * or constraints. The default is false.
+ *
+ * @return <code>true</code> if ALTER TABLE is required
*/
- public boolean isUseDelimitedIdentifiers()
+ public boolean isAlterTableForDropUsed()
{
- return _useDelimitedIdentifiers;
+ return _alterTableForDropUsed;
}
/**
- * Determines whether delimited identifiers are used or normal SQL92 identifiers.
- *
- * @param useDelimitedIdentifiers <code>true</code> if delimited identifiers are used
+ * Specifies whether an ALTER TABLE statement shall be used for dropping indices
+ * or constraints.
+ *
+ * @param useAlterTableForDrop Whether ALTER TABLE will be used
*/
- public void setUseDelimitedIdentifiers(boolean useDelimitedIdentifiers)
+ public void setAlterTableForDropUsed(boolean useAlterTableForDrop)
{
- _useDelimitedIdentifiers = useDelimitedIdentifiers;
+ _alterTableForDropUsed = useAlterTableForDrop;
+ }
+
+ /**
+ * Returns the maximum length of identifiers that this database allows.
+ *
+ * @return The maximum identifier length, -1 if unlimited
+ */
+ public int getMaxIdentifierLength()
+ {
+ return _maxIdentifierLength;
+ }
+
+ /**
+ * Sets the maximum length of identifiers that this database allows.
+ *
+ * @param maxIdentifierLength The maximum identifier length, -1 if unlimited
+ */
+ public void setMaxIdentifierLength(int maxIdentifierLength)
+ {
+ _maxIdentifierLength = maxIdentifierLength;
}
/**
@@ -492,26 +550,6 @@
}
/**
- * Determines whether the database supports comments.
- *
- * @return <code>true</code> if comments are supported
- */
- public boolean isCommentsSupported()
- {
- return _commentsSupported;
- }
-
- /**
- * Specifies whether comments are supported by the database.
- *
- * @param commentsSupported <code>true</code> if comments are supported
- */
- public void setCommentsSupported(boolean commentsSupported)
- {
- _commentsSupported = commentsSupported;
- }
-
- /**
* Returns the string that denotes the beginning of a comment.
*
* @return The comment prefix
@@ -573,6 +611,34 @@
}
/**
+ * Returns the database-native type for the given type code.
+ *
+ * @param typeCode The {@link java.sql.Types} type code
+ * @return The native type or <code>null</code> if there isn't one defined
+ */
+ public String getNativeType(int typeCode)
+ {
+ return (String)_nativeTypes.get(new Integer(typeCode));
+ }
+
+ /**
+ * Returns the jdbc type corresponding to the native type that is used for the given
+ * jdbc type. This is most often the same jdbc type, but can also be a different one.
+ * For instance, if a database has no native boolean type, then the source jdbc type
+ * would be <code>BIT</code> or <code>BOOLEAN</code>, and the target jdbc type might
+ * be <code>TINYINT</code> or <code>SMALLINT</code>.
+ *
+ * @param typeCode The {@link java.sql.Types} type code
+ * @return The target jdbc type
+ */
+ public int getTargetJdbcType(int typeCode)
+ {
+ Integer targetJdbcType = (Integer)_targetJdbcTypes.get(new Integer(typeCode));
+
+ return targetJdbcType == null ? typeCode : targetJdbcType.intValue();
+ }
+
+ /**
* Adds a mapping from jdbc type to database-native type.
*
* @param jdbcTypeCode The jdbc type code as defined by {@link java.sql.Types}
@@ -659,77 +725,15 @@
}
/**
- * Returns the database-native type for the given type code.
- *
- * @param typeCode The {@link java.sql.Types} type code
- * @return The native type or <code>null</code> if there isn't one defined
- */
- public String getNativeType(int typeCode)
- {
- return (String)_nativeTypes.get(new Integer(typeCode));
- }
-
- /**
- * Returns the jdbc type corresponding to the native type that is used for the given
- * jdbc type. This is most often the same jdbc type, but can also be a different one.
- * For instance, if a database has no native boolean type, then the source jdbc type
- * would be <code>BIT</code> or <code>BOOLEAN</code>, and the target jdbc type might
- * be <code>TINYINT</code> or <code>SMALLINT</code>.
- *
- * @param typeCode The {@link java.sql.Types} type code
- * @return The target jdbc type
- */
- public int getTargetJdbcType(int typeCode)
- {
- Integer targetJdbcType = (Integer)_targetJdbcTypes.get(new Integer(typeCode));
-
- return targetJdbcType == null ? typeCode : targetJdbcType.intValue();
- }
-
- /**
- * Adds a default size for the given jdbc type.
- *
- * @param jdbcTypeCode The jdbc type code
- * @param defaultSize The default size
- */
- public void addDefaultSize(int jdbcTypeCode, int defaultSize)
- {
- _typesDefaultSizes.put(new Integer(jdbcTypeCode), new Integer(defaultSize));
- }
-
- /**
- * Returns the default size value for the given type, if any.
- *
- * @param jdbcTypeCode The jdbc type code
- * @return The default size or <code>null</code> if none is defined
- */
- public Integer getDefaultSize(int jdbcTypeCode)
- {
- return (Integer)_typesDefaultSizes.get(new Integer(jdbcTypeCode));
- }
-
- /**
- * Adds a default size for the given jdbc type.
+ * Determines whether the native type for the given sql type code (one of the
+ * {@link java.sql.Types} constants) has a null default value on this platform.
*
- * @param jdbcTypeName The name of the jdbc type, one of the {@link Types} constants
- * @param defaultSize The default size
+ * @param sqlTypeCode The sql type code
+ * @return <code>true</code> if the native type has a null default value
*/
- public void addDefaultSize(String jdbcTypeName, int defaultSize)
+ public boolean hasNullDefault(int sqlTypeCode)
{
- try
- {
- Field constant = Types.class.getField(jdbcTypeName);
-
- if (constant != null)
- {
- addDefaultSize(constant.getInt(null), defaultSize);
- }
- }
- catch (Exception ex)
- {
- // ignore -> won't be defined
- _log.warn("Cannot add default size for undefined jdbc type "+jdbcTypeName, ex);
- }
+ return _typesWithNullDefault.contains(new Integer(sqlTypeCode));
}
/**
@@ -753,14 +757,14 @@
/**
* Determines whether the native type for the given sql type code (one of the
- * {@link java.sql.Types} constants) has a null default value on this platform.
+ * {@link java.sql.Types} constants) has a size specification on this platform.
*
* @param sqlTypeCode The sql type code
- * @return <code>true</code> if the native type has a null default value
+ * @return <code>true</code> if the native type has a size specification
*/
- public boolean hasNullDefault(int sqlTypeCode)
+ public boolean hasSize(int sqlTypeCode)
{
- return _typesWithNullDefault.contains(new Integer(sqlTypeCode));
+ return _typesWithSize.contains(new Integer(sqlTypeCode));
}
/**
@@ -783,34 +787,48 @@
}
/**
- * Determines whether the native type for the given sql type code (one of the
- * {@link java.sql.Types} constants) has a size specification on this platform.
+ * Returns the default size value for the given type, if any.
*
- * @param sqlTypeCode The sql type code
- * @return <code>true</code> if the native type has a size specification
+ * @param jdbcTypeCode The jdbc type code
+ * @return The default size or <code>null</code> if none is defined
*/
- public boolean hasSize(int sqlTypeCode)
+ public Integer getDefaultSize(int jdbcTypeCode)
{
- return _typesWithSize.contains(new Integer(sqlTypeCode));
+ return (Integer)_typesDefaultSizes.get(new Integer(jdbcTypeCode));
}
/**
- * Specifies whether the native type for the given sql type code (one of the
- * {@link java.sql.Types} constants) has precision and scale specifications on
- * this platform.
+ * Adds a default size for the given jdbc type.
*
- * @param sqlTypeCode The sql type code
- * @param hasPrecisionAndScale <code>true</code> if the native type has precision and scale specifications
+ * @param jdbcTypeCode The jdbc type code
+ * @param defaultSize The default size
*/
- public void setHasPrecisionAndScale(int sqlTypeCode, boolean hasPrecisionAndScale)
+ public void setDefaultSize(int jdbcTypeCode, int defaultSize)
{
- if (hasPrecisionAndScale)
+ _typesDefaultSizes.put(new Integer(jdbcTypeCode), new Integer(defaultSize));
+ }
+
+ /**
+ * Adds a default size for the given jdbc type.
+ *
+ * @param jdbcTypeName The name of the jdbc type, one of the {@link Types} constants
+ * @param defaultSize The default size
+ */
+ public void setDefaultSize(String jdbcTypeName, int defaultSize)
+ {
+ try
{
- _typesWithPrecisionAndScale.add(new Integer(sqlTypeCode));
+ Field constant = Types.class.getField(jdbcTypeName);
+
+ if (constant != null)
+ {
+ setDefaultSize(constant.getInt(null), defaultSize);
+ }
}
- else
+ catch (Exception ex)
{
- _typesWithPrecisionAndScale.remove(new Integer(sqlTypeCode));
+ // ignore -> won't be defined
+ _log.warn("Cannot add default size for undefined jdbc type "+jdbcTypeName, ex);
}
}
@@ -828,73 +846,22 @@
}
/**
- * Determines whether database-generated indices for primary and foreign keys are
- * returned when reading a model from a database.
- *
- * @return <code>true</code> if system indices are read from a live database
- */
- public boolean isReturningSystemIndices()
- {
- return _returningSystemIndices;
- }
-
- /**
- * Specifies whether database-generated indices for primary and foreign keys are
- * returned when reading a model from a database.
- *
- * @param returningSystemIndices <code>true</code> if system indices are read from
- * a live database
- */
- public void setReturningSystemIndices(boolean returningSystemIndices)
- {
- _returningSystemIndices = returningSystemIndices;
- }
-
- /**
- * Determines whether the platform returns synthetic default values (e.g. 0 for numeric
- * columns etc.) for non-identity required columns when reading a model from a database.
- *
- * @return <code>true</code> if synthetic default values are returned for non-identity
- * required columns
- */
- public boolean isReturningDefaultValueForRequired()
- {
- return _returningDefaultValueForRequired;
- }
-
- /**
- * Specifies whether the platform returns synthetic default values (e.g. 0 for numeric
- * columns etc.) for non-identity required columns when reading a model from a database.
- *
- * @param returningDefaultValue <code>true</code> if synthetic default values are returned for
- * non-identity required columns
+ * Specifies whether the native type for the given sql type code (one of the
+ * {@link java.sql.Types} constants) has precision and scale specifications on
+ * this platform.
+ *
+ * @param sqlTypeCode The sql type code
+ * @param hasPrecisionAndScale <code>true</code> if the native type has precision and scale specifications
*/
- public void setReturningDefaultValueForRequired(boolean returningDefaultValue)
+ public void setHasPrecisionAndScale(int sqlTypeCode, boolean hasPrecisionAndScale)
{
- _returningDefaultValueForRequired = returningDefaultValue;
+ if (hasPrecisionAndScale)
+ {
+ _typesWithPrecisionAndScale.add(new Integer(sqlTypeCode));
+ }
+ else
+ {
+ _typesWithPrecisionAndScale.remove(new Integer(sqlTypeCode));
+ }
}
-
- /**
- * Determines whether the platform is able to read the auto-increment status for columns
- * from an existing database.
- *
- * @return <code>true</code> if the auto-increment status can be determined from an existing
- * database
- */
- public boolean getCanReadAutoIncrementStatus()
- {
- return _canReadAutoIncrementStatus;
- }
-
- /**
- * Specifies whether the platform is able to read the auto-increment status for columns
- * from an existing database.
- *
- * @param canReadAutoIncrementStatus <code>true</code> if the auto-increment status can be
- * determined from an existing database
- */
- public void setCanReadAutoIncrementStatus(boolean canReadAutoIncrementStatus)
- {
- _canReadAutoIncrementStatus = canReadAutoIncrementStatus;
- }
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java Sat Mar 4 07:08:59 2006
@@ -33,6 +33,7 @@
import org.apache.commons.collections.map.ListOrderedMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.PlatformInfo;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Database;
@@ -67,8 +68,8 @@
/** The descriptors for the relevant columns in the index meta data. */
private final List _columnsForIndex;
- /** The platform specific settings. */
- private PlatformInfo _platformInfo;
+ /** The platform that this model reader belongs to. */
+ private Platform _platform;
/** Contains default column sizes (minimum sizes that a JDBC-compliant db must support). */
private HashMap _defaultSizes = new HashMap();
/** The default database catalog to read. */
@@ -87,11 +88,11 @@
/**
* Creates a new model reader instance.
*
- * @param platformInfo The platform specific settings
+ * @param platform The plaftform this builder belongs to
*/
- public JdbcModelReader(PlatformInfo platformInfo)
+ public JdbcModelReader(Platform platform)
{
- _platformInfo = platformInfo;
+ _platform = platform;
_defaultSizes.put(new Integer(Types.CHAR), "254");
_defaultSizes.put(new Integer(Types.VARCHAR), "254");
@@ -115,13 +116,23 @@
}
/**
+ * Returns the platform that this model reader belongs to.
+ *
+ * @return The platform
+ */
+ public Platform getPlatform()
+ {
+ return _platform;
+ }
+
+ /**
* Returns the platform specific settings.
*
* @return The platform settings
*/
public PlatformInfo getPlatformInfo()
{
- return _platformInfo;
+ return _platform.getPlatformInfo();
}
/**
@@ -539,7 +550,7 @@
table.findColumn((String)it.next(), true).setPrimaryKey(true);
}
- if (getPlatformInfo().isReturningSystemIndices())
+ if (getPlatformInfo().isSystemIndicesReturned())
{
removeSystemIndices(table);
}
@@ -978,23 +989,23 @@
{
query.append(",");
}
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
query.append(getPlatformInfo().getDelimiterToken());
}
query.append(columnsToCheck[idx].getName());
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
query.append(getPlatformInfo().getDelimiterToken());
}
}
query.append(" FROM ");
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
query.append(getPlatformInfo().getDelimiterToken());
}
query.append(table.getName());
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
query.append(getPlatformInfo().getDelimiterToken());
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java Sat Mar 4 07:08:59 2006
@@ -111,7 +111,7 @@
ResultSetMetaData metaData = _resultSet.getMetaData();
String tableName = null;
boolean singleKnownTable = true;
- boolean caseSensitive = _platform.getPlatformInfo().isUseDelimitedIdentifiers();
+ boolean caseSensitive = _platform.isDelimitedIdentifierModeOn();
Map preparedQueryHints = prepareQueryHints(queryHints, caseSensitive);
for (int idx = 1; idx <= metaData.getColumnCount(); idx++)
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Sat Mar 4 07:08:59 2006
@@ -68,10 +68,14 @@
/** The log for this platform. */
private final Log _log = LogFactory.getLog(getClass());
+ /** The platform info. */
+ private PlatformInfo _info = new PlatformInfo();
/** The sql builder for this platform. */
private SqlBuilder _builder;
/** The model reader for this platform. */
private JdbcModelReader _modelReader;
+ /** Whether delimited identifiers are used or not. */
+ private boolean _delimitedIdentifierModeOn = false;
/**
* {@inheritDoc}
@@ -98,7 +102,7 @@
{
if (_modelReader == null)
{
- _modelReader = new JdbcModelReader(getPlatformInfo());
+ _modelReader = new JdbcModelReader(this);
}
return _modelReader;
}
@@ -118,7 +122,23 @@
*/
public PlatformInfo getPlatformInfo()
{
- return _builder.getPlatformInfo();
+ return _info;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isDelimitedIdentifierModeOn()
+ {
+ return _delimitedIdentifierModeOn;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDelimitedIdentifierModeOn(boolean delimitedIdentifierModeOn)
+ {
+ _delimitedIdentifierModeOn = delimitedIdentifierModeOn;
}
/**
@@ -1743,7 +1763,7 @@
*/
protected Object getObjectFromResultSet(ResultSet resultSet, String columnName, Table table) throws SQLException
{
- Column column = (table == null ? null : table.findColumn(columnName, getPlatformInfo().isCaseSensitive()));
+ Column column = (table == null ? null : table.findColumn(columnName, isDelimitedIdentifierModeOn()));
Object value = null;
if (column != null)
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java Sat Mar 4 07:08:59 2006
@@ -32,6 +32,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ddlutils.DynaSqlException;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.PlatformInfo;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Database;
@@ -70,30 +71,22 @@
/** The Log to which logging calls will be made. */
protected final Log _log = LogFactory.getLog(SqlBuilder.class);
+ /** The platform that this builder belongs to. */
+ private Platform _platform;
/** The current Writer used to output the SQL to. */
private Writer _writer;
-
/** The indentation used to indent commands. */
private String _indent = " ";
-
- /** The platform info. */
- private PlatformInfo _info;
-
/** An optional locale specification for number and date formatting. */
private String _valueLocale;
-
/** The date formatter. */
private DateFormat _valueDateFormat;
-
/** The date time formatter. */
private DateFormat _valueTimeFormat;
-
/** The number formatter. */
private NumberFormat _valueNumberFormat;
-
/** Helper object for dealing with default values. */
private DefaultValueHelper _defaultValueHelper = new DefaultValueHelper();
-
/** The character sequences that need escaping. */
private Map _charSequencesToEscape = new ListOrderedMap();
@@ -104,11 +97,21 @@
/**
* Creates a new sql builder.
*
- * @param info The plaftform information
+ * @param platform The plaftform this builder belongs to
+ */
+ public SqlBuilder(Platform platform)
+ {
+ _platform = platform;
+ }
+
+ /**
+ * Returns the platform object.
+ *
+ * @return The platform
*/
- public SqlBuilder(PlatformInfo info)
+ public Platform getPlatform()
{
- _info = info;
+ return _platform;
}
/**
@@ -118,7 +121,7 @@
*/
public PlatformInfo getPlatformInfo()
{
- return _info;
+ return _platform.getPlatformInfo();
}
/**
@@ -458,7 +461,8 @@
for (int indexIdx = 0; indexIdx < currentTable.getIndexCount(); indexIdx++)
{
Index currentIndex = currentTable.getIndex(indexIdx);
- Index desiredIndex = desiredTable.findIndex(currentIndex.getName(), getPlatformInfo().isUseDelimitedIdentifiers());
+ Index desiredIndex = desiredTable.findIndex(currentIndex.getName(),
+ getPlatform().isDelimitedIdentifierModeOn());
if (desiredIndex == null)
{
@@ -494,7 +498,8 @@
for (int columnIdx = 0; columnIdx < desiredTable.getColumnCount(); columnIdx++)
{
Column desiredColumn = desiredTable.getColumn(columnIdx);
- Column currentColumn = currentTable.findColumn(desiredColumn.getName(), getPlatformInfo().isUseDelimitedIdentifiers());
+ Column currentColumn = currentTable.findColumn(desiredColumn.getName(),
+ getPlatform().isDelimitedIdentifierModeOn());
if (null == currentColumn)
{
@@ -533,7 +538,8 @@
for (int columnIdx = 0; columnIdx < currentTable.getColumnCount(); columnIdx++)
{
Column currentColumn = currentTable.getColumn(columnIdx);
- Column desiredColumn = desiredTable.findColumn(currentColumn.getName(), getPlatformInfo().isUseDelimitedIdentifiers());
+ Column desiredColumn = desiredTable.findColumn(currentColumn.getName(),
+ getPlatform().isDelimitedIdentifierModeOn());
if (desiredColumn == null)
{
@@ -579,7 +585,8 @@
for (int indexIdx = 0; indexIdx < desiredTable.getIndexCount(); indexIdx++)
{
Index desiredIndex = desiredTable.getIndex(indexIdx);
- Index currentIndex = currentTable.findIndex(desiredIndex.getName(), getPlatformInfo().isUseDelimitedIdentifiers());
+ Index currentIndex = currentTable.findIndex(desiredIndex.getName(),
+ getPlatform().isDelimitedIdentifierModeOn());
if (currentIndex == null)
{
@@ -605,7 +612,7 @@
*/
protected ForeignKey findCorrespondingForeignKey(Table table, ForeignKey fk)
{
- boolean caseMatters = getPlatformInfo().isUseDelimitedIdentifiers();
+ boolean caseMatters = getPlatform().isDelimitedIdentifierModeOn();
boolean checkFkName = (fk.getName() != null) && (fk.getName().length() > 0);
Reference[] refs = fk.getReferences();
ArrayList curRefs = new ArrayList();
@@ -1216,9 +1223,9 @@
print(getSqlType(column));
if ((column.getDefaultValue() != null) ||
- (getPlatformInfo().isIdentitySpecUsesDefaultValue() && column.isAutoIncrement()))
+ (getPlatformInfo().isDefaultValueUsedForIdentitySpec() && column.isAutoIncrement()))
{
- if (!getPlatformInfo().isSupportingDefaultValuesForLongTypes() &&
+ if (!getPlatformInfo().isDefaultValuesForLongTypesSupported() &&
((column.getTypeCode() == Types.LONGVARBINARY) || (column.getTypeCode() == Types.LONGVARCHAR)))
{
throw new DynaSqlException("The platform does not support default values for LONGVARCHAR or LONGVARBINARY columns");
@@ -1231,15 +1238,15 @@
print(" ");
writeColumnNotNullableStmt();
}
- else if (getPlatformInfo().isRequiringNullAsDefaultValue() &&
+ else if (getPlatformInfo().isNullAsDefaultValueRequired() &&
getPlatformInfo().hasNullDefault(column.getTypeCode()))
{
print(" ");
writeColumnNullableStmt();
}
- if (column.isAutoIncrement() && !getPlatformInfo().isIdentitySpecUsesDefaultValue())
+ if (column.isAutoIncrement() && !getPlatformInfo().isDefaultValueUsedForIdentitySpec())
{
- if (!getPlatformInfo().isSupportingNonPKIdentityColumns() && !column.isPrimaryKey())
+ if (!getPlatformInfo().isNonPKIdentityColumnsSupported() && !column.isPrimaryKey())
{
throw new DynaSqlException("Column "+column.getName()+" in table "+table.getName()+" is auto-incrementing but not a primary key column, which is not supported by the platform");
}
@@ -1623,7 +1630,7 @@
{
Index index = table.getIndex(idx);
- if (!index.isUnique() && !getPlatformInfo().isSupportingNonUniqueIndices())
+ if (!index.isUnique() && !getPlatformInfo().isNonUniqueIndicesSupported())
{
throw new DynaSqlException("Platform does not support non-unique indices");
}
@@ -1642,7 +1649,7 @@
{
Index index = table.getIndex(idx);
- if (!index.isUnique() && !getPlatformInfo().isSupportingNonUniqueIndices())
+ if (!index.isUnique() && !getPlatformInfo().isNonUniqueIndicesSupported())
{
throw new DynaSqlException("Platform does not support non-unique indices");
}
@@ -1749,13 +1756,13 @@
*/
public void writeExternalIndexDropStmt(Table table, Index index) throws IOException
{
- if (getPlatformInfo().isUseAlterTableForDrop())
+ if (getPlatformInfo().isAlterTableForDropUsed())
{
writeTableAlterStmt(table);
}
print("DROP INDEX ");
printIdentifier(getIndexName(index));
- if (!getPlatformInfo().isUseAlterTableForDrop())
+ if (!getPlatformInfo().isAlterTableForDropUsed())
{
print(" ON ");
print(getTableName(table));
@@ -1948,7 +1955,7 @@
*/
protected String getDelimitedIdentifier(String identifier)
{
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
return getPlatformInfo().getDelimiterToken() + identifier + getPlatformInfo().getDelimiterToken();
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionBuilder.java Sat Mar 4 07:08:59 2006
@@ -18,7 +18,7 @@
import java.io.IOException;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.SqlBuilder;
@@ -34,11 +34,11 @@
/**
* Creates a new axion sql builder.
*
- * @param info The plaftform information
+ * @param platform The plaftform this builder belongs to
*/
- public AxionBuilder(PlatformInfo info)
+ public AxionBuilder(Platform platform)
{
- super(info);
+ super(platform);
addEscapedCharSequence("'", "''");
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionPlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/axion/AxionPlatform.java Sat Mar 4 07:08:59 2006
@@ -41,12 +41,11 @@
*/
public AxionPlatform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
- info.setSupportingDelimitedIdentifiers(false);
- info.setUseDelimitedIdentifiers(false);
+ info.setDelimitedIdentifiersSupported(false);
info.setCommentsSupported(false);
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
info.setIndicesEmbedded(false);
@@ -69,7 +68,7 @@
info.addNativeTypeMapping(Types.TINYINT, "SHORT");
info.addNativeTypeMapping("DATALINK", "VARBINARY");
- setSqlBuilder(new AxionBuilder(info));
+ setSqlBuilder(new AxionBuilder(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java Sat Mar 4 07:08:59 2006
@@ -18,7 +18,7 @@
import java.io.IOException;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.SqlBuilder;
@@ -34,11 +34,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public CloudscapeBuilder(PlatformInfo info)
+ public CloudscapeBuilder(Platform platform)
{
- super(info);
+ super(platform);
addEscapedCharSequence("'", "''");
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java Sat Mar 4 07:08:59 2006
@@ -41,9 +41,9 @@
*/
public CloudscapePlatform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
info.setIndicesEmbedded(false);
@@ -67,11 +67,12 @@
info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
info.addNativeTypeMapping("DATALINK", "LONG VARCHAR FOR BIT DATA", "LONGVARBINARY");
- info.addDefaultSize(Types.BINARY, 254);
- info.addDefaultSize(Types.CHAR, 254);
- info.addDefaultSize(Types.VARBINARY, 254);
- info.addDefaultSize(Types.VARCHAR, 254);
- setSqlBuilder(new CloudscapeBuilder(info));
+ info.setDefaultSize(Types.BINARY, 254);
+ info.setDefaultSize(Types.CHAR, 254);
+ info.setDefaultSize(Types.VARBINARY, 254);
+ info.setDefaultSize(Types.VARCHAR, 254);
+
+ setSqlBuilder(new CloudscapeBuilder(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Builder.java Sat Mar 4 07:08:59 2006
@@ -19,7 +19,7 @@
import java.io.IOException;
import java.sql.Types;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.SqlBuilder;
@@ -37,11 +37,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public Db2Builder(PlatformInfo info)
+ public Db2Builder(Platform platform)
{
- super(info);
+ super(platform);
addEscapedCharSequence("'", "''");
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2ModelReader.java Sat Mar 4 07:08:59 2006
@@ -21,7 +21,7 @@
import java.util.Map;
import org.apache.ddlutils.DdlUtilsException;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Index;
import org.apache.ddlutils.model.Table;
@@ -52,11 +52,11 @@
/**
* Creates a new model reader for Db2 databases.
*
- * @param platformInfo The platform specific settings
+ * @param platform The platform that this model reader belongs to
*/
- public Db2ModelReader(PlatformInfo platformInfo)
+ public Db2ModelReader(Platform platform)
{
- super(platformInfo);
+ super(platform);
setDefaultCatalogPattern(null);
setDefaultSchemaPattern(null);
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Platform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Platform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/db2/Db2Platform.java Sat Mar 4 07:08:59 2006
@@ -49,10 +49,10 @@
*/
public Db2Platform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
info.setMaxIdentifierLength(18);
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
info.setIndicesEmbedded(false);
@@ -72,13 +72,13 @@
info.addNativeTypeMapping(Types.VARBINARY, "VARCHAR {0} FOR BIT DATA");
info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
- info.addDefaultSize(Types.CHAR, 254);
- info.addDefaultSize(Types.VARCHAR, 254);
- info.addDefaultSize(Types.BINARY, 254);
- info.addDefaultSize(Types.VARBINARY, 254);
+ info.setDefaultSize(Types.CHAR, 254);
+ info.setDefaultSize(Types.VARCHAR, 254);
+ info.setDefaultSize(Types.BINARY, 254);
+ info.setDefaultSize(Types.VARBINARY, 254);
- setSqlBuilder(new Db2Builder(info));
- setModelReader(new Db2ModelReader(info));
+ setSqlBuilder(new Db2Builder(this));
+ setModelReader(new Db2ModelReader(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyBuilder.java Sat Mar 4 07:08:59 2006
@@ -19,7 +19,7 @@
import java.io.IOException;
import java.sql.Types;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.cloudscape.CloudscapeBuilder;
@@ -36,11 +36,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public DerbyBuilder(PlatformInfo info)
+ public DerbyBuilder(Platform platform)
{
- super(info);
+ super(platform);
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyModelReader.java Sat Mar 4 07:08:59 2006
@@ -19,7 +19,7 @@
import java.sql.SQLException;
import java.util.Map;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.ForeignKey;
import org.apache.ddlutils.model.Index;
@@ -38,11 +38,11 @@
/**
* Creates a new model reader for Derby databases.
*
- * @param platformInfo The platform specific settings
+ * @param platform The platform that this model reader belongs to
*/
- public DerbyModelReader(PlatformInfo platformInfo)
+ public DerbyModelReader(Platform platform)
{
- super(platformInfo);
+ super(platform);
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyPlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/derby/DerbyPlatform.java Sat Mar 4 07:08:59 2006
@@ -48,8 +48,8 @@
public DerbyPlatform()
{
super();
- setSqlBuilder(new DerbyBuilder(getSqlBuilder().getPlatformInfo()));
- setModelReader(new DerbyModelReader(getSqlBuilder().getPlatformInfo()));
+ setSqlBuilder(new DerbyBuilder(this));
+ setModelReader(new DerbyModelReader(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java Sat Mar 4 07:08:59 2006
@@ -20,7 +20,7 @@
import java.sql.Types;
import java.util.Map;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.model.Table;
@@ -42,11 +42,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public FirebirdBuilder(PlatformInfo info)
+ public FirebirdBuilder(Platform platform)
{
- super(info);
+ super(platform);
addEscapedCharSequence("'", "''");
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java Sat Mar 4 07:08:59 2006
@@ -28,7 +28,7 @@
import java.util.Map;
import org.apache.commons.collections.map.ListOrderedMap;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.ForeignKey;
import org.apache.ddlutils.model.Index;
@@ -48,11 +48,11 @@
/**
* Creates a new model reader for Firebird databases.
*
- * @param platformInfo The platform specific settings
+ * @param platform The platform that this model reader belongs to
*/
- public FirebirdModelReader(PlatformInfo platformInfo)
+ public FirebirdModelReader(Platform platform)
{
- super(platformInfo);
+ super(platform);
setDefaultCatalogPattern(null);
setDefaultSchemaPattern(null);
setDefaultTablePattern("%");
@@ -84,7 +84,7 @@
{
List columns = new ArrayList();
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
// Jaybird has a problem when delimited identifiers are used as
// it is not able to find the columns for the table
@@ -147,7 +147,7 @@
{
// Since for long table and column names, the generator name will be shortened
// we have to determine for each column whether there is a generator for it
- FirebirdBuilder builder = new FirebirdBuilder(getPlatformInfo());
+ FirebirdBuilder builder = (FirebirdBuilder)getPlatform().getSqlBuilder();
Column[] columns = table.getColumns();
HashMap names = new HashMap();
String name;
@@ -155,7 +155,7 @@
for (int idx = 0; idx < columns.length; idx++)
{
name = builder.getGeneratorName(table, columns[idx]);
- if (!getPlatformInfo().isUseDelimitedIdentifiers())
+ if (!getPlatform().isDelimitedIdentifierModeOn())
{
name = name.toUpperCase();
}
@@ -195,7 +195,7 @@
try
{
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
// Jaybird has a problem when delimited identifiers are used as
// it is not able to find the primary key info for the table
@@ -242,7 +242,7 @@
try
{
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
// Jaybird has a problem when delimited identifiers are used as
// it is not able to find the foreign key info for the table
@@ -296,7 +296,7 @@
PreparedStatement stmt = getConnection().prepareStatement(query.toString());
ResultSet indexData = null;
- stmt.setString(1, getPlatformInfo().isUseDelimitedIdentifiers() ? tableName : tableName.toUpperCase());
+ stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName.toUpperCase());
try
{
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java Sat Mar 4 07:08:59 2006
@@ -53,10 +53,10 @@
*/
public FirebirdPlatform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
info.setMaxIdentifierLength(31);
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
info.setIndicesEmbedded(false);
@@ -87,11 +87,11 @@
info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
info.addNativeTypeMapping("DATALINK", "BLOB", "LONGVARBINARY");
- info.addDefaultSize(Types.VARCHAR, 254);
- info.addDefaultSize(Types.CHAR, 254);
+ info.setDefaultSize(Types.VARCHAR, 254);
+ info.setDefaultSize(Types.CHAR, 254);
- setSqlBuilder(new FirebirdBuilder(info));
- setModelReader(new FirebirdModelReader(info));
+ setSqlBuilder(new FirebirdBuilder(this));
+ setModelReader(new FirebirdModelReader(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java Sat Mar 4 07:08:59 2006
@@ -18,7 +18,7 @@
import java.io.IOException;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.SqlBuilder;
@@ -34,11 +34,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public HsqlDbBuilder(PlatformInfo info)
+ public HsqlDbBuilder(Platform platform)
{
- super(info);
+ super(platform);
addEscapedCharSequence("'", "''");
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java Sat Mar 4 07:08:59 2006
@@ -19,7 +19,7 @@
import java.sql.SQLException;
import java.util.Map;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.ForeignKey;
import org.apache.ddlutils.model.Index;
import org.apache.ddlutils.model.Table;
@@ -37,11 +37,11 @@
/**
* Creates a new model reader for HsqlDb databases.
*
- * @param platformInfo The platform specific settings
+ * @param platform The platform that this model reader belongs to
*/
- public HsqlDbModelReader(PlatformInfo platformInfo)
+ public HsqlDbModelReader(Platform platform)
{
- super(platformInfo);
+ super(platform);
setDefaultCatalogPattern(null);
setDefaultSchemaPattern(null);
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java Sat Mar 4 07:08:59 2006
@@ -43,13 +43,13 @@
*/
public HsqlDbPlatform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
info.setIndicesEmbedded(false);
- info.setSupportingNonPKIdentityColumns(false);
+ info.setNonPKIdentityColumnsSupported(false);
info.addNativeTypeMapping(Types.BIT, "BOOLEAN");
info.addNativeTypeMapping(Types.ARRAY, "LONGVARBINARY", Types.LONGVARBINARY);
@@ -69,13 +69,13 @@
info.addNativeTypeMapping("BIT", "BOOLEAN", "BOOLEAN");
info.addNativeTypeMapping("DATALINK", "LONGVARBINARY", "LONGVARBINARY");
- info.addDefaultSize(Types.CHAR, Integer.MAX_VALUE);
- info.addDefaultSize(Types.VARCHAR, Integer.MAX_VALUE);
- info.addDefaultSize(Types.BINARY, Integer.MAX_VALUE);
- info.addDefaultSize(Types.VARBINARY, Integer.MAX_VALUE);
+ info.setDefaultSize(Types.CHAR, Integer.MAX_VALUE);
+ info.setDefaultSize(Types.VARCHAR, Integer.MAX_VALUE);
+ info.setDefaultSize(Types.BINARY, Integer.MAX_VALUE);
+ info.setDefaultSize(Types.VARBINARY, Integer.MAX_VALUE);
- setSqlBuilder(new HsqlDbBuilder(info));
- setModelReader(new HsqlDbModelReader(info));
+ setSqlBuilder(new HsqlDbBuilder(this));
+ setModelReader(new HsqlDbModelReader(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java Sat Mar 4 07:08:59 2006
@@ -20,7 +20,7 @@
import java.sql.Types;
import java.util.Map;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Database;
import org.apache.ddlutils.model.ForeignKey;
@@ -39,11 +39,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public InterbaseBuilder(PlatformInfo info)
+ public InterbaseBuilder(Platform platform)
{
- super(info);
+ super(platform);
addEscapedCharSequence("'", "''");
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java Sat Mar 4 07:08:59 2006
@@ -24,7 +24,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Index;
import org.apache.ddlutils.model.Table;
@@ -42,11 +42,11 @@
/**
* Creates a new model reader for Interbase databases.
*
- * @param platformInfo The platform specific settings
+ * @param platform The platform that this model reader belongs to
*/
- public InterbaseModelReader(PlatformInfo platformInfo)
+ public InterbaseModelReader(Platform platform)
{
- super(platformInfo);
+ super(platform);
setDefaultCatalogPattern(null);
setDefaultSchemaPattern(null);
setDefaultTablePattern("%");
@@ -64,7 +64,7 @@
{
List columns = new ArrayList();
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
// Jaybird has a problem when delimited identifiers are used as
// it is not able to find the columns for the table
@@ -128,7 +128,7 @@
try
{
- if (getPlatformInfo().isUseDelimitedIdentifiers())
+ if (getPlatform().isDelimitedIdentifierModeOn())
{
// Jaybird has a problem when delimited identifiers are used as
// it is not able to find the primary key info for the table
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbasePlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbasePlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbasePlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/interbase/InterbasePlatform.java Sat Mar 4 07:08:59 2006
@@ -41,10 +41,10 @@
*/
public InterbasePlatform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
info.setMaxIdentifierLength(31);
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
info.setIndicesEmbedded(false);
@@ -73,8 +73,8 @@
info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
info.addNativeTypeMapping("DATALINK", "BLOB");
- setSqlBuilder(new InterbaseBuilder(info));
- setModelReader(new InterbaseModelReader(info));
+ setSqlBuilder(new InterbaseBuilder(this));
+ setModelReader(new InterbaseModelReader(this));
}
/**
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java Sat Mar 4 07:08:59 2006
@@ -18,7 +18,7 @@
import java.io.IOException;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.SqlBuilder;
@@ -35,11 +35,11 @@
/**
* Creates a new builder instance.
*
- * @param info The platform info
+ * @param platform The plaftform this builder belongs to
*/
- public MckoiBuilder(PlatformInfo info)
+ public MckoiBuilder(Platform platform)
{
- super(info);
+ super(platform);
// we need to handle the backslash first otherwise the other
// already escaped sequence would be affected
addEscapedCharSequence("\\", "\\\\");
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java Sat Mar 4 07:08:59 2006
@@ -17,13 +17,13 @@
*/
import java.sql.ResultSet;
-import java.sql.Statement;
import java.sql.SQLException;
+import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.collections.map.ListOrderedMap;
-import org.apache.ddlutils.PlatformInfo;
+import org.apache.ddlutils.Platform;
import org.apache.ddlutils.model.Column;
import org.apache.ddlutils.model.Table;
import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
@@ -40,11 +40,11 @@
/**
* Creates a new model reader for Mckoi databases.
*
- * @param platformInfo The platform specific settings
+ * @param platform The platform that this model reader belongs to
*/
- public MckoiModelReader(PlatformInfo platformInfo)
+ public MckoiModelReader(Platform platform)
{
- super(platformInfo);
+ super(platform);
setDefaultCatalogPattern(null);
setDefaultSchemaPattern(null);
}
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java?rev=383130&r1=383129&r2=383130&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java Sat Mar 4 07:08:59 2006
@@ -47,14 +47,14 @@
*/
public MckoiPlatform()
{
- PlatformInfo info = new PlatformInfo();
+ PlatformInfo info = getPlatformInfo();
- info.setRequiringNullAsDefaultValue(false);
+ info.setNullAsDefaultValueRequired(false);
info.setPrimaryKeyEmbedded(true);
info.setForeignKeysEmbedded(false);
- info.setSupportingNonUniqueIndices(false);
+ info.setNonUniqueIndicesSupported(false);
info.setIndicesEmbedded(true);
- info.setIdentitySpecUsesDefaultValue(true);
+ info.setDefaultValueUsedForIdentitySpec(true);
info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB);
info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.BLOB);
@@ -66,13 +66,13 @@
info.addNativeTypeMapping("BIT", "BOOLEAN", "BOOLEAN");
info.addNativeTypeMapping("DATALINK", "BLOB", "BLOB");
- info.addDefaultSize(Types.CHAR, 1024);
- info.addDefaultSize(Types.VARCHAR, 1024);
- info.addDefaultSize(Types.BINARY, 1024);
- info.addDefaultSize(Types.VARBINARY, 1024);
+ info.setDefaultSize(Types.CHAR, 1024);
+ info.setDefaultSize(Types.VARCHAR, 1024);
+ info.setDefaultSize(Types.BINARY, 1024);
+ info.setDefaultSize(Types.VARBINARY, 1024);
- setSqlBuilder(new MckoiBuilder(info));
- setModelReader(new MckoiModelReader(info));
+ setSqlBuilder(new MckoiBuilder(this));
+ setModelReader(new MckoiModelReader(this));
}
/**