mirror of https://github.com/apache/openjpa.git
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:
parent
18a1a04c77
commit
208f5388ce
|
@ -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;
|
||||
|
@ -187,10 +190,39 @@ public class InformixDictionary
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -205,3 +205,5 @@ cannot-determine-identifier-case: Unable to determine the case to use for delimi
|
|||
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}".
|
||||
cannot-determine-identifier-base-case: Unable to determine the case to use for \
|
||||
identifiers. The default value of "{0}" will be used.
|
||||
|
|
Loading…
Reference in New Issue