OPENJPA-1540 Modified Informix dictionary to detect non-delimited identifier case for the Informix driver. Also added missing method override.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@917727 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeremy Bauer 2010-03-01 21:29:01 +00:00
parent 18a1a04c77
commit 208f5388ce
2 changed files with 40 additions and 6 deletions

View File

@ -29,6 +29,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import org.apache.openjpa.jdbc.identifier.DBIdentifier;
import org.apache.openjpa.jdbc.identifier.DBIdentifier.DBIdentifierType;
import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
import org.apache.openjpa.jdbc.schema.Column;
@ -167,11 +168,13 @@ public class InformixDictionary
{
driverVendor = VENDOR_IBM;
useJCC = true;
try {
if (meta.storesLowerCaseIdentifiers())
schemaCase = SCHEMA_CASE_LOWER;
} catch (SQLException e) {}
} else if ("Informix".equalsIgnoreCase(driverName))
setIdentifierCase(meta);
}
else if (driverName.equals("IBM Informix JDBC Driver for IBM Informix Dynamic Server")) {
setIdentifierCase(meta);
driverVendor = VENDOR_IBM;
}
else if ("Informix".equalsIgnoreCase(driverName))
driverVendor = VENDOR_DATADIRECT;
else
driverVendor = VENDOR_OTHER;
@ -186,11 +189,40 @@ public class InformixDictionary
conn.getTransactionIsolation()}));
}
}
private void setIdentifierCase(DatabaseMetaData meta) {
try {
// lower case identifiers is the default for the JCC and newer
// Informix JDBC drivers
if (meta.storesLowerCaseIdentifiers()) {
schemaCase = SCHEMA_CASE_LOWER;
}
else if (meta.storesMixedCaseIdentifiers()) {
schemaCase = SCHEMA_CASE_PRESERVE;
}
// otherwise, use the default (upper)
}
catch (SQLException e) {
getLog().warn("cannot-determine-identifier-base-case");
if (getLog().isTraceEnabled()) {
getLog().trace(e.toString(), e);
}
}
}
@Override
public Column[] getColumns(DatabaseMetaData meta, String catalog,
String schemaName, String tableName, String columnName, Connection conn)
throws SQLException {
return getColumns(meta, DBIdentifier.newCatalog(catalog),
DBIdentifier.newSchema(schemaName),DBIdentifier.newTable(tableName),
DBIdentifier.newColumn(columnName), conn);
}
@Override
public Column[] getColumns(DatabaseMetaData meta, DBIdentifier catalog,
DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, Connection conn)
throws SQLException {
Column[] cols = super.getColumns(meta, catalog, schemaName, tableName,
columnName, conn);

View File

@ -204,4 +204,6 @@ cannot-determine-identifier-case: Unable to determine the case to use for delimi
identifiers. The default value of "preserve" will be used.
unknown-delim-support: Unable to determine whether delimited identifiers are supported. \
The use of delimiters will not be supported.
can_not_get_current_schema: Unable to get current schema. SQLException message is "{0}".
can_not_get_current_schema: Unable to get current schema. SQLException message is "{0}".
cannot-determine-identifier-base-case: Unable to determine the case to use for \
identifiers. The default value of "{0}" will be used.