EclipseLink 1.2.0, build 'v20091016-r5565' API Reference

org.eclipse.persistence.platform.database
Class DB2Platform

java.lang.Object
  extended by org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
      extended by org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
          extended by org.eclipse.persistence.platform.database.DatabasePlatform
              extended by org.eclipse.persistence.platform.database.DB2Platform
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.eclipse.persistence.internal.databaseaccess.Platform
Direct Known Subclasses:
DB2MainframePlatform, DerbyPlatform

public class DB2Platform
extends DatabasePlatform

Purpose: Provides DB2 specific behavior.

Responsibilities:

See Also:
Serialized Form
Since:
TOPLink/Java 1.0

Field Summary
 
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
castSizeForVarcharParameter, classTypes, cursorCode, DEFAULT_MAX_BATCH_WRITING_SIZE, DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE, fieldTypes, maxBatchWritingSize, pingSQL, printOuterJoinInWhereClause, shouldBindAllParameters, shouldCacheAllStatements, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, stringBindingSize, structConverters, supportsAutoCommit, transactionIsolation, typeConverters, Types_NCLOB, useRownumFiltering, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesStreamsForBinding, usesStringBinding
 
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultSequence, endDelimiter, platformOperators, sequences, startDelimiter, tableQualifier, timestampQuery
 
Constructor Summary
DB2Platform()
           
 
Method Summary
protected  void appendByteArray(byte[] bytes, java.io.Writer writer)
          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)
          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)
          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)
          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)
          Write a timestamp in DB2 specific format (mm/dd/yyyy).
protected  void appendDB2Timestamp(java.sql.Timestamp timestamp, java.io.Writer writer)
          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)
          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)
          Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform.
protected  java.util.Hashtable buildFieldTypes()
           
 ValueReadQuery buildSelectQueryForIdentity()
          INTERNAL: Build the identity query for native sequencing.
 boolean dontBindUpdateAllQueryUsingTempTables()
          INTERNAL:
protected  java.lang.String getCreateTempTableSqlBodyForTable(org.eclipse.persistence.internal.helper.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, org.eclipse.persistence.internal.sessions.AbstractSession session)
          Return the catalog information through using the native SQL catalog selects.
 java.lang.String getProcedureAsString()
          Used for stored procedure defs.
 java.lang.String getProcedureBeginString()
          Used for stored procedure defs.
 java.lang.String getProcedureCallHeader()
          Used for sp calls.
 java.lang.String getProcedureEndString()
          Used for stored procedure defs.
 java.lang.String getSelectForUpdateString()
           
 org.eclipse.persistence.internal.helper.DatabaseTable getTempTableForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
          INTERNAL:
 ValueReadQuery getTimestampQuery()
          This method returns the query to select the timestamp from the server for DB2.
protected  void initializePlatformOperators()
          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()
          Builds a table of maximum numeric values keyed on java class.
 java.util.Hashtable minimumNumericValues()
          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)
          Allow for the platform to ignore exceptions.
 boolean shouldPrintOutputTokenAtStart()
          This is required in the construction of the stored procedures with output parameters
 boolean shouldUseJDBCOuterJoinSyntax()
          JDBC defines and outer join syntax, many drivers do not support this.
 boolean supportsGlobalTempTables()
          INTERNAL:
 boolean supportsIdentity()
          INTERNAL: Indicates whether the platform supports identity.
 boolean supportsLockingQueriesWithMultipleTables()
          INTERNAL: Indicates whether locking clause could be applied to the query that has more than one table
 void writeParameterMarker(java.io.Writer writer, org.eclipse.persistence.internal.expressions.ParameterExpression parameter)
           
 
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
addBatch, addStructConverter, allowsSizeInProcedureArguments, appendBoolean, appendLiteralToCall, appendLiteralToCallWithBinding, appendNumber, appendParameter, appendParameterInternal, appendString, autoCommit, beginTransaction, buildCallWithReturning, buildClassTypes, buildProcedureCallString, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, buildSelectQueryForSequenceObject, buildSequenceObjectAlterIncrementWriter, buildSequenceObjectCreationWriter, buildSequenceObjectDeletionWriter, canBuildCallWithReturning, commitTransaction, computeMaxRowsForSQL, convertToDatabaseType, copyInto, createArray, createArray, createPlatformDefaultSequence, createStruct, createStruct, executeBatch, executeStoredProcedure, getAssignmentString, getBatchBeginString, getBatchDelimiterString, getBatchEndString, getCastSizeForVarcharParameter, getClassTypes, getConnection, getConstraintDeletionString, getCreateViewString, getCreationInOutputProcedureToken, getCreationOutputProcedureToken, getCursorCode, getCustomModifyValueForCall, getFieldTypeDefinition, getFieldTypes, getFunctionCallHeader, getIdentifierQuoteCharacter, getInOutputProcedureToken, getInputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCType, getJdbcTypeName, getMaxBatchWritingSize, getMaxUniqueKeyNameSize, getNoWaitString, getObjectFromResultSet, getOutputProcedureToken, getPingSQL, getProcedureArgumentSetter, getProcedureArgumentString, getProcedureCallTail, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTransactionIsolation, getTypeConverters, isAlterSequenceObjectSupported, isForUpdateCompatibleWithDistinct, isInformixOuterJoin, isLockTimeoutException, isXDBDocument, prepareBatchStatement, printFieldNotNullClause, printFieldNullClause, printFieldTypeSize, printFieldTypeSize, printFieldUnique, printFieldUnique, printSQLSelectStatement, printValuelist, printValuelist, processResultSet, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureBrackets, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTypeNameToRegisterOutputParameter, rollbackTransaction, setCastSizeForVarcharParameter, setClassTypes, setCursorCode, setFieldTypes, setMaxBatchWritingSize, setParameterValueInDatabaseCall, setPingSQL, setPrintOuterJoinInWhereClause, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldCacheAllStatements, setShouldForceFieldNamesToUpperCase, setShouldIgnoreCaseOnFieldComparisons, setShouldOptimizeDataConversion, setShouldTrimStrings, setShouldUseRownumFiltering, setStatementCacheSize, setStringBindingSize, setSupportsAutoCommit, setTransactionIsolation, setUsesBatchWriting, setUsesByteArrayBinding, setUsesJDBCBatchWriting, setUsesNativeBatchWriting, setUsesNativeSQL, setUsesStreamsForBinding, setUsesStringBinding, shouldAlwaysUseTempStorageForModifyAll, shouldBindAllParameters, shouldCacheAllStatements, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldNativeSequenceUseTransaction, shouldOptimizeDataConversion, shouldPrintAliasForUpdate, shouldPrintConstraintNameAfter, shouldPrintFieldIdentityClause, shouldPrintInOutputTokenBeforeType, shouldPrintInputTokenAtStart, shouldPrintLockingClauseAfterWhereClause, shouldPrintOuterJoinInWhereClause, shouldPrintOutputTokenBeforeType, shouldPrintStoredProcedureArgumentNameInCall, shouldPrintStoredProcedureVariablesAfterBeginString, shouldTempTableSpecifyPrimaryKeys, shouldTrimStrings, shouldUseCustomModifyForCall, shouldUseRownumFiltering, supportsAutoCommit, supportsForeignKeyConstraints, supportsIndividualTableLocking, supportsLocalTempTables, supportsNativeSequenceNumbers, supportsPrimaryKeyConstraint, supportsSequenceObjects, supportsStoredFunctions, supportsTempTables, supportsUniqueKeyConstraints, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDeleteFromTargetTableUsingTempTableSql, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeUpdateOriginalFromTempTableSql
 
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
addOperator, addSequence, clone, convertObject, createConnectionCustomizer, createSequences, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultSequence, getDefaultSequenceToWrite, getEndDelimiter, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, hasDefaultSequence, isAccess, isAttunity, isCloudscape, isDBase, isDerby, isHSQL, isInformix, isMySQL, isODBC, isOracle, isOracle9, isPointBase, isPostgreSQL, isSQLAnywhere, isSQLServer, isSybase, isTimesTen, isTimesTen7, removeAllSequences, removeSequence, sequencesAfterCloneCleanup, setConversionManager, setDefaultSequence, setEndDelimiter, setSelectSequenceNumberQuery, setSequencePreallocationSize, setSequences, setStartDelimiter, setTableQualifier, setTimestampQuery, setUpdateSequenceQuery, toString, usesPlatformDefaultSequence
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DB2Platform

public DB2Platform()
Method Detail

appendByteArray

protected void appendByteArray(byte[] bytes,
                               java.io.Writer writer)
                        throws java.io.IOException
Append a byte[] in native DB@ format BLOB(hexString) if usesNativeSQL(), otherwise use ODBC format from DatabasePLatform.

Overrides:
appendByteArray in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
java.io.IOException

appendDate

protected void appendDate(java.sql.Date date,
                          java.io.Writer writer)
                   throws java.io.IOException
Appends the Date in native format if usesNativeSQL() otherwise use ODBC format from DatabasePlatform. Native format: 'mm/dd/yyyy'

Overrides:
appendDate in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
java.io.IOException

appendDB2Date

protected void appendDB2Date(java.sql.Date date,
                             java.io.Writer writer)
                      throws java.io.IOException
Write a timestamp in DB2 specific format (mm/dd/yyyy).

Throws:
java.io.IOException

appendDB2Timestamp

protected void appendDB2Timestamp(java.sql.Timestamp timestamp,
                                  java.io.Writer writer)
                           throws java.io.IOException
Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).

Throws:
java.io.IOException

appendDB2Calendar

protected void appendDB2Calendar(java.util.Calendar calendar,
                                 java.io.Writer writer)
                          throws java.io.IOException
Write a timestamp in DB2 specific format (yyyy-mm-dd-hh.mm.ss.ffffff).

Throws:
java.io.IOException

appendTime

protected void appendTime(java.sql.Time time,
                          java.io.Writer writer)
                   throws java.io.IOException
Append the Time in Native format if usesNativeSQL() otherwise use ODBC format from DAtabasePlatform. Native Format: 'hh:mm:ss'

Overrides:
appendTime in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
java.io.IOException

appendTimestamp

protected void appendTimestamp(java.sql.Timestamp timestamp,
                               java.io.Writer writer)
                        throws java.io.IOException
Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform. Native format: 'YYYY-MM-DD-hh.mm.ss.SSSSSS'

Overrides:
appendTimestamp in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
java.io.IOException

appendCalendar

protected void appendCalendar(java.util.Calendar calendar,
                              java.io.Writer writer)
                       throws java.io.IOException
Append the Timestamp in native format if usesNativeSQL() is true otherwise use ODBC format from DatabasePlatform. Native format: 'YYYY-MM-DD-hh.mm.ss.SSSSSS'

Overrides:
appendCalendar in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
java.io.IOException

buildFieldTypes

protected java.util.Hashtable buildFieldTypes()
Overrides:
buildFieldTypes in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getMaxFieldNameSize

public int getMaxFieldNameSize()
INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.

Overrides:
getMaxFieldNameSize in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getMaxForeignKeyNameSize

public int getMaxForeignKeyNameSize()
INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.

Overrides:
getMaxForeignKeyNameSize in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getNativeTableInfo

public java.util.Vector getNativeTableInfo(java.lang.String table,
                                           java.lang.String creator,
                                           org.eclipse.persistence.internal.sessions.AbstractSession session)
Return the catalog information through using the native SQL catalog selects. This is required because many JDBC driver do not support meta-data. Willcards can be passed as arguments.


getProcedureCallHeader

public java.lang.String getProcedureCallHeader()
Used for sp calls.

Overrides:
getProcedureCallHeader in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getSelectForUpdateString

public java.lang.String getSelectForUpdateString()
Overrides:
getSelectForUpdateString in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getProcedureEndString

public java.lang.String getProcedureEndString()
Used for stored procedure defs.

Overrides:
getProcedureEndString in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getProcedureBeginString

public java.lang.String getProcedureBeginString()
Used for stored procedure defs.

Overrides:
getProcedureBeginString in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getProcedureAsString

public java.lang.String getProcedureAsString()
Used for stored procedure defs.

Overrides:
getProcedureAsString in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

shouldPrintOutputTokenAtStart

public boolean shouldPrintOutputTokenAtStart()
This is required in the construction of the stored procedures with output parameters

Overrides:
shouldPrintOutputTokenAtStart in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getTimestampQuery

public ValueReadQuery getTimestampQuery()
This method returns the query to select the timestamp from the server for DB2.

Specified by:
getTimestampQuery in interface org.eclipse.persistence.internal.databaseaccess.Platform
Overrides:
getTimestampQuery in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform

initializePlatformOperators

protected void initializePlatformOperators()
Initialize any platform-specific operators

Overrides:
initializePlatformOperators in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform

isDB2

public boolean isDB2()
Specified by:
isDB2 in interface org.eclipse.persistence.internal.databaseaccess.Platform
Overrides:
isDB2 in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform

maximumNumericValues

public java.util.Hashtable maximumNumericValues()
Builds a table of maximum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

NOTE: BigInteger & BigDecimal maximums are dependent upon their precision & Scale

Overrides:
maximumNumericValues in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

minimumNumericValues

public java.util.Hashtable minimumNumericValues()
Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale

Overrides:
minimumNumericValues in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

shouldIgnoreException

public boolean shouldIgnoreException(java.sql.SQLException exception)
Allow for the platform to ignore exceptions. This is required for DB2 which throws no-data modified as an exception.

Overrides:
shouldIgnoreException in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

shouldUseJDBCOuterJoinSyntax

public boolean shouldUseJDBCOuterJoinSyntax()
JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.

Overrides:
shouldUseJDBCOuterJoinSyntax in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

buildSelectQueryForIdentity

public ValueReadQuery buildSelectQueryForIdentity()
INTERNAL: Build the identity query for native sequencing.

Overrides:
buildSelectQueryForIdentity in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

printFieldIdentityClause

public void printFieldIdentityClause(java.io.Writer writer)
                              throws ValidationException
INTERNAL: Append the receiver's field 'identity' constraint clause to a writer

Overrides:
printFieldIdentityClause in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
ValidationException

supportsIdentity

public boolean supportsIdentity()
INTERNAL: Indicates whether the platform supports identity. DB2 does through AS IDENTITY field types. This method is to be used *ONLY* by sequencing classes

Overrides:
supportsIdentity in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

supportsGlobalTempTables

public boolean supportsGlobalTempTables()
INTERNAL:

Overrides:
supportsGlobalTempTables in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getCreateTempTableSqlPrefix

protected java.lang.String getCreateTempTableSqlPrefix()
INTERNAL:

Overrides:
getCreateTempTableSqlPrefix in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getTempTableForTable

public org.eclipse.persistence.internal.helper.DatabaseTable getTempTableForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL:

Overrides:
getTempTableForTable in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getCreateTempTableSqlSuffix

protected java.lang.String getCreateTempTableSqlSuffix()
INTERNAL:

Overrides:
getCreateTempTableSqlSuffix in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

getCreateTempTableSqlBodyForTable

protected java.lang.String getCreateTempTableSqlBodyForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL:

Overrides:
getCreateTempTableSqlBodyForTable in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

dontBindUpdateAllQueryUsingTempTables

public boolean dontBindUpdateAllQueryUsingTempTables()
INTERNAL:

Overrides:
dontBindUpdateAllQueryUsingTempTables in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

isNullAllowedInSelectClause

public boolean isNullAllowedInSelectClause()
INTERNAL: Override this if the platform cannot handle NULL in select clause.

Overrides:
isNullAllowedInSelectClause in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

writeParameterMarker

public void writeParameterMarker(java.io.Writer writer,
                                 org.eclipse.persistence.internal.expressions.ParameterExpression parameter)
                          throws java.io.IOException
Overrides:
writeParameterMarker in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Throws:
java.io.IOException

shouldBindLiterals

public boolean shouldBindLiterals()
INTERNAL Allows platform to choose whether to bind literals in DatabaseCalls or not.

Overrides:
shouldBindLiterals in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

supportsLockingQueriesWithMultipleTables

public boolean supportsLockingQueriesWithMultipleTables()
INTERNAL: Indicates whether locking clause could be applied to the query that has more than one table

Overrides:
supportsLockingQueriesWithMultipleTables in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform

EclipseLink 1.2.0, build 'v20091016-r5565' API Reference