public class DB2Dictionary extends AbstractDB2Dictionary
DBDictionary.DateMillisecondBehaviors, DBDictionary.SerializedData
Modifier and Type | Field and Description |
---|---|
boolean |
appendExtendedExceptionText |
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 |
String |
optimizeClause |
String |
rowClause |
boolean |
supportsRowNum
Affirms whether this dictionary uses
ROWNUM feature. |
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 |
varcharCastLength
_proxyManager, allowQueryTimeoutOnFindUpdate, allowsAliasInBulkClause, arrayTypeName, autoAssignClause, autoAssignTypeName, batchLimit, bigintTypeName, binaryTypeName, bitLengthFunction, bitTypeName, blobBufferSize, blobTypeName, booleanRepresentation, booleanTypeName, castFunction, catalogSeparator, CENTI, characterColumnSize, charTypeName, clobBufferSize, clobTypeName, closePoolSQL, concatenateDelimiter, concatenateFunction, conf, connected, CONS_NAME_AFTER, CONS_NAME_BEFORE, CONS_NAME_MID, constraintNameMode, createPrimaryKeys, crossJoinClause, currentDateFunction, currentTimeFunction, currentTimestampFunction, databaseProductName, databaseProductVersion, datePrecision, dateTypeName, DECI, decimalTypeName, defaultSchemaName, delimitedCase, disableAlterSeqenceIncrementBy, disableSchemaFactoryColumnTypeErrors, distinctCountColumnSeparator, distinctTypeName, doubleTypeName, driverVendor, dropTableSQL, fixedSizeTypeNames, fixedSizeTypeNameSet, floatTypeName, forUpdateClause, fullResultCollectionInOrderByRelation, getStringVal, inClauseLimit, initializationSQL, innerJoinClause, integerTypeName, invalidColumnWordSet, isJDBC3, isJDBC4, javaObjectTypeName, joinSyntax, lastGeneratedKeyQuery, leadingDelimiter, log, longVarbinaryTypeName, longVarcharTypeName, maxAutoAssignNameLength, maxColumnNameLength, maxConstraintNameLength, maxEmbeddedBlobSize, maxEmbeddedClobSize, maxIndexesPerTable, maxIndexNameLength, maxTableNameLength, MICRO, MILLI, NAME_ANY, NAME_SEQUENCE, NAME_TABLE, nameConcatenator, NANO, nativeSequenceType, nextSequenceQuery, NO_BATCH, nullTypeName, numericTypeName, otherTypeName, outerJoinClause, platform, RANGE_POST_DISTINCT, RANGE_POST_LOCK, RANGE_POST_SELECT, RANGE_PRE_DISTINCT, rangePosition, realTypeName, refTypeName, reportsSuccessNoInfoOnBatchUpdates, requiresAliasForSubselect, requiresAutoCommitForMetaData, requiresCastForComparisons, requiresCastForMathFunctions, requiresConditionForCrossJoin, requiresSearchStringEscapeForLike, requiresTargetForDelete, reservedWords, reservedWordSet, roundTimeToMillisec, SCHEMA_CASE_LOWER, SCHEMA_CASE_PRESERVE, SCHEMA_CASE_UPPER, schemaCase, searchStringEscape, SEC, selectWords, selectWordSet, sequenceNameSQL, sequenceSchemaSQL, sequenceSQL, setStringRightTruncationOn, simulateLocking, smallintTypeName, sqlStateCodes, storageLimitationsFatal, storeCharsAsNumbers, storeLargeNumbersAsStrings, stringLengthFunction, structTypeName, substringFunctionName, supportsAlterTableWithAddColumn, supportsAlterTableWithDropColumn, supportsAutoAssign, supportsCascadeDeleteAction, supportsCascadeUpdateAction, supportsCaseConversionForLob, supportsComments, supportsCorrelatedSubselect, supportsDefaultDeleteAction, supportsDefaultUpdateAction, supportsDeferredConstraints, supportsDelimitedIdentifiers, supportsForeignKeys, supportsForeignKeysComposite, supportsGeneralCaseExpression, supportsGetGeneratedKeys, supportsHaving, supportsLockingWithDistinctClause, supportsLockingWithInnerJoin, supportsLockingWithMultipleTables, supportsLockingWithOrderClause, supportsLockingWithOuterJoin, supportsLockingWithSelectRange, supportsModOperator, supportsMultipleNontransactionalResultSets, supportsNullDeleteAction, supportsNullTableForGetColumns, supportsNullTableForGetImportedKeys, supportsNullTableForGetIndexInfo, supportsNullTableForGetPrimaryKeys, supportsNullUniqueColumn, supportsNullUpdateAction, supportsParameterInSelect, supportsQueryTimeout, supportsRestrictDeleteAction, supportsRestrictUpdateAction, supportsSchemaForGetColumns, supportsSchemaForGetTables, supportsSelectEndIndex, supportsSelectForUpdate, supportsSelectFromFinalTable, supportsSelectStartIndex, supportsSimpleCaseExpression, supportsSubselect, supportsUniqueConstraints, supportsXMLColumn, systemSchemas, systemSchemaSet, systemTables, systemTableSet, tableForUpdateClause, tableLengthIncludesSchema, tableTypes, timestampTypeName, timeTypeName, tinyintTypeName, toLowerCaseFunction, toUpperCaseFunction, trailingDelimiter, trimBothFunction, trimLeadingFunction, trimSchemaName, trimStringColumns, trimTrailingFunction, typeModifierSet, UNLIMITED, useGetBestRowIdentifierForPrimaryKeys, useGetBytesForBlobs, useGetObjectForBlobs, useGetStringForClobs, useJDBC4SetBinaryStream, useNativeSequenceCache, useSchemaName, useSetBytesForBlobs, useSetStringForClobs, useWildCardForCount, validationSQL, varbinaryTypeName, varcharTypeName, VENDOR_DATADIRECT, VENDOR_OTHER, xmlTypeEncoding, xmlTypeName
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL
Constructor and Description |
---|
DB2Dictionary() |
Modifier and Type | Method and Description |
---|---|
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
|
int |
getDB2MajorVersion() |
int |
getDB2MinorVersion() |
int |
getDb2ServerType() |
String |
getDefaultSchemaName() |
protected String |
getForUpdateClause(JDBCFetchConfiguration fetch,
boolean isForUpdate,
Select sel)
Get the update clause for the query based on the
isolationLevel hints if it is for update.
|
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.
|
void |
insertBlobForStreamingLoad(Row row,
Column col,
JDBCStore store,
Object ob,
Select sel) |
void |
insertClobForStreamingLoad(Row row,
Column col,
Object ob) |
boolean |
isDB2ISeriesV5R3OrEarlier() |
boolean |
isDB2ISeriesV5R4OrEarlier() |
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 . |
void |
setBytes(PreparedStatement stmnt,
int idx,
byte[] val,
Column col)
Set the given value as a parameter to the statement.
|
void |
setDate(PreparedStatement stmnt,
int idx,
Date val,
Column col)
Set the given date 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.
|
protected SQLBuffer |
toSelect(SQLBuffer select,
JDBCFetchConfiguration fetch,
SQLBuffer tables,
SQLBuffer where,
SQLBuffer group,
SQLBuffer having,
SQLBuffer order,
boolean distinct,
boolean forUpdate,
long start,
long end,
Select sel)
Combine the given components into a SELECT statement.
|
void |
updateBlob(Select sel,
JDBCStore store,
InputStream is) |
void |
updateClob(Select sel,
JDBCStore store,
Reader reader) |
substring
addErrorCode, appendCast, appendNumericCast, appendSize, appendUpdates, applyRange, assertSupport, calculateValue, canOuterJoin, closeDataSource, combineForeignKey, comment, comparison, configureNamingRules, convertSchemaCase, convertSchemaCase, copy, copy, deleteStream, delimitAll, endConfiguration, executeQuery, fromDBName, getAddColumnSQL, getAddForeignKeySQL, getAddPrimaryKeySQL, getAlterSequenceSQL, getArray, getAsciiStream, getBatchFetchSize, getBatchUpdateCount, getBigDecimal, getBigInteger, getBinaryStream, getBlob, getBlobObject, getBoolean, getBooleanRepresentation, getByte, getCalendar, getCatalogNameForMetadata, getCatalogNameForMetadata, getChar, getCharacterStream, getClob, getClobString, getColumnDBName, getColumnIdentifier, getColumnNameForMetadata, getColumnNameForMetadata, getColumns, getColumns, getConversionKey, getCreateIndexSQL, getCreateSequenceSQL, getCreateTableSQL, getCreateTableSQL, getDate, getDate, getDeclareColumnSQL, getDefaultIdentifierRule, getDeleteTableContentsSQL, getDeleteTargets, getDelimitedCase, getDelimitIdentifiers, getDouble, getDropColumnSQL, getDropForeignKeySQL, getDropIndexSQL, getDropPrimaryKeySQL, getDropSequenceSQL, getDropTableSQL, getFloat, getForeignKeyConstraintSQL, getFrom, getFromSelect, getFullIdentifier, getFullName, getFullName, getFullName, getGeneratedKey, getGeneratedKeySequenceName, getGenKeySeqName, getIdentifierConcatenator, getIdentifierDelimiter, getIdentifierRule, getIdentifierRules, getIdentityColumnName, getImportedKeys, getImportedKeys, getImportedKeys, getImportedKeys, getIndexInfo, getIndexInfo, getInt, getInvalidColumnWordSet, getIsNotNullSQL, getIsNullSQL, getJDBCType, getJDBCType, getJDBCType, getKey, getLeadingDelimiter, getLOBStream, getLocale, getLog, getLong, getMajorVersion, getMarkerForInsertUpdate, getMillisecondBehavior, getMinorVersion, getNamingUtil, getNumber, getObject, getPlaceholderValueString, getPreferredType, getPrimaryKeyConstraintSQL, getPrimaryKeys, getPrimaryKeys, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromGetPrimaryKeys, getPrimaryKeysFromGetPrimaryKeys, getRef, getSchemaCase, getSchemaNameForMetadata, getSchemaNameForMetadata, getSelectOperation, getSelects, getSelectTableAliases, getSequence, getSequences, getSequences, getShort, getString, getSupportsDelimitedIdentifiers, getSupportsXMLColumn, getTableNameForMetadata, getTableNameForMetadata, getTables, getTables, getTime, getTimestamp, getTrailingDelimiter, getTrimSchemaName, getTypeName, getTypeName, getUniqueConstraintSQL, getValidColumnName, getValidColumnName, getValidColumnName, getValidColumnName, getValidForeignKeyName, getValidForeignKeyName, getValidIndexName, getValidIndexName, getValidPrimaryKeyName, getValidSequenceName, getValidSequenceName, getValidTableName, getValidTableName, getValidUniqueName, getValidUniqueName, getVersionColumn, getVersionColumn, getWhere, getXMLTypeEncoding, handleWarning, insertSize, isImplicitJoin, isSelect, isSystemIndex, isSystemIndex, isSystemSequence, isSystemSequence, isSystemSequence, isSystemTable, isSystemTable, isUsingLimit, isUsingOffset, isUsingOrderBy, isUsingRange, makeNameValid, makeNameValid, makeNameValid, makeNameValid, matchErrorState, mathFunction, needsToCreateIndex, needsToCreateIndex, newColumn, newForeignKey, newIndex, newPrimaryKey, newSequence, newTable, prepareStatement, putBytes, putChars, putString, refSchemaComponents, serialize, setArray, setAsciiStream, setBatchLimit, setBigDecimal, setBigInteger, setBinaryStream, setBlob, setBlobObject, setBoolean, setBooleanRepresentation, setByte, setCalendar, setChar, setCharacterStream, setClob, setClobString, setConfiguration, setDate, setDateMillisecondBehavior, setDefaultSchemaName, setDelimitIdentifiers, setDouble, setFloat, setInt, setJoinSyntax, setLeadingDelimiter, setLocale, setLong, setMajorVersion, setMinorVersion, setNull, setNumber, setObject, setRef, setShort, setStatementQueryTimeout, setString, setSupportsDelimitedIdentifiers, setSupportsXMLColumn, setTime, setTimeouts, setTimeouts, setTimestamp, setTrailingDelimiter, setTrimSchemaName, setTyped, setUnknown, setUnknown, setXMLTypeEncoding, shorten, startConfiguration, storageWarning, supportsDeferredForeignKeyConstraints, supportsDeferredUniqueConstraints, supportsDeleteAction, supportsLocking, supportsUpdateAction, toBulkOperation, toDBName, toDBName, toDelete, toNativeJoin, toOperation, toOperation, toSelect, toSelect, toSelect, toSelect, toSelectCount, toSQL92Join, toTraditionalJoin, toUpdate, validateBatchProcess, validateDBSpecificBatchProcess, versionEqualOrEarlierThan, versionEqualOrLaterThan, versionLaterThan
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
public boolean appendExtendedExceptionText
public boolean supportsRowNum
ROWNUM
feature.
ROWNUM
feature is used to construct SQL SELECT
query
that uses an offset or limits the number of resultant rows.
false
.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.alias
- A SQLBuffer
or a String
to append.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 isDB2ISeriesV5R4OrEarlier()
public boolean isDB2UDBV81OrEarlier()
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
- typepublic int getBatchLimit()
getBatchLimit
in class DBDictionary
public String getCastFunction(Val val, String func)
getCastFunction
in class DBDictionary
val
- operand of castfunc
- original stringpublic String getCastFunction(Val val, String func, Column col)
getCastFunction
in class DBDictionary
val
- operand of castfunc
- original stringcol
- database columnpublic 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
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 millisecondsSQLException
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
public void insertBlobForStreamingLoad(Row row, Column col, JDBCStore store, Object ob, Select sel) throws SQLException
insertBlobForStreamingLoad
in class DBDictionary
SQLException
public void insertClobForStreamingLoad(Row row, Column col, Object ob) throws SQLException
insertClobForStreamingLoad
in class DBDictionary
SQLException
public void updateBlob(Select sel, JDBCStore store, InputStream is) throws SQLException
updateBlob
in class DBDictionary
SQLException
public void updateClob(Select sel, JDBCStore store, Reader reader) throws SQLException
updateClob
in class DBDictionary
SQLException
public void setDate(PreparedStatement stmnt, int idx, Date val, Column col) throws SQLException
setDate
in class DBDictionary
SQLException
public int getDB2MajorVersion()
public int getDB2MinorVersion()
public String getDefaultSchemaName()
getDefaultSchemaName
in class DBDictionary
protected SQLBuffer toSelect(SQLBuffer select, JDBCFetchConfiguration fetch, SQLBuffer tables, SQLBuffer where, SQLBuffer group, SQLBuffer having, SQLBuffer order, boolean distinct, boolean forUpdate, long start, long end, Select sel)
DBDictionary
toSelect
in class DBDictionary
Copyright © 2006–2017 Apache Software Foundation. All rights reserved.