public class DB2Platform extends DatabasePlatform
Purpose: Provides DB2 specific behaviour.
Responsibilities:
classTypes, cursorCode, fieldTypes, shouldBindAllParameters, shouldCacheAllStatements, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, stringBindingSize, supportsAutoCommit, transactionIsolation, usesByteArrayBinding, usesNativeSQL, usesStreamsForBinding, usesStringBinding
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultSequence, platformOperators, sequences, tableQualifier, timestampQuery
Constructor and Description |
---|
DB2Platform() |
Modifier and Type | Method and Description |
---|---|
protected void |
appendByteArray(byte[] bytes,
java.io.Writer writer)
INTERNAL:
Append a byte[] in native DB@ format BLOB(hexString) if usesNativeSQL(),
otherwise use ODBC format from DatabasePLatform.
|
protected void |
appendCalendar(java.util.Calendar calendar,
java.io.Writer writer)
INTERNAL:
Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.
|
protected void |
appendDate(java.sql.Date date,
java.io.Writer writer)
INTERNAL:
Appends the Date in native format if usesNativeSQL() otherwise use ODBC format from DatabasePlatform.
|
protected void |
appendDB2Calendar(java.util.Calendar calendar,
java.io.Writer writer)
INTERNAL:
Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).
|
protected void |
appendDB2Date(java.sql.Date date,
java.io.Writer writer)
INTERNAL:
Write a timestamp in DB2 specific format (mm/dd/yyyy).
|
protected void |
appendDB2Timestamp(java.sql.Timestamp timestamp,
java.io.Writer writer)
INTERNAL:
Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).
|
protected void |
appendTime(java.sql.Time time,
java.io.Writer writer)
INTERNAL:
Append the Time in Native format if usesNativeSQL() otherwise use ODBC format from DAtabasePlatform.
|
protected void |
appendTimestamp(java.sql.Timestamp timestamp,
java.io.Writer writer)
INTERNAL:
Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.
|
protected java.util.Hashtable |
buildFieldTypes()
Return the mapping of class types to database types for the schema framework.
|
ValueReadQuery |
buildSelectQueryForNativeSequence()
INTERNAL:
Build the identity query for native sequencing.
|
protected java.lang.String |
getCreateTempTableSqlBodyForTable(DatabaseTable table)
INTERNAL:
|
protected java.lang.String |
getCreateTempTableSqlPrefix()
INTERNAL:
|
protected java.lang.String |
getCreateTempTableSqlSuffix()
INTERNAL:
|
int |
getMaxFieldNameSize()
INTERNAL:
returns the maximum number of characters that can be used in a field
name on this platform.
|
int |
getMaxForeignKeyNameSize()
INTERNAL:
returns the maximum number of characters that can be used in a foreign key
name on this platform.
|
java.util.Vector |
getNativeTableInfo(java.lang.String table,
java.lang.String creator,
AbstractSession session)
INTERNAL:
Return the catalog information through using the native SQL catalog selects.
|
java.lang.String |
getProcedureAsString()
INTERNAL:
Used for stored procedure defs.
|
java.lang.String |
getProcedureBeginString()
INTERNAL:
Used for stored procedure defs.
|
java.lang.String |
getProcedureCallHeader()
INTERNAL:
Used for sp calls.
|
java.lang.String |
getProcedureEndString()
INTERNAL:
Used for stored procedure defs.
|
java.lang.String |
getSelectForUpdateString()
INTERNAL:
|
DatabaseTable |
getTempTableForTable(DatabaseTable table)
INTERNAL:
|
ValueReadQuery |
getTimestampQuery()
INTERNAL:
This method returns the query to select the timestamp
from the server for DB2.
|
protected void |
initializePlatformOperators()
INTERNAL:
Initialize any platform-specific operators
|
boolean |
isDB2() |
boolean |
isNullAllowedInSelectClause()
INTERNAL:
Override this if the platform cannot handle NULL in select clause.
|
java.util.Hashtable |
maximumNumericValues()
INTERNAL:
Builds a table of maximum numeric values keyed on java class.
|
java.util.Hashtable |
minimumNumericValues()
INTERNAL:
Builds a table of minimum numeric values keyed on java class.
|
void |
printFieldIdentityClause(java.io.Writer writer)
INTERNAL:
Append the receiver's field 'identity' constraint clause to a writer
|
boolean |
shouldBindLiterals()
INTERNAL
Allows platform to choose whether to bind literals in DatabaseCalls or not.
|
boolean |
shouldIgnoreException(java.sql.SQLException exception)
INTERNAL:
Allow for the platform to ignore exceptions.
|
boolean |
shouldNativeSequenceAcquireValueAfterInsert()
INTERNAL:
If native sequencing is being used on DB2 then the values must be
retrieved after the insert.
|
boolean |
shouldPrintOutputTokenAtStart()
INTERNAL:
This is required in the construction of the stored procedures with
output parameters
|
boolean |
shouldUseJDBCOuterJoinSyntax()
INTERNAL:
JDBC defines and outer join syntax, many drivers do not support this.
|
boolean |
supportsGlobalTempTables()
INTERNAL:
|
boolean |
supportsNativeSequenceNumbers()
Return true if the receiver uses host sequence numbers, generated on the database.
|
void |
writeParameterMarker(java.io.Writer writer,
ParameterExpression parameter) |
allowsSizeInProcedureArguments, appendBoolean, appendLiteralToCall, appendLiteralToCallWithBinding, appendNumber, appendParameter, appendParameterInternal, appendString, autoCommit, beginTransaction, buildCallWithReturning, buildClassTypes, buildSelectQueryForNativeSequence, canBuildCallWithReturning, commitTransaction, convertToDatabaseType, copyInto, createPlatformDefaultSequence, dontBindUpdateAllQueryUsingTempTables, executeStoredProcedure, getAssignmentString, getBatchBeginString, getBatchDelimiterString, getBatchEndString, getClassTypes, getConstraintDeletionString, getCreateViewString, getCreationInOutputProcedureToken, getCreationOutputProcedureToken, getCursorCode, getFieldTypeDefinition, getFieldTypes, getFunctionCallHeader, getInOutputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCType, getJdbcTypeName, getMaxUniqueKeyNameSize, getObjectFromResultSet, getOutputProcedureToken, getProcedureArgumentSetter, getProcedureArgumentString, getProcedureCallTail, getQualifiedSequenceTableName, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getTransactionIsolation, isInformixOuterJoin, printFieldIdentityClause, printFieldNotNullClause, printFieldNullClause, printFieldTypeSize, printFieldUnique, printValuelist, printValuelist, processResultSet, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTypeNameToRegisterOutputParameter, rollbackTransaction, setClassTypes, setCursorCode, setFieldTypes, setParameterValueInDatabaseCall, setParameterValueInDatabaseCall, setParameterValueInDatabaseCall, setPrimitiveParameterValue, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldCacheAllStatements, setShouldForceFieldNamesToUpperCase, setShouldIgnoreCaseOnFieldComparisons, setShouldOptimizeDataConversion, setShouldTrimStrings, setStatementCacheSize, setStringBindingSize, setSupportsAutoCommit, setTransactionIsolation, setUsesByteArrayBinding, setUsesNativeSQL, setUsesStreamsForBinding, setUsesStringBinding, shouldAcquireSequenceValueAfterInsert, shouldAlwaysUseTempStorageForModifyAll, shouldBindAllParameters, shouldCacheAllStatements, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldNativeSequenceUseTransaction, shouldOptimizeDataConversion, shouldPrintConstraintNameAfter, shouldPrintInOutputTokenBeforeType, shouldPrintOuterJoinInWhereClause, shouldPrintOutputTokenBeforeType, shouldTempTableSpecifyPrimaryKeys, shouldTrimStrings, supportsAutoCommit, supportsForeignKeyConstraints, supportsLocalTempTables, supportsPrimaryKeyConstraint, supportsStoredFunctions, supportsTempTables, supportsUniqueKeyConstraints, usesByteArrayBinding, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDeleteFromTargetTableUsingTempTableSql, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeUpdateOriginalFromTempTableSql
addOperator, addSequence, clone, convertObject, createSequences, getConversionManager, getCustomModifyValueForCall, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultSequence, getDefaultSequenceToWrite, getOperator, getPlatformOperators, getSequence, getSequences, getSequencesToWrite, getTableQualifier, getTimestampFromServer, hasDefaultSequence, isAccess, isAttunity, isCloudscape, isDBase, isDerby, isHSQL, isInformix, isMySQL, isODBC, isOracle, isPointBase, isPostgreSQL, isSQLAnywhere, isSQLServer, isSybase, isTimesTen, platformSpecificSequencingInitialization, removeAllSequences, removeSequence, sequencesAfterCloneCleanup, setConversionManager, setDefaultSequence, setSequences, setTableQualifier, setTimestampQuery, shouldUseCustomModifyForCall, toString, usesPlatformDefaultSequence
protected void appendByteArray(byte[] bytes, java.io.Writer writer) throws java.io.IOException
appendByteArray
in class DatabasePlatform
java.io.IOException
protected void appendDate(java.sql.Date date, java.io.Writer writer) throws java.io.IOException
appendDate
in class DatabasePlatform
java.io.IOException
protected void appendDB2Date(java.sql.Date date, java.io.Writer writer) throws java.io.IOException
java.io.IOException
protected void appendDB2Timestamp(java.sql.Timestamp timestamp, java.io.Writer writer) throws java.io.IOException
java.io.IOException
protected void appendDB2Calendar(java.util.Calendar calendar, java.io.Writer writer) throws java.io.IOException
java.io.IOException
protected void appendTime(java.sql.Time time, java.io.Writer writer) throws java.io.IOException
appendTime
in class DatabasePlatform
java.io.IOException
protected void appendTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer) throws java.io.IOException
appendTimestamp
in class DatabasePlatform
java.io.IOException
protected void appendCalendar(java.util.Calendar calendar, java.io.Writer writer) throws java.io.IOException
appendCalendar
in class DatabasePlatform
java.io.IOException
protected java.util.Hashtable buildFieldTypes()
DatabasePlatform
buildFieldTypes
in class DatabasePlatform
public int getMaxFieldNameSize()
getMaxFieldNameSize
in class DatabasePlatform
public int getMaxForeignKeyNameSize()
getMaxForeignKeyNameSize
in class DatabasePlatform
public java.util.Vector getNativeTableInfo(java.lang.String table, java.lang.String creator, AbstractSession session)
public java.lang.String getProcedureCallHeader()
getProcedureCallHeader
in class DatabasePlatform
public java.lang.String getSelectForUpdateString()
getSelectForUpdateString
in class DatabasePlatform
public java.lang.String getProcedureEndString()
getProcedureEndString
in class DatabasePlatform
public java.lang.String getProcedureBeginString()
getProcedureBeginString
in class DatabasePlatform
public java.lang.String getProcedureAsString()
getProcedureAsString
in class DatabasePlatform
public boolean shouldPrintOutputTokenAtStart()
shouldPrintOutputTokenAtStart
in class DatabasePlatform
public ValueReadQuery getTimestampQuery()
getTimestampQuery
in interface Platform
getTimestampQuery
in class DatasourcePlatform
protected void initializePlatformOperators()
initializePlatformOperators
in class DatasourcePlatform
public boolean isDB2()
isDB2
in interface Platform
isDB2
in class DatasourcePlatform
public java.util.Hashtable maximumNumericValues()
NOTE: BigInteger & BigDecimal maximums are dependent upon their precision & Scale
maximumNumericValues
in class DatabasePlatform
public java.util.Hashtable minimumNumericValues()
NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale
minimumNumericValues
in class DatabasePlatform
public boolean shouldIgnoreException(java.sql.SQLException exception)
shouldIgnoreException
in class DatabasePlatform
public boolean shouldUseJDBCOuterJoinSyntax()
shouldUseJDBCOuterJoinSyntax
in class DatabasePlatform
public ValueReadQuery buildSelectQueryForNativeSequence()
buildSelectQueryForNativeSequence
in class DatabasePlatform
public void printFieldIdentityClause(java.io.Writer writer) throws ValidationException
printFieldIdentityClause
in class DatabasePlatform
ValidationException
public boolean shouldNativeSequenceAcquireValueAfterInsert()
shouldNativeSequenceAcquireValueAfterInsert
in class DatabasePlatform
public boolean supportsNativeSequenceNumbers()
supportsNativeSequenceNumbers
in class DatabasePlatform
public boolean supportsGlobalTempTables()
supportsGlobalTempTables
in class DatabasePlatform
protected java.lang.String getCreateTempTableSqlPrefix()
getCreateTempTableSqlPrefix
in class DatabasePlatform
public DatabaseTable getTempTableForTable(DatabaseTable table)
getTempTableForTable
in class DatabasePlatform
protected java.lang.String getCreateTempTableSqlSuffix()
getCreateTempTableSqlSuffix
in class DatabasePlatform
protected java.lang.String getCreateTempTableSqlBodyForTable(DatabaseTable table)
getCreateTempTableSqlBodyForTable
in class DatabasePlatform
public boolean isNullAllowedInSelectClause()
isNullAllowedInSelectClause
in class DatabasePlatform
public void writeParameterMarker(java.io.Writer writer, ParameterExpression parameter) throws java.io.IOException
writeParameterMarker
in class DatabasePlatform
java.io.IOException
public boolean shouldBindLiterals()
shouldBindLiterals
in class DatabasePlatform