|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.adapter.DatabaseAdapter
org.datanucleus.store.rdbms.adapter.MSSQLServerAdapter
public class MSSQLServerAdapter
Provides methods for adapting SQL language elements to the Microsoft SQL Server database.
DatabaseAdapter| Field Summary |
|---|
| Fields inherited from class org.datanucleus.store.rdbms.adapter.DatabaseAdapter |
|---|
catalogSeparator, datastoreMajorVersion, datastoreMinorVersion, datastoreProductName, datastoreProductVersion, datastoreRevisionVersion, driverMajorVersion, driverMinorVersion, driverName, driverVersion, identifierQuoteString, LOCALISER, LOCALISER_BASE, maxColumnNameLength, maxConstraintNameLength, maxIndexNameLength, maxTableNameLength, properties, reservedKeywords, supportedOptions |
| Fields inherited from interface org.datanucleus.store.mapped.DatastoreAdapter |
|---|
ANALYSIS_METHODS, BIT_IS_REALLY_BOOLEAN, BOOLEAN_COMPARISON, CATALOGS_IN_TABLE_DEFINITIONS, ESCAPE_EXPRESSION_IN_LIKE_PREDICATE, IDENTIFIERS_LOWERCASE, IDENTIFIERS_LOWERCASE_QUOTED, IDENTIFIERS_MIXEDCASE, IDENTIFIERS_MIXEDCASE_QUOTED, IDENTIFIERS_MIXEDCASE_QUOTED_SENSITIVE, IDENTIFIERS_MIXEDCASE_SENSITIVE, IDENTIFIERS_UPPERCASE, IDENTIFIERS_UPPERCASE_QUOTED, IDENTITY_COLUMNS, PROJECTION_IN_TABLE_REFERENCE_JOINS, SCHEMAS_IN_TABLE_DEFINITIONS, SEQUENCES |
| Constructor Summary | |
|---|---|
MSSQLServerAdapter(DatabaseMetaData metadata)
Constructs a Microsoft SQL Server adapter based on the given JDBC metadata. |
|
| Method Summary | |
|---|---|
String |
getAutoIncrementKeyword()
Accessor for the auto-increment keyword for generating DDLs (CREATE TABLEs...). |
String |
getAutoIncrementStmt(Table table,
String columnName)
Accessor for the auto-increment sql statement for this datastore. |
String |
getCatalogName(Connection conn)
Accessor for the catalog name. |
String |
getCreateIndexStatement(Index idx,
org.datanucleus.store.mapped.IdentifierFactory factory)
Returns the appropriate DDL to create an index. |
String |
getDropTableStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
Returns the appropriate SQL to drop the given table. |
String |
getInsertStatementForNoColumns(Table table)
Method to return the INSERT statement to use when inserting into a table that has no columns specified. |
String |
getNewUUIDFunction()
The function to creates a unique value of type uniqueidentifier. |
String |
getOperatorConcat()
An operator in a string expression that concatenates two or more character or binary strings, columns, or a combination of strings and column names into one expression (a string operator). |
String |
getSchemaName(Connection conn)
Accessor for the Schema Name for this datastore. |
String |
getSelectNewUUIDStmt()
The function to creates a unique value of type uniqueidentifier. |
String |
getSelectWithLockOption()
The option to specify in "SELECT ... |
String |
getVendorID()
|
void |
initialiseTypes(org.datanucleus.store.schema.StoreSchemaHandler handler,
org.datanucleus.store.connection.ManagedConnection mconn)
Initialise the types for this datastore. |
boolean |
isIdentityFieldDataType(String columnDef)
Verifies if the given columnDef is auto incremented by the datastore. |
boolean |
isReservedKeyword(String word)
Tests if a given string is a SQL keyword. |
boolean |
isStatementTimeout(SQLException sqle)
return whether this exception represents a timed out statement. |
RDBMSColumnInfo |
newRDBMSColumnInfo(ResultSet rs)
Method to create a column info for the current row. |
SQLTypeInfo |
newSQLTypeInfo(ResultSet rs)
Create a new SQL type info from the current row of the passed ResultSet. |
boolean |
supportsQueryFetchSize(int size)
Whether the datastore will support setting the query fetch size to the supplied value. |
boolean |
validToSelectMappingInStatement(SQLStatement stmt,
org.datanucleus.store.mapped.mapping.JavaTypeMapping m)
Method to return if it is valid to select the specified mapping for the specified statement for this datastore adapter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MSSQLServerAdapter(DatabaseMetaData metadata)
metadata - the database metadata.| Method Detail |
|---|
public void initialiseTypes(org.datanucleus.store.schema.StoreSchemaHandler handler,
org.datanucleus.store.connection.ManagedConnection mconn)
initialiseTypes in interface org.datanucleus.store.mapped.DatastoreAdapterinitialiseTypes in class DatabaseAdapterhandler - SchemaHandler that we initialise the types formconn - Managed connection to usepublic String getVendorID()
getVendorID in interface org.datanucleus.store.mapped.DatastoreAdaptergetVendorID in class DatabaseAdapter
public String getCatalogName(Connection conn)
throws SQLException
getCatalogName in interface RDBMSAdaptergetCatalogName in class DatabaseAdapterconn - The Connection to use
SQLException
public String getSchemaName(Connection conn)
throws SQLException
DatabaseAdapter
getSchemaName in interface RDBMSAdaptergetSchemaName in class DatabaseAdapterconn - Connection to the datastore
SQLException - Thrown if error occurs in determining the schema name.public boolean isReservedKeyword(String word)
DatabaseAdapter
The list of key words tested against is defined to contain all SQL/92 keywords, plus any additional
key words reported by the JDBC driver for this adapter via DatabaseMetaData.getSQLKeywords().
In general, use of a SQL key word as an identifier should be avoided. SQL/92 key words are divided into reserved and non-reserved words. If a reserved word is used as an identifier it must be quoted with double quotes. Strictly speaking, the same is not true of non-reserved words. However, as C.J. Date writes in A Guide To The SQL Standard :
The rule by which it is determined within the standard that one key word needs to be reserved while another need not is not clear to this writer. In practice, it is probably wise to treat all key words as reserved.
isReservedKeyword in interface org.datanucleus.store.mapped.DatastoreAdapterisReservedKeyword in class DatabaseAdapterword - The word to test.
true if word is a SQL key word for this DBMS.
The comparison is case-insensitive.SQLConstants
public String getCreateIndexStatement(Index idx,
org.datanucleus.store.mapped.IdentifierFactory factory)
getCreateIndexStatement in interface RDBMSAdaptergetCreateIndexStatement in class DatabaseAdapteridx - An object describing the index.factory - Identifier factory
public String getSelectNewUUIDStmt()
getSelectNewUUIDStmt in interface RDBMSAdaptergetSelectNewUUIDStmt in class DatabaseAdapterpublic String getNewUUIDFunction()
getNewUUIDFunction in class DatabaseAdapterpublic boolean supportsQueryFetchSize(int size)
supportsQueryFetchSize in interface org.datanucleus.store.mapped.DatastoreAdaptersupportsQueryFetchSize in class DatabaseAdaptersize - The value to set to
public RDBMSColumnInfo newRDBMSColumnInfo(ResultSet rs)
newRDBMSColumnInfo in interface RDBMSAdapternewRDBMSColumnInfo in class DatabaseAdapterrs - ResultSet from DatabaseMetaData.getColumns()
public SQLTypeInfo newSQLTypeInfo(ResultSet rs)
RDBMSAdapter
newSQLTypeInfo in interface RDBMSAdapternewSQLTypeInfo in class DatabaseAdapterrs - ResultSet
public String getDropTableStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
DatabaseAdapter
DROP TABLE FOO CASCADE
getDropTableStatement in interface RDBMSAdaptergetDropTableStatement in class DatabaseAdaptertable - The table to drop.
public String getAutoIncrementStmt(Table table,
String columnName)
getAutoIncrementStmt in interface RDBMSAdaptergetAutoIncrementStmt in class DatabaseAdaptertable - Name of the table that the autoincrement is forcolumnName - Name of the column that the autoincrement is for
public String getAutoIncrementKeyword()
getAutoIncrementKeyword in interface RDBMSAdaptergetAutoIncrementKeyword in class DatabaseAdapterpublic boolean isIdentityFieldDataType(String columnDef)
columnDef is auto incremented by the datastore.
isIdentityFieldDataType in interface org.datanucleus.store.mapped.DatastoreAdapterisIdentityFieldDataType in class DatabaseAdaptercolumnDef - the datastore type name
columnDef has values auto incremented by the datastorepublic String getInsertStatementForNoColumns(Table table)
getInsertStatementForNoColumns in interface RDBMSAdaptergetInsertStatementForNoColumns in class DatabaseAdaptertable - The table
public String getOperatorConcat()
getOperatorConcat in class DatabaseAdapterpublic String getSelectWithLockOption()
DatabaseAdapter
getSelectWithLockOption in interface RDBMSAdaptergetSelectWithLockOption in class DatabaseAdapter
public boolean validToSelectMappingInStatement(SQLStatement stmt,
org.datanucleus.store.mapped.mapping.JavaTypeMapping m)
validToSelectMappingInStatement in interface RDBMSAdaptervalidToSelectMappingInStatement in class DatabaseAdapterstmt - The statementm - The mapping that we want to select
public boolean isStatementTimeout(SQLException sqle)
DatabaseAdapter
isStatementTimeout in interface RDBMSAdapterisStatementTimeout in class DatabaseAdaptersqle - the exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||