|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 java.lang.String |
databaseProductName
|
protected java.lang.String |
databaseProductVersion
|
static int |
db2ISeriesV5R3OrEarlier
|
static int |
db2ISeriesV5R4OrLater
|
protected int |
db2ServerType
|
static int |
db2UDBV81OrEarlier
|
static int |
db2UDBV82OrLater
|
static int |
db2ZOSV8xOrLater
|
protected static java.lang.String |
forReadOnlyClause
|
protected static java.lang.String |
forUpdate
|
protected int |
maj
|
protected int |
min
|
java.lang.String |
optimizeClause
|
java.lang.String |
rowClause
|
protected static java.lang.String |
useKeepExclusiveLockClause
|
protected static java.lang.String |
useKeepShareLockClause
|
protected static java.lang.String |
useKeepUpdateLockClause
|
static java.lang.String |
VENDOR_IBM
|
protected static java.lang.String |
withCSClause
|
protected static java.lang.String |
withRRClause
|
protected static java.lang.String |
withRSClause
|
protected static java.lang.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 | |
---|---|
java.lang.String |
addCastAsType(java.lang.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,
java.lang.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,
java.lang.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(java.sql.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,
java.lang.String table,
Column pkColumn)
Create an index if necessary for some database tables |
java.sql.Connection |
decorate(java.sql.Connection conn)
Decorate the given connection if needed. |
int |
getBatchLimit()
Return the batch limit. |
byte[] |
getBytes(java.sql.ResultSet rs,
int column)
Convert the specified column of the SQL ResultSet to the proper java type. |
java.lang.String |
getCastFunction(Val val,
java.lang.String func)
Return the correct CAST function syntax |
java.lang.String |
getCastFunction(Val val,
java.lang.String func,
Column col)
Return the correct CAST function syntax |
java.lang.String[] |
getCreateSequenceSQL(Sequence seq)
Return a series of SQL statements to create the given sequence. |
int |
getDb2ServerType()
|
protected java.lang.String |
getForUpdateClause(JDBCFetchConfiguration fetch,
boolean isForUpdate,
Select sel)
Get the update clause for the query based on the updateClause and isolationLevel hints |
protected java.lang.String |
getOptimizeClause(Select sel)
|
protected java.lang.String |
getSequencesSQL(DBIdentifier schemaName,
DBIdentifier sequenceName)
|
protected java.lang.String |
getSequencesSQL(java.lang.String schemaName,
java.lang.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,
java.sql.SQLException ex)
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). |
OpenJPAException |
newStoreException(java.lang.String msg,
java.sql.SQLException[] causes,
java.lang.Object failed)
Return a new exception that wraps causes . |
void |
setBytes(java.sql.PreparedStatement stmnt,
int idx,
byte[] val,
Column col)
Set the given value as a parameter to the statement. |
protected void |
setDelimitedCase(java.sql.DatabaseMetaData metaData)
|
void |
setQueryTimeout(java.sql.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 java.lang.String VENDOR_IBM
public java.lang.String optimizeClause
public java.lang.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 java.lang.String forUpdate
protected static final java.lang.String withURClause
protected static final java.lang.String withCSClause
protected static final java.lang.String withRSClause
protected static final java.lang.String withRRClause
protected static final java.lang.String useKeepShareLockClause
protected static final java.lang.String useKeepUpdateLockClause
protected static final java.lang.String useKeepExclusiveLockClause
protected static final java.lang.String forReadOnlyClause
protected java.lang.String databaseProductName
protected java.lang.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, java.lang.Object alias, Select sel, int idx)
DBDictionary
elem
to selectSQL
.
appendSelect
in class DBDictionary
selectSQL
- The SQLBuffer to append to.public java.lang.String[] getCreateSequenceSQL(Sequence seq)
DBDictionary
CREATE SEQUENCE <sequence name>[ START WITH <start>]
[ INCREMENT BY <increment>]
by default.
getCreateSequenceSQL
in class DBDictionary
protected java.lang.String getSequencesSQL(java.lang.String schemaName, java.lang.String sequenceName)
DBDictionary
getSequencesSQL
in class DBDictionary
protected java.lang.String getSequencesSQL(DBIdentifier schemaName, DBIdentifier sequenceName)
getSequencesSQL
in class DBDictionary
public java.sql.Connection decorate(java.sql.Connection conn) throws java.sql.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
java.sql.SQLException
public void connectedConfiguration(java.sql.Connection conn) throws java.sql.SQLException
DBDictionary
super.connectedConfiguration
.
connectedConfiguration
in class DBDictionary
java.sql.SQLException
public boolean supportsIsolationForUpdate()
DBDictionary
supportsIsolationForUpdate
in class DBDictionary
protected java.lang.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 java.lang.String getOptimizeClause(Select sel)
public OpenJPAException newStoreException(java.lang.String msg, java.sql.SQLException[] causes, java.lang.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, java.lang.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 java.lang.String addCastAsType(java.lang.String func, Val val)
addCastAsType
in class DBDictionary
func
- function nameval
- type
public int getBatchLimit()
getBatchLimit
in class DBDictionary
public java.lang.String getCastFunction(Val val, java.lang.String func)
getCastFunction
in class DBDictionary
val
- operand of castfunc
- original string
public java.lang.String getCastFunction(Val val, java.lang.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, java.lang.String table, Column pkColumn)
createIndexIfNecessary
in class DBDictionary
public void createIndexIfNecessary(Schema schema, DBIdentifier table, Column pkColumn)
createIndexIfNecessary
in class DBDictionary
public boolean isFatalException(int subtype, java.sql.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(java.sql.DatabaseMetaData metaData)
setDelimitedCase
in class DBDictionary
public void setQueryTimeout(java.sql.PreparedStatement stmnt, int timeout) throws java.sql.SQLException
setQueryTimeout
in class DBDictionary
timeout
- in milliseconds
java.sql.SQLException
public void setBytes(java.sql.PreparedStatement stmnt, int idx, byte[] val, Column col) throws java.sql.SQLException
setBytes
in class DBDictionary
java.sql.SQLException
public byte[] getBytes(java.sql.ResultSet rs, int column) throws java.sql.SQLException
getBytes
in class DBDictionary
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |