Changes for JIRA OPENJPA-77 issue.

These changes allow the use of the DB2Dictionary with DB2 on z/OS.  May need more in the future, but these will get us started...


git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@491027 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kevin W. Sutter 2006-12-29 15:19:17 +00:00
parent 6c4a0dd4af
commit 6cb121e192
2 changed files with 30 additions and 4 deletions

View File

@ -36,6 +36,12 @@ public class DB2Dictionary
nextSequenceQuery = "VALUES NEXTVAL FOR {0}";
sequenceSQL = "SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, "
+ "SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES";
sequenceSchemaSQL = "SEQSCHEMA = ?";
sequenceNameSQL = "SEQNAME = ?";
characterColumnSize = 254;
binaryTypeName = "BLOB(1M)";
longVarbinaryTypeName = "BLOB(1M)";
varbinaryTypeName = "BLOB(1M)";
@ -112,17 +118,16 @@ public class DB2Dictionary
protected String getSequencesSQL(String schemaName, String sequenceName) {
StringBuffer buf = new StringBuffer();
buf.append("SELECT SEQSCHEMA AS SEQUENCE_SCHEMA, ").
append("SEQNAME AS SEQUENCE_NAME FROM SYSCAT.SEQUENCES");
buf.append(sequenceSQL);
if (schemaName != null || sequenceName != null)
buf.append(" WHERE ");
if (schemaName != null) {
buf.append("SEQSCHEMA = ?");
buf.append(sequenceSchemaSQL);
if (sequenceName != null)
buf.append(" AND ");
}
if (sequenceName != null)
buf.append("SEQNAME = ?");
buf.append(sequenceNameSQL);
return buf.toString();
}
@ -157,6 +162,24 @@ public class DB2Dictionary
supportsLockingWithOuterJoin = true;
forUpdateClause = "WITH RR USE AND KEEP UPDATE LOCKS";
}
if (metaData.getDatabaseProductVersion().indexOf("DSN") != -1) {
// DB2 Z/OS
characterColumnSize = 255;
lastGeneratedKeyQuery = "SELECT IDENTITY_VAL_LOCAL() FROM "
+ "SYSIBM.SYSDUMMY1";
nextSequenceQuery = "SELECT NEXTVAL FOR {0} FROM "
+ "SYSIBM.SYSDUMMY1";
sequenceSQL = "SELECT SCHEMA AS SEQUENCE_SCHEMA, "
+ "NAME AS SEQUENCE_NAME FROM SYSIBM.SYSSEQUENCES";
sequenceSchemaSQL = "SCHEMA = ?";
sequenceNameSQL = "NAME = ?";
if (maj == 8) {
// DB2 Z/OS Version 8: no bigint support, hence map Java
// long to decimal
bigintTypeName = "DECIMAL(31,0)";
}
}
}
}
}

View File

@ -287,6 +287,9 @@ public class DBDictionary
public boolean supportsAutoAssign = false;
public String lastGeneratedKeyQuery = null;
public String nextSequenceQuery = null;
public String sequenceSQL = null;
public String sequenceSchemaSQL = null;
public String sequenceNameSQL = null;
protected JDBCConfiguration conf = null;
protected Log log = null;