|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.sql.DBDictionary org.apache.openjpa.jdbc.sql.AbstractDB2Dictionary org.apache.openjpa.jdbc.sql.DB2Dictionary
public class DB2Dictionary
Dictionary for IBM DB2 database.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary |
---|
DBDictionary.SerializedData |
Field Summary | |
---|---|
protected String |
databaseProductName
|
protected String |
databaseProductVersion
|
static int |
db2ISeriesV5R3OrEarlier
|
static int |
db2ISeriesV5R4OrLater
|
protected int |
db2ServerType
|
static int |
db2UDBV81OrEarlier
|
static int |
db2UDBV82OrLater
|
static int |
db2ZOSV8xOrLater
|
protected static String |
defaultSequenceSQL
|
protected static String |
forReadOnlyClause
|
protected static String |
forUpdate
|
protected int |
maj
|
protected int |
min
|
String |
optimizeClause
|
String |
rowClause
|
protected static String |
useKeepExclusiveLockClause
|
protected static String |
useKeepShareLockClause
|
protected static String |
useKeepUpdateLockClause
|
static String |
VENDOR_IBM
|
protected static String |
withCSClause
|
protected static String |
withRRClause
|
protected static String |
withRSClause
|
protected static String |
withURClause
|
Fields inherited from class org.apache.openjpa.jdbc.sql.AbstractDB2Dictionary |
---|
varcharCastLength |
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes |
---|
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL |
Constructor Summary | |
---|---|
DB2Dictionary()
|
Method Summary | |
---|---|
String |
addCastAsType(String func,
Val val)
add CAST for a function operator where operand is a param |
void |
appendCast(SQLBuffer buf,
FilterValue val,
int type)
Cast the specified value to the specified type. |
protected void |
appendLength(SQLBuffer buf,
int type)
|
protected void |
appendSelect(SQLBuffer selectSQL,
Object alias,
Select sel,
int idx)
Append elem to selectSQL . |
protected void |
appendSelectRange(SQLBuffer buf,
long start,
long end,
boolean subselect)
If this dictionary can select ranges, use this method to append the range SQL. |
void |
appendXmlComparison(SQLBuffer buf,
String op,
FilterValue lhs,
FilterValue rhs,
boolean lhsxml,
boolean rhsxml)
If this dictionary supports XML type, use this method to append xml predicate. |
void |
connectedConfiguration(Connection conn)
This method is called when the dictionary first sees any connection. |
void |
createIndexIfNecessary(Schema schema,
DBIdentifier table,
Column pkColumn)
|
void |
createIndexIfNecessary(Schema schema,
String table,
Column pkColumn)
Create an index if necessary for some database tables |
Connection |
decorate(Connection conn)
Decorate the given connection if needed. |
int |
getBatchLimit()
Return the batch limit. |
byte[] |
getBytes(ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
String |
getCastFunction(Val val,
String func)
Return the correct CAST function syntax |
String |
getCastFunction(Val val,
String func,
Column col)
Return the correct CAST function syntax |
String[] |
getCreateSequenceSQL(Sequence seq)
Return a series of SQL statements to create the given sequence. |
int |
getDb2ServerType()
|
protected String |
getForUpdateClause(JDBCFetchConfiguration fetch,
boolean isForUpdate,
Select sel)
Get the update clause for the query based on the updateClause and isolationLevel hints |
protected String |
getOptimizeClause(Select sel)
|
protected String |
getSequencesSQL(DBIdentifier schemaName,
DBIdentifier sequenceName)
|
protected String |
getSequencesSQL(String schemaName,
String sequenceName)
Return the SQL needed to select the list of sequences. |
void |
indexOf(SQLBuffer buf,
FilterValue str,
FilterValue find,
FilterValue start)
Invoke this database's indexOf function. |
boolean |
isDB2ISeriesV5R3OrEarlier()
|
boolean |
isDB2ISeriesV5R4OrLater()
|
boolean |
isDB2UDBV81OrEarlier()
|
boolean |
isDB2UDBV82OrLater()
|
boolean |
isDB2ZOSV8xOrLater()
|
boolean |
isFatalException(int subtype,
SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). |
OpenJPAException |
newStoreException(String msg,
SQLException[] causes,
Object failed)
Return a new exception that wraps causes . |
(package private) String |
nullSafe(String s)
|
void |
setBytes(PreparedStatement stmnt,
int idx,
byte[] val,
Column col)
Set the given value as a parameter to the statement. |
protected void |
setDelimitedCase(DatabaseMetaData metaData)
|
void |
setQueryTimeout(PreparedStatement stmnt,
int timeout)
The Type 2 JDBC Driver may throw an SQLException when provided a non- zero timeout if we're connected to Z/OS. |
boolean |
supportsIsolationForUpdate()
Return true if the dictionary uses isolation level to compute the returned getForUpdateClause() SQL clause. |
boolean |
supportsRandomAccessResultSet(Select sel,
boolean forUpdate)
Return false if the given select requires a forward-only result set. |
Methods inherited from class org.apache.openjpa.jdbc.sql.AbstractDB2Dictionary |
---|
substring |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VENDOR_IBM
public String optimizeClause
public String rowClause
protected int db2ServerType
public static final int db2ISeriesV5R3OrEarlier
public static final int db2UDBV81OrEarlier
public static final int db2ZOSV8xOrLater
public static final int db2UDBV82OrLater
public static final int db2ISeriesV5R4OrLater
protected static final String forUpdate
protected static final String withURClause
protected static final String withCSClause
protected static final String withRSClause
protected static final String withRRClause
protected static final String useKeepShareLockClause
protected static final String useKeepUpdateLockClause
protected static final String useKeepExclusiveLockClause
protected static final String forReadOnlyClause
protected static final String defaultSequenceSQL
protected String databaseProductName
protected String databaseProductVersion
protected int maj
protected int min
Constructor Detail |
---|
public DB2Dictionary()
Method Detail |
---|
public boolean supportsRandomAccessResultSet(Select sel, boolean forUpdate)
DBDictionary
supportsRandomAccessResultSet
in class DBDictionary
protected void appendSelectRange(SQLBuffer buf, long start, long end, boolean subselect)
DBDictionary
appendSelectRange
in class DBDictionary
protected void appendSelect(SQLBuffer selectSQL, Object alias, Select sel, int idx)
DBDictionary
elem
to selectSQL
.
appendSelect
in class DBDictionary
selectSQL
- The SQLBuffer to append to.public String[] getCreateSequenceSQL(Sequence seq)
DBDictionary
CREATE SEQUENCE <sequence name>[ START WITH <start>]
[ INCREMENT BY <increment>]
by default.
getCreateSequenceSQL
in class DBDictionary
protected String getSequencesSQL(String schemaName, String sequenceName)
DBDictionary
getSequencesSQL
in class DBDictionary
protected String getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
getSequencesSQL
in class DBDictionary
public Connection decorate(Connection conn) throws SQLException
DBDictionary
DBDictionary.initializationSQL
that has been set for the dictionary but
does not decorate the connection.
decorate
in interface ConnectionDecorator
decorate
in class DBDictionary
SQLException
public void connectedConfiguration(Connection conn) throws SQLException
DBDictionary
super.connectedConfiguration
.
connectedConfiguration
in class DBDictionary
SQLException
public boolean supportsIsolationForUpdate()
DBDictionary
supportsIsolationForUpdate
in class DBDictionary
protected String getForUpdateClause(JDBCFetchConfiguration fetch, boolean isForUpdate, Select sel)
getForUpdateClause
in class DBDictionary
public boolean isDB2UDBV82OrLater()
public boolean isDB2ZOSV8xOrLater()
public boolean isDB2ISeriesV5R3OrEarlier()
public boolean isDB2ISeriesV5R4OrLater()
public boolean isDB2UDBV81OrEarlier()
protected String getOptimizeClause(Select sel)
public OpenJPAException newStoreException(String msg, SQLException[] causes, Object failed)
DBDictionary
causes
.
However, the details of exactly what type of exception is returned can
be determined by the implementation. This may take into account
DB-specific exception information in causes
.
newStoreException
in class DBDictionary
public int getDb2ServerType()
protected void appendLength(SQLBuffer buf, int type)
appendLength
in class DBDictionary
public void appendXmlComparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
appendXmlComparison
in class DBDictionary
buf
- the SQL buffer to write the comparisonop
- the comparison operation to performlhs
- the left hand side of the comparisonrhs
- the right hand side of the comparisonlhsxml
- indicates whether the left operand maps to xmlrhsxml
- indicates whether the right operand maps to xmlpublic String addCastAsType(String func, Val val)
addCastAsType
in class DBDictionary
func
- function nameval
- type
public int getBatchLimit()
getBatchLimit
in class DBDictionary
public String getCastFunction(Val val, String func)
getCastFunction
in class DBDictionary
val
- operand of castfunc
- original string
public String getCastFunction(Val val, String func, Column col)
getCastFunction
in class DBDictionary
val
- operand of castfunc
- original stringcol
- database column
public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find, FilterValue start)
DBDictionary
indexOf
in class AbstractDB2Dictionary
buf
- the SQL buffer to write the indexOf invocation tostr
- a query value representing the target stringfind
- a query value representing the search stringstart
- a query value representing the start index, or null
to start at the beginningpublic void appendCast(SQLBuffer buf, FilterValue val, int type)
buf
- the buffer to append the cast toval
- the value to casttype
- the type of the case, e.g. Types.NUMERIC
public void createIndexIfNecessary(Schema schema, String table, Column pkColumn)
createIndexIfNecessary
in class DBDictionary
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn)
createIndexIfNecessary
in class DBDictionary
String nullSafe(String s)
public boolean isFatalException(int subtype, SQLException ex)
DBDictionary
isFatalException
in class DBDictionary
subtype
- A constant indicating the category of error as defined in StoreException
.ex
- original SQL Exception as raised by the database driver.
protected void setDelimitedCase(DatabaseMetaData metaData)
setDelimitedCase
in class DBDictionary
public void setQueryTimeout(PreparedStatement stmnt, int timeout) throws SQLException
setQueryTimeout
in class DBDictionary
timeout
- in milliseconds
SQLException
public void setBytes(PreparedStatement stmnt, int idx, byte[] val, Column col) throws SQLException
setBytes
in class DBDictionary
SQLException
public byte[] getBytes(ResultSet rs, int column) throws SQLException
getBytes
in class DBDictionary
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |