Class DB2Adapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.db2.DB2Adapter
- All Implemented Interfaces:
DbAdapter
DbAdapter implementation for the DB2 RDBMS.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDB2Adapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbind(PreparedStatement statement, Object value, int psPosition, int psType, int psScale, ExtendedType binder) Binds a raw value to a statement parameter.protected voidCalled fromJdbcAdapter.initExtendedTypes(List, List, List, ValueObjectTypeRegistry)to load adapter-specific types into the ExtendedTypeMap right after the default types are loaded, but before the DI overrides are.protected NativeColumnType[]Returns the database-native types supported by this adapter.Returns aDB2PkGenerator.voidcreateTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) Appends SQL for column creation to CREATE TABLE buffer.Uses special action builder to create the right action.Returns theEJBQLTranslatorfor EJBQL to SQL translation.intpreferredBindingType(int jdbcType) Returns the JDBC type that this adapter prefers to bind for a given mapped JDBC type.booleantypeSupportsLength(int type) Returns true if supplied type can have a length attribute as a part of column definitionbooleantypeSupportsScale(int type) Returns true if supplied type can have a scale attribute as a part of column definition.Methods inherited from class JdbcAdapter
bindParameter, bindParameter, buildAttribute, createEJBQLTranslator, createFkConstraint, createQuotingStrategy, createTable, createTableAppendPKClause, createUniqueConstraint, defaultCharColumnLength, dropTableStatements, externalTypesForJdbcType, getBatchTerminator, getExtendedTypes, getProcedureTranslator, getQuotingStrategy, getQuotingStrategy, getSelectTranslator, getSQLLogger, getSystemCatalogs, getSystemSchemas, getType, initExtendedTypes, nativeColumnTypes, setEjbqlTranslator, setEjbqlTranslatorFactory, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, sizeAndScale, supportsBatchUpdates, supportsCatalogsOnReverseEngineering, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, unwrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DbAdapter
getEjbqlTranslatorFactory, preferredNativeColumnType, supportsGeneratedKeysForBatchInserts
-
Constructor Details
-
DB2Adapter
public DB2Adapter(RuntimeProperties runtimeProperties, List<ExtendedType> defaultExtendedTypes, List<ExtendedType> userExtendedTypes, List<ExtendedTypeFactory> extendedTypeFactories, ValueObjectTypeRegistry valueObjectTypeRegistry)
-
-
Method Details
-
createNativeTypes
Description copied from class:JdbcAdapterReturns the database-native types supported by this adapter.- Overrides:
createNativeTypesin classJdbcAdapter
-
configureExtendedTypes
Description copied from class:JdbcAdapterCalled fromJdbcAdapter.initExtendedTypes(List, List, List, ValueObjectTypeRegistry)to load adapter-specific types into the ExtendedTypeMap right after the default types are loaded, but before the DI overrides are. This method has specific implementations in JdbcAdapter subclasses.- Overrides:
configureExtendedTypesin classJdbcAdapter
-
createTableAppendColumn
Description copied from class:JdbcAdapterAppends SQL for column creation to CREATE TABLE buffer.- Specified by:
createTableAppendColumnin interfaceDbAdapter- Overrides:
createTableAppendColumnin classJdbcAdapter- Parameters:
sqlBuffer- theStringBufferto append the column type tocolumn- theDbAttributedefining the column to append type for- Since:
- 4.0
-
typeSupportsLength
public boolean typeSupportsLength(int type) Description copied from class:JdbcAdapterReturns true if supplied type can have a length attribute as a part of column definition- Specified by:
typeSupportsLengthin interfaceDbAdapter- Overrides:
typeSupportsLengthin classJdbcAdapter- Since:
- 4.0
-
typeSupportsScale
public boolean typeSupportsScale(int type) Description copied from class:JdbcAdapterReturns true if supplied type can have a scale attribute as a part of column definition.- Specified by:
typeSupportsScalein interfaceDbAdapter- Overrides:
typeSupportsScalein classJdbcAdapter- Parameters:
type- sql type code- Returns:
trueif a given type supports scale- Since:
- 5.0
-
createPkGenerator
Returns aDB2PkGenerator.- Specified by:
createPkGeneratorin interfaceDbAdapter- Overrides:
createPkGeneratorin classJdbcAdapter
-
getSqlTreeProcessor
- Specified by:
getSqlTreeProcessorin interfaceDbAdapter- Overrides:
getSqlTreeProcessorin classJdbcAdapter- Returns:
SQLTreeProcessorthat can adjust SQL tree to specific database flavour- Since:
- 4.2
-
getEjbqlTranslator
Description copied from class:JdbcAdapterReturns theEJBQLTranslatorfor EJBQL to SQL translation. It is normally initialized in the constructor by callingJdbcAdapter.createEJBQLTranslator(), and can be changed later by callingJdbcAdapter.setEjbqlTranslator(EJBQLTranslator).- Specified by:
getEjbqlTranslatorin interfaceDbAdapter- Overrides:
getEjbqlTranslatorin classJdbcAdapter- Since:
- 5.0
-
bind
protected void bind(PreparedStatement statement, Object value, int psPosition, int psType, int psScale, ExtendedType binder) throws Exception Description copied from class:JdbcAdapterBinds a raw value to a statement parameter. This is the single extension point shared by bothbindParameteroverloads; adapters that need database-specific handling (e.g. of NULLs) should override this method rather than the public overloads.- Overrides:
bindin classJdbcAdapter- Throws:
Exception
-
getAction
-
preferredBindingType
public int preferredBindingType(int jdbcType) Description copied from interface:DbAdapterReturns the JDBC type that this adapter prefers to bind for a given mapped JDBC type. The default implementation is an identity function; adapters whose drivers require a different type (e.g. remapping theN*character types to their non-national counterparts) override this. The returned type is resolved into thePSParameterat binding creation time, so it matches the type actually sent to the PreparedStatement.- Since:
- 5.0
-