Class SQLServerAdapter
java.lang.Object
org.apache.cayenne.dba.JdbcAdapter
org.apache.cayenne.dba.sqlserver.SQLServerAdapter
- All Implemented Interfaces:
DbAdapter
Cayenne DbAdapter implementation for Microsoft SQL Server RDBMS.
- Since:
- 1.1
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSQLServerAdapter(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 EJBQLTranslatorCreates and returns anEJBQLTranslatorused to generate visitors for EJBQL to SQL translations.protected NativeColumnType[]Returns the database-native types supported by this adapter.Returns aSQLServerPkGenerator.protected QuotingStrategyvoidcreateTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) Overrides super implementation to correctly set up identity columns.createUniqueConstraint(DbEntity source, Collection<DbAttribute> columns) Generates DDL to create unique index that allows multiple NULL values to comply with ANSI SQL, that is default behaviour for other RDBMS.Uses SQLServerActionBuilder to create the right action.Returns the word "go".voidsetVersion(Integer version) booleanNot supported, see: mssql-jdbc #245Methods inherited from class JdbcAdapter
bindParameter, bindParameter, buildAttribute, createFkConstraint, createTable, createTableAppendPKClause, defaultCharColumnLength, dropTableStatements, externalTypesForJdbcType, getEjbqlTranslator, getExtendedTypes, getProcedureTranslator, getQuotingStrategy, getQuotingStrategy, getSelectTranslator, getSQLLogger, getType, initExtendedTypes, nativeColumnTypes, setEjbqlTranslator, setEjbqlTranslatorFactory, setSupportsBatchUpdates, setSupportsGeneratedKeys, setSupportsUniqueConstraints, sizeAndPrecision, sizeAndScale, supportsBatchUpdates, supportsCatalogsOnReverseEngineering, supportsGeneratedKeys, supportsUniqueConstraints, tableTypeForTable, tableTypeForView, typeSupportsLength, typeSupportsScale, unwrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DbAdapter
getEjbqlTranslatorFactory, preferredBindingType, preferredNativeColumnType
-
Constructor Details
-
SQLServerAdapter
public SQLServerAdapter(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
-
createQuotingStrategy
- Overrides:
createQuotingStrategyin classJdbcAdapter
-
createEJBQLTranslator
Description copied from class:JdbcAdapterCreates and returns anEJBQLTranslatorused to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.- Overrides:
createEJBQLTranslatorin classJdbcAdapter
-
getBatchTerminator
Returns the word "go".- Specified by:
getBatchTerminatorin interfaceDbAdapter- Overrides:
getBatchTerminatorin classJdbcAdapter
-
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
-
createTableAppendColumn
Overrides super implementation to correctly set up identity columns.- Specified by:
createTableAppendColumnin interfaceDbAdapter- Overrides:
createTableAppendColumnin classJdbcAdapter- Parameters:
sqlBuffer- theStringBufferto append the column type tocolumn- theDbAttributedefining the column to append type for
-
supportsGeneratedKeysForBatchInserts
-
createPkGenerator
Returns aSQLServerPkGenerator.- 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
-
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
-
getAction
-
getSystemSchemas
- Specified by:
getSystemSchemasin interfaceDbAdapter- Overrides:
getSystemSchemasin classJdbcAdapter- Returns:
- list of system schemas
-
getSystemCatalogs
- Specified by:
getSystemCatalogsin interfaceDbAdapter- Overrides:
getSystemCatalogsin classJdbcAdapter- Returns:
- list of system catalogs
-
getVersion
-
setVersion
- Parameters:
version- of the server as provided by the JDBC driver- Since:
- 4.2
-
createUniqueConstraint
Generates DDL to create unique index that allows multiple NULL values to comply with ANSI SQL, that is default behaviour for other RDBMS.
Example:CREATE UNIQUE NONCLUSTERED INDEX _idx_entity_attribute ON entity(attribute) WHERE attribute IS NOT NULL- Specified by:
createUniqueConstraintin interfaceDbAdapter- Overrides:
createUniqueConstraintin classJdbcAdapter- Parameters:
source- entity for the indexcolumns- source columns for the index- Returns:
- DDL to create unique index
- Since:
- 4.2.1
-