From cd7f760f9952a4197cd6c449c6634ff07992a573 Mon Sep 17 00:00:00 2001 From: chenson42 Date: Sat, 2 Jun 2012 18:22:23 +0000 Subject: [PATCH] Added a property that indicates whether blob columns work in where clauses --- .../jumpmind/db/platform/DatabaseInfo.java | 469 ++++++++++-------- .../db/platform/db2/Db2DdlBuilder.java | 2 +- .../db/platform/derby/DerbyDdlBuilder.java | 2 +- .../db/platform/mssql/MsSqlDdlBuilder.java | 2 +- .../db/platform/oracle/OracleDdlBuilder.java | 1 + 5 files changed, 269 insertions(+), 207 deletions(-) diff --git a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/DatabaseInfo.java b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/DatabaseInfo.java index 5b7aadd7a5..697c849d7a 100644 --- a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/DatabaseInfo.java +++ b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/DatabaseInfo.java @@ -1,6 +1,6 @@ package org.jumpmind.db.platform; -/* +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -29,21 +29,28 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/* - * Contains information about the database platform such as supported features and native type mappings. +/** + * Contains information about the database platform such as supported features + * and native type mappings. */ public class DatabaseInfo { - - /* The Log to which logging calls will be made. */ + + /** The Log to which logging calls will be made. */ private final Logger log = LoggerFactory.getLogger(DatabaseInfo.class); - /* + /** + * Indicate whether a blob column will match when used in a SQL where + * clause. + */ + private boolean blobsWorkInWhereClause = true; + + /** * Whether the database requires the explicit stating of NULL as the default * value. */ private boolean nullAsDefaultValueRequired = false; - /* + /** * Whether default values can be defined for LONGVARCHAR/LONGVARBINARY * columns. */ @@ -51,33 +58,33 @@ public class DatabaseInfo { // 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. */ + /** Whether embedded foreign key constraints are explicitly named. */ private boolean embeddedForeignKeysNamed = false; - /* Whether non-unique indices are supported. */ + /** Whether non-unique indices are supported. */ private boolean indicesSupported = true; - /* Whether indices are embedded inside the create table statement. */ + /** Whether indices are embedded inside the create table statement. */ private boolean indicesEmbedded = false; private boolean triggersSupported = true; - /* Whether identity specification is supported for non-primary key columns. */ + /** Whether identity specification is supported for non-primary key columns. */ private boolean nonPKIdentityColumnsSupported = true; - /* + /** * Whether the auto-increment definition is done via the DEFAULT part of the * column definition. */ @@ -85,26 +92,26 @@ public class DatabaseInfo { // 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; - /* + /** * Whether system indices for foreign keys are always non-unique or can be * unique (i.e. if a primary key column is used to establish the foreign * key). */ private boolean systemForeignKeyIndicesAlwaysNonUnique = false; - /* + /** * 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. */ @@ -112,135 +119,135 @@ public class DatabaseInfo { // other DDL/DML properties - /* Whether comments are supported. */ + /** Whether comments are supported. */ private boolean sqlCommentsSupported = true; - /* Whether delimited identifiers are supported or not. */ + /** Whether delimited identifiers are supported or not. */ private boolean delimitedIdentifiersSupported = true; - /* Whether an ALTER TABLE is needed to drop indexes. */ + /** Whether an ALTER TABLE is needed to drop indexes. */ private boolean alterTableForDropUsed = false; - /* + /** * Whether the platform allows for the explicit specification of values for * identity columns in INSERT and UPDATE statements. */ private boolean identityOverrideAllowed = true; - /* + /** * Whether the values of identity columns can be read back from the database * after insertion. */ private boolean lastIdentityValueReadable = true; - /* + /** * Whether auto-commit mode for the reading of the values of identity * columns after insertion shall be used. */ private boolean autoCommitModeForLastIdentityValueReading = true; - /* + /** * Specifies the maximum length that a table name can have for this database * (-1 if there is no limit). */ private int maxTableNameLength = -1; - /* + /** * Specifies the maximum length that a column name can have for this * database (-1 if there is no limit). */ private int maxColumnNameLength = -1; - /* + /** * Specifies the maximum length that a constraint name can have for this * database (-1 if there is no limit). */ private int maxConstraintNameLength = -1; - /* + /** * Specifies the maximum length that a foreign key name can have for this * database (-1 if there is no limit). */ private int maxForeignKeyNameLength = -1; - /* + /** * The string used for delimiting SQL identifiers, eg. table names, column * names etc. */ private String delimiterToken = "\""; - /* + /** * The string used for escaping values when generating textual SQL * statements. */ private String valueQuoteToken = "'"; - /* The string that starts a comment. */ + /** The string that starts a comment. */ private String commentPrefix = "--"; - /* The string that ends a comment. */ + /** The string that ends a comment. */ private String commentSuffix = ""; - /* The text separating individual sql commands. */ + /** The text separating individual sql commands. */ private String sqlCommandDelimiter = ";"; private boolean dateOverridesToTimestamp; private boolean emptyStringNulled = false; - + private boolean autoIncrementUpdateAllowed = true; - /* + /** * True if blank characters are padded out */ private boolean blankCharColumnSpacePadded; - /* + /** * True if non-blank characters are padded out */ private boolean nonBlankCharColumnSpacePadded; private boolean charColumnSpaceTrimmed; - - /** + + /*** * Indicates whether each ddl statement needs to be committed. */ private boolean requiresAutoCommitForDdl = false; - /* Contains non-default mappings from jdbc to native types. */ + /** Contains non-default mappings from jdbc to native types. */ private Map nativeTypes = new HashMap(); - /* + /** * Contains the jdbc types corresponding to the native types for non-default * mappings. */ private Map targetJdbcTypes = new HashMap(); - /* + /** * Contains those JDBC types whose corresponding native types have a null * value as the default value. */ private Set typesWithNullDefault = new HashSet(); - /* + /** * Contains those JDBC types whose corresponding native types are types that * have a size on this platform. */ private Set typesWithSize = new HashSet(); - /* + /** * Contains the default sizes for those JDBC types whose corresponding * native types require a size. */ private Map typesDefaultSizes = new HashMap(); - /* + /** * Contains those JDBC types whose corresponding native types are types that * have precision and scale on this platform. */ private HashSet typesWithPrecisionAndScale = new HashSet(); - /* + /** * Creates a new platform info object. */ public DatabaseInfo() { @@ -264,29 +271,29 @@ public DatabaseInfo() { // 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 true if NULL must be written for empty default - * values + * values */ public boolean isNullAsDefaultValueRequired() { return nullAsDefaultValueRequired; } - /* + /** * Specifies whether a NULL needs to be explicitly stated when the column * has no specified default value. Default is false. * - * @param requiresNullAsDefaultValue Whether NULL must be written for empty - * default values + * @param requiresNullAsDefaultValue + * Whether NULL must be written for empty default values */ public void setNullAsDefaultValueRequired(boolean requiresNullAsDefaultValue) { this.nullAsDefaultValueRequired = requiresNullAsDefaultValue; } - /* + /** * Determines whether default values can be specified for * LONGVARCHAR/LONGVARBINARY columns. * @@ -296,11 +303,12 @@ public boolean isDefaultValuesForLongTypesSupported() { return defaultValuesForLongTypesSupported; } - /* + /** * Specifies whether default values can be specified for * LONGVARCHAR/LONGVARBINARY columns. * - * @param isSupported true if default values are supported + * @param isSupported + * true if default values are supported */ public void setDefaultValuesForLongTypesSupported(boolean isSupported) { this.defaultValuesForLongTypesSupported = isSupported; @@ -308,7 +316,7 @@ public void setDefaultValuesForLongTypesSupported(boolean 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 * embedded pks. @@ -319,17 +327,18 @@ public boolean isPrimaryKeyEmbedded() { return primaryKeyEmbedded; } - /* + /** * Specifies whether the primary key constraints are embedded in the create * table clause or as seperate alter table statements. * - * @param primaryKeyEmbedded Whether pk constraints are embedded + * @param primaryKeyEmbedded + * Whether pk constraints are embedded */ public void setPrimaryKeyEmbedded(boolean primaryKeyEmbedded) { this.primaryKeyEmbedded = primaryKeyEmbedded; } - /* + /** * Determines whether foreign key constraints are embedded in the create * table clause or as seperate alter table statements. Per default, foreign * keys are external. @@ -340,17 +349,18 @@ public boolean isForeignKeysEmbedded() { return foreignKeysEmbedded; } - /* + /** * Specifies whether foreign key constraints are embedded in the create * table clause or as seperate alter table statements. * - * @param foreignKeysEmbedded Whether fk constraints are embedded + * @param foreignKeysEmbedded + * Whether fk constraints are embedded */ public void setForeignKeysEmbedded(boolean foreignKeysEmbedded) { this.foreignKeysEmbedded = foreignKeysEmbedded; } - /* + /** * Returns whether embedded foreign key constraints should have a name. * * @return true if embedded fks have name @@ -359,16 +369,17 @@ public boolean isEmbeddedForeignKeysNamed() { return embeddedForeignKeysNamed; } - /* + /** * Specifies whether embedded foreign key constraints should be named. * - * @param embeddedForeignKeysNamed Whether embedded fks shall have a name + * @param embeddedForeignKeysNamed + * Whether embedded fks shall have a name */ public void setEmbeddedForeignKeysNamed(boolean embeddedForeignKeysNamed) { this.embeddedForeignKeysNamed = embeddedForeignKeysNamed; } - /* + /** * Determines whether indices are supported. * * @return true if indices are supported @@ -377,16 +388,17 @@ public boolean isIndicesSupported() { return indicesSupported; } - /* + /** * Specifies whether indices are supported. * - * @param supportingIndices true if indices are supported + * @param supportingIndices + * true if indices are supported */ public void setIndicesSupported(boolean supportingIndices) { this.indicesSupported = supportingIndices; } - /* + /** * Determines whether the indices are embedded in the create table clause or * as seperate statements. Per default, indices are external. * @@ -396,55 +408,58 @@ public boolean isIndicesEmbedded() { return indicesEmbedded; } - /* + /** * Specifies whether indices are embedded in the create table clause or as * seperate alter table statements. * - * @param indicesEmbedded Whether indices are embedded + * @param indicesEmbedded + * Whether indices are embedded */ public void setIndicesEmbedded(boolean indicesEmbedded) { this.indicesEmbedded = indicesEmbedded; } - /* + /** * Determines whether non-primary key columns can be auto-incrementing * (IDENTITY columns). * * @return true if normal non-PK columns can be - * auto-incrementing + * auto-incrementing */ public boolean isNonPKIdentityColumnsSupported() { return nonPKIdentityColumnsSupported; } - /* + /** * Specifies whether non-primary key columns can be auto-incrementing * (IDENTITY columns). * - * @param supportingNonPKIdentityColumns true if normal non-PK - * columns can be auto-incrementing + * @param supportingNonPKIdentityColumns + * true if normal non-PK columns can be + * auto-incrementing */ public void setNonPKIdentityColumnsSupported(boolean supportingNonPKIdentityColumns) { this.nonPKIdentityColumnsSupported = supportingNonPKIdentityColumns; } - /* + /** * Determines whether the auto-increment specification uses the DEFAULT * value of the column definition. * * @return true if the auto-increment spec is done via the - * DEFAULT value + * DEFAULT value */ public boolean isDefaultValueUsedForIdentitySpec() { return defaultValueUsedForIdentitySpec; } - /* + /** * Specifies whether the auto-increment specification uses the DEFAULT value * of the column definition. * - * @param identitySpecUsesDefaultValue true if the - * auto-increment spec is done via the DEFAULT value + * @param identitySpecUsesDefaultValue + * true if the auto-increment spec is done via the + * DEFAULT value */ public void setDefaultValueUsedForIdentitySpec(boolean identitySpecUsesDefaultValue) { this.defaultValueUsedForIdentitySpec = identitySpecUsesDefaultValue; @@ -452,7 +467,7 @@ public void setDefaultValueUsedForIdentitySpec(boolean identitySpecUsesDefaultVa // properties influencing the reading of models from live databases - /* + /** * Determines whether database-generated indices for primary and foreign * keys are returned when reading a model from a database. * @@ -462,82 +477,86 @@ public boolean isSystemIndicesReturned() { return systemIndicesReturned; } - /* + /** * Specifies whether database-generated indices for primary and foreign keys * are returned when reading a model from a database. * - * @param returningSystemIndices true if system indices are - * read from a live database + * @param returningSystemIndices + * true if system indices are read from a live + * database */ public void setSystemIndicesReturned(boolean returningSystemIndices) { this.systemIndicesReturned = returningSystemIndices; } - /* + /** * Determines whether system indices for foreign keys are always non-unique * or can be unique (i.e. if a primary key column is used to establish the * foreign key). * * @return true if system foreign key indices are always - * non-unique; default is false + * non-unique; default is false */ public boolean isSystemForeignKeyIndicesAlwaysNonUnique() { return systemForeignKeyIndicesAlwaysNonUnique; } - /* + /** * Specifies whether system indices for foreign keys are always non-unique * or can be unique (i.e. if a primary key column is used to establish the * foreign key). * - * @param alwaysNonUnique true if system foreign key indices - * are always non-unique + * @param alwaysNonUnique + * true if system foreign key indices are always + * non-unique */ public void setSystemForeignKeyIndicesAlwaysNonUnique(boolean alwaysNonUnique) { this.systemForeignKeyIndicesAlwaysNonUnique = alwaysNonUnique; } - /* + /** * 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 true if synthetic default values are returned for - * non-identity required columns + * 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 true if synthetic default - * values are returned for non-identity required columns + * @param returningDefaultValue + * true if synthetic default values are returned for + * non-identity required columns */ public void setSyntheticDefaultValueForRequiredReturned(boolean returningDefaultValue) { this.syntheticDefaultValueForRequiredReturned = returningDefaultValue; } - /* + /** * Determines whether the platform is able to read the auto-increment status * for columns from an existing database. * * @return true if the auto-increment status can be determined - * from an existing database + * from an existing database */ public boolean getIdentityStatusReadingSupported() { return identityStatusReadingSupported; } - /* + /** * Specifies whether the platform is able to read the auto-increment status * for columns from an existing database. * - * @param canReadAutoIncrementStatus true if the auto-increment - * status can be determined from an existing database + * @param canReadAutoIncrementStatus + * true if the auto-increment status can be + * determined from an existing database */ public void setIdentityStatusReadingSupported(boolean canReadAutoIncrementStatus) { this.identityStatusReadingSupported = canReadAutoIncrementStatus; @@ -545,7 +564,7 @@ public void setIdentityStatusReadingSupported(boolean canReadAutoIncrementStatus // other ddl properties - /* + /** * Determines whether the database supports SQL comments. * * @return true if comments are supported @@ -554,16 +573,17 @@ public boolean isSqlCommentsSupported() { return sqlCommentsSupported; } - /* + /** * Specifies whether SQL comments are supported by the database. * - * @param commentsSupported true if comments are supported + * @param commentsSupported + * true if comments are supported */ public void setSqlCommentsSupported(boolean commentsSupported) { this.sqlCommentsSupported = commentsSupported; } - /* + /** * Determines whether delimited identifiers are supported. * * @return true if delimited identifiers are supported @@ -572,17 +592,17 @@ public boolean isDelimitedIdentifiersSupported() { return delimitedIdentifiersSupported; } - /* + /** * Specifies whether delimited identifiers are supported. * - * @param areSupported true if delimited identifiers are - * supported + * @param areSupported + * true if delimited identifiers are supported */ public void setDelimitedIdentifiersSupported(boolean areSupported) { this.delimitedIdentifiersSupported = areSupported; } - /* + /** * Determines whether an ALTER TABLE statement shall be used for dropping * indices or constraints. The default is false. * @@ -592,17 +612,18 @@ public boolean isAlterTableForDropUsed() { return alterTableForDropUsed; } - /* + /** * Specifies whether an ALTER TABLE statement shall be used for dropping * indices or constraints. * - * @param useAlterTableForDrop Whether ALTER TABLE will be used + * @param useAlterTableForDrop + * Whether ALTER TABLE will be used */ public void setAlterTableForDropUsed(boolean useAlterTableForDrop) { this.alterTableForDropUsed = useAlterTableForDrop; } - /* + /** * Determines whether the platform is allows the explicit specification of * values for identity columns in INSERT/UPDATE statements. * @@ -612,18 +633,19 @@ public boolean isIdentityOverrideAllowed() { return identityOverrideAllowed; } - /* + /** * Specifies whether the platform is allows the explicit specification of * values for identity columns in INSERT/UPDATE statements. * - * @param identityOverrideAllowed true if values for identity - * columns can be specified + * @param identityOverrideAllowed + * true if values for identity columns can be + * specified */ public void setIdentityOverrideAllowed(boolean identityOverrideAllowed) { this.identityOverrideAllowed = identityOverrideAllowed; } - /* + /** * Determines whether the values of identity columns can be read back from * the database after insertion of a row. * @@ -633,18 +655,18 @@ public boolean isLastIdentityValueReadable() { return lastIdentityValueReadable; } - /* + /** * Specifies whether the values of identity columns can be read back from * the database after insertion of a row. * - * @param lastIdentityValueReadable true if the identity - * column(s) can be read back + * @param lastIdentityValueReadable + * true if the identity column(s) can be read back */ public void setLastIdentityValueReadable(boolean lastIdentityValueReadable) { this.lastIdentityValueReadable = lastIdentityValueReadable; } - /* + /** * Determines whether auto-commit mode for the reading of the values of * identity columns after insertion shall be used, i.e. whether between the * insertion of the row and the reading of the database-generated identity @@ -656,21 +678,21 @@ public boolean isAutoCommitModeForLastIdentityValueReading() { return autoCommitModeForLastIdentityValueReading; } - /* + /** * Determines whether auto-commit mode for the reading of the values of * identity columns after insertion shall be used, i.e. whether between the * insertion of the row and the reading of the database-generated identity * value a commit is issued. * - * @param autoCommitModeForLastIdentityValueReading true if - * auto-commit mode shall be used + * @param autoCommitModeForLastIdentityValueReading + * true if auto-commit mode shall be used */ public void setAutoCommitModeForLastIdentityValueReading( boolean autoCommitModeForLastIdentityValueReading) { this.autoCommitModeForLastIdentityValueReading = autoCommitModeForLastIdentityValueReading; } - /* + /** * Returns the maximum number of characters that a table name can have. * * @return The number of characters, or -1 if not limited @@ -679,7 +701,7 @@ public int getMaxTableNameLength() { return maxTableNameLength; } - /* + /** * Returns the maximum number of characters that a column name can have. * * @return The number of characters, or -1 if not limited @@ -688,7 +710,7 @@ public int getMaxColumnNameLength() { return maxColumnNameLength; } - /* + /** * Returns the maximum number of characters that a constraint name can have. * * @return The number of characters, or -1 if not limited @@ -697,7 +719,7 @@ public int getMaxConstraintNameLength() { return maxConstraintNameLength; } - /* + /** * Returns the maximum number of characters that a foreign key name can * have. * @@ -707,11 +729,12 @@ public int getMaxForeignKeyNameLength() { return maxForeignKeyNameLength; } - /* + /** * Sets the maximum length of all identifiers that this database allows. Use * this method if the length limit is the same for all kinds of identifiers. * - * @param maxIdentifierLength The maximum identifier length, -1 if unlimited + * @param maxIdentifierLength + * The maximum identifier length, -1 if unlimited */ public void setMaxIdentifierLength(int maxIdentifierLength) { this.maxTableNameLength = maxIdentifierLength; @@ -720,43 +743,47 @@ public void setMaxIdentifierLength(int maxIdentifierLength) { this.maxForeignKeyNameLength = maxIdentifierLength; } - /* + /** * Sets the maximum length of table names that this database allows. * - * @param maxTableNameLength The maximum length, -1 if unlimited + * @param maxTableNameLength + * The maximum length, -1 if unlimited */ public void setMaxTableNameLength(int maxTableNameLength) { this.maxTableNameLength = maxTableNameLength; } - /* + /** * Sets the maximum length of column names that this database allows. * - * @param maxColumnNameLength The maximum length, -1 if unlimited + * @param maxColumnNameLength + * The maximum length, -1 if unlimited */ public void setMaxColumnNameLength(int maxColumnNameLength) { this.maxColumnNameLength = maxColumnNameLength; } - /* + /** * Sets the maximum length of constraint names that this database allows. * - * @param maxConstraintNameLength The maximum length, -1 if unlimited + * @param maxConstraintNameLength + * The maximum length, -1 if unlimited */ public void setMaxConstraintNameLength(int maxConstraintNameLength) { this.maxConstraintNameLength = maxConstraintNameLength; } - /* + /** * Sets the maximum length of foreign key names that this database allows. * - * @param maxForeignKeyNameLength The maximum length, -1 if unlimited + * @param maxForeignKeyNameLength + * The maximum length, -1 if unlimited */ public void setMaxForeignKeyNameLength(int maxForeignKeyNameLength) { this.maxForeignKeyNameLength = maxForeignKeyNameLength; } - /* + /** * Returns the text that is used to delimit identifiers (eg. table names). * Per default, this is a double quotation character ("). * @@ -766,16 +793,17 @@ public String getDelimiterToken() { return delimiterToken; } - /* + /** * Sets the text that is used to delimit identifiers (eg. table names). * - * @param delimiterToken The delimiter text + * @param delimiterToken + * The delimiter text */ public void setDelimiterToken(String delimiterToken) { this.delimiterToken = delimiterToken; } - /* + /** * Returns the text that is used for for quoting values (e.g. text) when * printing default values and in generates insert/update/delete statements. * Per default, this is a single quotation character ('). @@ -786,17 +814,18 @@ public String getValueQuoteToken() { return valueQuoteToken; } - /* + /** * Sets the text that is used for for quoting values (e.g. text) when * printing default values and in generates insert/update/delete statements. * - * @param valueQuoteChar The new quote text + * @param valueQuoteChar + * The new quote text */ public void setValueQuoteToken(String valueQuoteChar) { this.valueQuoteToken = valueQuoteChar; } - /* + /** * Returns the string that denotes the beginning of a comment. * * @return The comment prefix @@ -805,16 +834,17 @@ public String getCommentPrefix() { return commentPrefix; } - /* + /** * Sets the text that starts a comment. * - * @param commentPrefix The new comment prefix + * @param commentPrefix + * The new comment prefix */ public void setCommentPrefix(String commentPrefix) { this.commentPrefix = (commentPrefix == null ? "" : commentPrefix); } - /* + /** * Returns the string that denotes the end of a comment. Note that comments * will be always on their own line. * @@ -824,16 +854,17 @@ public String getCommentSuffix() { return commentSuffix; } - /* + /** * Sets the text that ends a comment. * - * @param commentSuffix The new comment suffix + * @param commentSuffix + * The new comment suffix */ public void setCommentSuffix(String commentSuffix) { this.commentSuffix = (commentSuffix == null ? "" : commentSuffix); } - /* + /** * Returns the text separating individual sql commands. * * @return The delimiter text @@ -842,19 +873,21 @@ public String getSqlCommandDelimiter() { return sqlCommandDelimiter; } - /* + /** * Sets the text separating individual sql commands. * - * @param sqlCommandDelimiter The delimiter text + * @param sqlCommandDelimiter + * The delimiter text */ public void setSqlCommandDelimiter(String sqlCommandDelimiter) { this.sqlCommandDelimiter = sqlCommandDelimiter; } - /* + /** * Returns the database-native type for the given type code. * - * @param typeCode The {@link java.sql.Types} type code + * @param typeCode + * The {@link java.sql.Types} type code * * @return The native type or null if there isn't one defined */ @@ -862,7 +895,7 @@ public String getNativeType(int typeCode) { return (String) this.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 @@ -870,7 +903,8 @@ public String getNativeType(int typeCode) { * BOOLEAN, and the target jdbc type might be * TINYINT or SMALLINT. * - * @param typeCode The {@link java.sql.Types} type code + * @param typeCode + * The {@link java.sql.Types} type code * * @return The target jdbc type */ @@ -880,45 +914,50 @@ public int getTargetJdbcType(int 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} + * @param jdbcTypeCode + * The jdbc type code as defined by {@link java.sql.Types} * - * @param nativeType The native type + * @param nativeType + * The native type */ public void addNativeTypeMapping(int jdbcTypeCode, String nativeType) { this.nativeTypes.put(new Integer(jdbcTypeCode), nativeType); } - /* + /** * Adds a mapping from jdbc type to database-native type. * - * @param jdbcTypeCode The jdbc type code as defined by {@link - * java.sql.Types} + * @param jdbcTypeCode + * The jdbc type code as defined by {@link java.sql.Types} * - * @param nativeType The native type + * @param nativeType + * The native type * - * @param targetJdbcTypeCode The jdbc type code corresponding to the native - * type (e.g. when reading the model from the database) + * @param targetJdbcTypeCode + * The jdbc type code corresponding to the native type (e.g. when + * reading the model from the database) */ public void addNativeTypeMapping(int jdbcTypeCode, String nativeType, int targetJdbcTypeCode) { addNativeTypeMapping(jdbcTypeCode, nativeType); this.targetJdbcTypes.put(new Integer(jdbcTypeCode), new Integer(targetJdbcTypeCode)); } - /* + /** * Adds a mapping from jdbc type to database-native type. Note that this * method accesses the named constant in {@link java.sql.Types} via * reflection and is thus safe to use under JDK 1.2/1.3 even with constants * defined only in later Java versions - for these, the method simply will * not add a mapping. * - * @param jdbcTypeName The jdbc type name, one of the constants defined in - * {@link java.sql.Types} + * @param jdbcTypeName + * The jdbc type name, one of the constants defined in + * {@link java.sql.Types} * - * @param nativeType The native type + * @param nativeType + * The native type */ public void addNativeTypeMapping(String jdbcTypeName, String nativeType) { try { @@ -934,20 +973,23 @@ public void addNativeTypeMapping(String jdbcTypeName, String nativeType) { } } - /* + /** * Adds a mapping from jdbc type to database-native type. Note that this * method accesses the named constant in {@link java.sql.Types} via * reflection and is thus safe to use under JDK 1.2/1.3 even with constants * defined only in later Java versions - for these, the method simply will * not add a mapping. * - * @param jdbcTypeName The jdbc type name, one of the constants defined in - * {@link java.sql.Types} + * @param jdbcTypeName + * The jdbc type name, one of the constants defined in + * {@link java.sql.Types} * - * @param nativeType The native type + * @param nativeType + * The native type * - * @param targetJdbcTypeName The jdbc type corresponding to the native type - * (e.g. when reading the model from the database) + * @param targetJdbcTypeName + * The jdbc type corresponding to the native type (e.g. when + * reading the model from the database) */ public void addNativeTypeMapping(String jdbcTypeName, String nativeType, String targetJdbcTypeName) { @@ -965,12 +1007,13 @@ public void addNativeTypeMapping(String jdbcTypeName, String nativeType, } } - /* + /** * 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 sqlTypeCode The sql type code + * @param sqlTypeCode + * The sql type code * * @return true if the native type has a null default value */ @@ -978,15 +1021,16 @@ public boolean hasNullDefault(int sqlTypeCode) { return typesWithNullDefault.contains(new Integer(sqlTypeCode)); } - /* + /** * Specifies 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 sqlTypeCode The sql type code + * @param sqlTypeCode + * The sql type code * - * @param hasNullDefault true if the native type has a null - * default value + * @param hasNullDefault + * true if the native type has a null default value */ public void setHasNullDefault(int sqlTypeCode, boolean hasNullDefault) { if (hasNullDefault) { @@ -996,12 +1040,13 @@ public void setHasNullDefault(int sqlTypeCode, boolean hasNullDefault) { } } - /* + /** * 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. * - * @param sqlTypeCode The sql type code + * @param sqlTypeCode + * The sql type code * * @return true if the native type has a size specification */ @@ -1009,15 +1054,16 @@ public boolean hasSize(int sqlTypeCode) { return typesWithSize.contains(new Integer(sqlTypeCode)); } - /* + /** * Specifies 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. * - * @param sqlTypeCode The sql type code + * @param sqlTypeCode + * The sql type code * - * @param hasSize true if the native type has a size - * specification + * @param hasSize + * true if the native type has a size specification */ public void setHasSize(int sqlTypeCode, boolean hasSize) { if (hasSize) { @@ -1027,10 +1073,11 @@ public void setHasSize(int sqlTypeCode, boolean hasSize) { } } - /* + /** * Returns the default size value for the given type, if any. * - * @param jdbcTypeCode The jdbc type code + * @param jdbcTypeCode + * The jdbc type code * * @return The default size or null if none is defined */ @@ -1038,24 +1085,27 @@ public Integer getDefaultSize(int jdbcTypeCode) { return (Integer) typesDefaultSizes.get(new Integer(jdbcTypeCode)); } - /* + /** * Adds a default size for the given jdbc type. * - * @param jdbcTypeCode The jdbc type code + * @param jdbcTypeCode + * The jdbc type code * - * @param defaultSize The default size + * @param defaultSize + * The default size */ public void setDefaultSize(int jdbcTypeCode, int defaultSize) { this.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 jdbcTypeName + * The name of the jdbc type, one of the {@link Types} constants * - * @param defaultSize The default size + * @param defaultSize + * The default size */ public void setDefaultSize(String jdbcTypeName, int defaultSize) { try { @@ -1070,29 +1120,32 @@ public void setDefaultSize(String jdbcTypeName, int defaultSize) { } } - /* + /** * Determines 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 sqlTypeCode + * The sql type code * * @return true if the native type has precision and scale - * specifications + * specifications */ public boolean hasPrecisionAndScale(int sqlTypeCode) { return typesWithPrecisionAndScale.contains(new Integer(sqlTypeCode)); } - /* + /** * 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 sqlTypeCode + * The sql type code * - * @param hasPrecisionAndScale true if the native type has - * precision and scale specifications + * @param hasPrecisionAndScale + * true if the native type has precision and scale + * specifications */ public void setHasPrecisionAndScale(int sqlTypeCode, boolean hasPrecisionAndScale) { if (hasPrecisionAndScale) { @@ -1149,20 +1202,28 @@ public void setNonBlankCharColumnSpacePadded(boolean nonBlankCharColumnSpacePadd public boolean isNonBlankCharColumnSpacePadded() { return nonBlankCharColumnSpacePadded; } - + public boolean isAutoIncrementUpdateAllowed() { return autoIncrementUpdateAllowed; } - + public void setAutoIncrementUpdateAllowed(boolean autoIncrementUpdateAllowed) { this.autoIncrementUpdateAllowed = autoIncrementUpdateAllowed; } - + public void setRequiresAutoCommitForDdl(boolean requireAutoCommitForDdl) { this.requiresAutoCommitForDdl = requireAutoCommitForDdl; } - + public boolean isRequiresAutoCommitForDdl() { return requiresAutoCommitForDdl; } + + public boolean isBlobsWorkInWhereClause() { + return blobsWorkInWhereClause; + } + + public void setBlobsWorkInWhereClause(boolean blobsWorkInWhereClause) { + this.blobsWorkInWhereClause = blobsWorkInWhereClause; + } } diff --git a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/db2/Db2DdlBuilder.java b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/db2/Db2DdlBuilder.java index ed28666ddb..be2f25a042 100644 --- a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/db2/Db2DdlBuilder.java +++ b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/db2/Db2DdlBuilder.java @@ -35,7 +35,6 @@ import org.jumpmind.db.model.Table; import org.jumpmind.db.model.TypeMap; import org.jumpmind.db.platform.AbstractDdlBuilder; -import org.jumpmind.db.platform.DatabaseInfo; import org.jumpmind.db.platform.PlatformUtils; /* @@ -46,6 +45,7 @@ public class Db2DdlBuilder extends AbstractDdlBuilder { public Db2DdlBuilder() { super(); // the BINARY types are also handled by Db2Builder.getSqlType(Column) + databaseInfo.setBlobsWorkInWhereClause(false); databaseInfo.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB); databaseInfo.addNativeTypeMapping(Types.BINARY, "CHAR {0} FOR BIT DATA"); databaseInfo.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT); diff --git a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/derby/DerbyDdlBuilder.java b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/derby/DerbyDdlBuilder.java index 082d09a5e2..e38e98c78c 100644 --- a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/derby/DerbyDdlBuilder.java +++ b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/derby/DerbyDdlBuilder.java @@ -31,7 +31,6 @@ import org.jumpmind.db.model.Table; import org.jumpmind.db.model.TypeMap; import org.jumpmind.db.platform.AbstractDdlBuilder; -import org.jumpmind.db.platform.DatabaseInfo; import org.jumpmind.db.platform.PlatformUtils; /* @@ -42,6 +41,7 @@ public class DerbyDdlBuilder extends AbstractDdlBuilder { public DerbyDdlBuilder() { databaseInfo.setMaxIdentifierLength(128); databaseInfo.setSystemForeignKeyIndicesAlwaysNonUnique(true); + databaseInfo.setBlobsWorkInWhereClause(false); databaseInfo.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB); databaseInfo.addNativeTypeMapping(Types.BINARY, "CHAR {0} FOR BIT DATA"); databaseInfo.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT); diff --git a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/mssql/MsSqlDdlBuilder.java b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/mssql/MsSqlDdlBuilder.java index f687e55878..c9c0948f13 100644 --- a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/mssql/MsSqlDdlBuilder.java +++ b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/mssql/MsSqlDdlBuilder.java @@ -66,7 +66,7 @@ public class MsSqlDdlBuilder extends AbstractDdlBuilder { public MsSqlDdlBuilder() { databaseInfo.setMaxIdentifierLength(128); - + databaseInfo.setBlobsWorkInWhereClause(false); databaseInfo.addNativeTypeMapping(Types.ARRAY, "IMAGE", Types.LONGVARBINARY); // BIGINT will be mapped back to BIGINT by the model reader databaseInfo.addNativeTypeMapping(Types.BIGINT, "DECIMAL(19,0)"); diff --git a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/oracle/OracleDdlBuilder.java b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/oracle/OracleDdlBuilder.java index 844aeeca0f..aa89b60771 100644 --- a/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/oracle/OracleDdlBuilder.java +++ b/symmetric/symmetric-db/src/main/java/org/jumpmind/db/platform/oracle/OracleDdlBuilder.java @@ -50,6 +50,7 @@ public class OracleDdlBuilder extends AbstractDdlBuilder { public OracleDdlBuilder() { databaseInfo.setMaxIdentifierLength(30); databaseInfo.setIdentityStatusReadingSupported(false); + databaseInfo.setBlobsWorkInWhereClause(false); // Note that the back-mappings are partially done by the model reader, // not the driver