org.datanucleus.store.rdbms.adapter
Interface RDBMSAdapter

All Superinterfaces:
org.datanucleus.store.mapped.DatastoreAdapter, org.datanucleus.store.mapped.expression.ExpressionConversionAdapter, org.datanucleus.store.mapped.expression.ExpressionLogicSetAdapter, org.datanucleus.store.mapped.expression.ExpressionMethodAdapter, org.datanucleus.store.mapped.expression.ExpressionOperatorAdapter, org.datanucleus.store.mapped.expression.ExpressionPatternAdapter
All Known Implementing Classes:
DatabaseAdapter, DB2Adapter, DB2AS400Adapter, DerbyAdapter, FirebirdAdapter, H2Adapter, HSQLAdapter, InformixAdapter, McKoiAdapter, MSSQLServerAdapter, MySQLAdapter, OracleAdapter, PointbaseAdapter, PostgreSQLAdapter, SAPDBAdapter, SybaseAdapter

public interface RDBMSAdapter
extends org.datanucleus.store.mapped.DatastoreAdapter

Adapter for relational databases.


Field Summary
static java.lang.String ACCESS_PARENTQUERY_IN_SUBQUERY
          Whether this database supports joining outer and inner queries using columns.
static java.lang.String ALTER_TABLE_DROP_CONSTRAINT_SYNTAX
          Whether this datastore supports ALTER TABLE DROP constraints
static java.lang.String ALTER_TABLE_DROP_FOREIGN_KEY_CONSTRAINT
          Whether this datastore supports ALTER TABLE DROP FOREIGN KEY constraints
static java.lang.String ANSI_JOIN_SYNTAX
          Accessor for whether the RDBMS supports ANSI join syntax.
static java.lang.String AUTO_INCREMENT_COLUMN_TYPE_SPECIFICATION
          Whether we support auto-increment/identity keys with column type specification.
static java.lang.String AUTO_INCREMENT_KEYS_NULL_SPECIFICATION
          Whether we support auto-increment/identity keys with nullability specification.
static java.lang.String BLOB_SET_USING_SETSTRING
          Accessor for whether setting a BLOB value allows use of PreparedStatement.setString()
static java.lang.String CHAR_COLUMNS_PADDED_WITH_SPACES
          Some databases store character strings in CHAR(XX) columns and when read back in have been padded with spaces.
static java.lang.String CHECK_IN_CREATE_STATEMENTS
          Whether this datastore supports the use of "CHECK" in CREATE TABLE statements (DDL).
static java.lang.String CHECK_IN_END_CREATE_STATEMENTS
          Whether this datastore supports the use of CHECK after the column definitions in the CREATE TABLE statements (DDL).
static java.lang.String CLOB_SET_USING_SETSTRING
          Accessor for whether setting a CLOB value allows use of PreparedStatement.setString()
static java.lang.String CREATE_INDEXES_BEFORE_FOREIGN_KEYS
          Whether to create indexes before foreign keys.
static java.lang.String DATETIME_STORES_MILLISECS
          Whether DATETIME stores milliseconds.
static java.lang.String DEFAULT_BEFORE_NULL_IN_COLUMN_OPTIONS
          Whether any DEFAULT tag will be before any NULL/NOT NULL in the column options.
static java.lang.String DEFAULT_KEYWORD_IN_COLUMN_OPTIONS
          Whether we support DEFAULT tag in CREATE TABLE statements
static java.lang.String DEFAULT_KEYWORD_WITH_NOT_NULL_IN_COLUMN_OPTIONS
          Whether we support DEFAULT tag together with NOT NULL in CREATE TABLE statements.
static java.lang.String DEFERRED_CONSTRAINTS
          Whether this datastore supports deferred constraints.
static java.lang.String DISTINCT_WITH_SELECT_FOR_UPDATE
          Whether this datastore supports using DISTINCT when using SELECT ...
static java.lang.String EXISTS_SYNTAX
          Whether the RDBMS supports use of EXISTS syntax.
static java.lang.String FK_DELETE_ACTION_CASCADE
           
static java.lang.String FK_DELETE_ACTION_DEFAULT
           
static java.lang.String FK_DELETE_ACTION_NULL
           
static java.lang.String FK_DELETE_ACTION_RESTRICT
           
static java.lang.String FK_UPDATE_ACTION_CASCADE
           
static java.lang.String FK_UPDATE_ACTION_DEFAULT
           
static java.lang.String FK_UPDATE_ACTION_NULL
           
static java.lang.String FK_UPDATE_ACTION_RESTRICT
           
static java.lang.String GET_GENERATED_KEYS_STATEMENT
          Whether the datastore supports "Statement.getGeneratedKeys".
static java.lang.String INCLUDE_ORDERBY_COLS_IN_SELECT
          Whether to include any ORDER BY columns in a SELECT.
static java.lang.String LOCK_OPTION_PLACED_AFTER_FROM
          Whether the lock option (when doing SELECT FOR UPDATE) is to be placed after the FROM.
static java.lang.String LOCK_OPTION_PLACED_WITHIN_JOIN
          Whether the lock option (when doing SELECT FOR UPDATE) is to be placed within the JOIN clause.
static java.lang.String LOCK_WITH_SELECT_FOR_UPDATE
          Whether this datastore supports SELECT ...
static java.lang.String NULL_EQUALS_EMPTY_STRING
          Some databases, Oracle, treats an empty string (0 length) equals null.
static java.lang.String NULLS_IN_CANDIDATE_KEYS
          Whether we support NULLs in candidate keys.
static java.lang.String NULLS_KEYWORD_IN_COLUMN_OPTIONS
          Whether the database support NULLs in the column options for table creation.
static java.lang.String ORDERBY_USING_SELECT_COLUMN_INDEX
          In SAPDB any orderby has to be using the index(es) of any SELECT column(s) rather than their name(s).
static java.lang.String PERSIST_OF_UNASSIGNED_CHAR
          Whether the database server supports persist of an unassigned character ("0x0").
static java.lang.String PRIMARYKEY_IN_CREATE_STATEMENTS
          Whether the datastore supports specification of the primary key in CREATE TABLE statements.
static java.lang.String STATEMENT_BATCHING
          Whether this datastore supports batching of statements.
static java.lang.String TX_ISOLATION_NONE
           
static java.lang.String TX_ISOLATION_READ_COMMITTED
           
static java.lang.String TX_ISOLATION_READ_UNCOMMITTED
           
static java.lang.String TX_ISOLATION_REPEATABLE_READ
           
static java.lang.String TX_ISOLATION_SERIALIZABLE
           
static java.lang.String UNION_SYNTAX
          Whether the RDBMS supports UNION syntax.
static java.lang.String UNIQUE_IN_END_CREATE_STATEMENTS
          Whether this datastore supports the use of UNIQUE after the column definitions in CREATE TABLE statements (DDL).
static java.lang.String USE_UNION_ALL
          Union combines the results of two or more queries into a single result set.
static java.lang.String VIEWS
          Whether the RDBMS supports SQL VIEWs.
 
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
 
Method Summary
 java.lang.String getAddCandidateKeyStatement(CandidateKey ck, org.datanucleus.store.mapped.IdentifierFactory factory)
          Returns the appropriate SQL to add a candidate key to its table.
 java.lang.String getAddColumnStatement(org.datanucleus.store.mapped.DatastoreContainerObject table, Column col)
          Accessor for the SQL statement to add a column to a table.
 java.lang.String getAddForeignKeyStatement(ForeignKey fk, org.datanucleus.store.mapped.IdentifierFactory factory)
          Returns the appropriate SQL to add a foreign key to its table.
 java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk, org.datanucleus.store.mapped.IdentifierFactory factory)
          Returns the appropriate SQL to add a primary key to its table.
 java.lang.String getAutoIncrementKeyword()
          Accessor for the auto-increment/identity keyword for generating DDLs.
 java.lang.String getAutoIncrementStmt(Table table, java.lang.String columnName)
          Accessor for the auto-increment/identity sql statement for this datastore.
 java.lang.String getCatalogName(java.sql.Connection conn)
          Accessor for the Catalog Name for this datastore.
 java.lang.String getCheckConstraintForValues(org.datanucleus.store.mapped.DatastoreIdentifier identifier, java.lang.Object[] values, boolean nullable)
          Creates a CHECK constraint definition based on the given values e.g.
 java.sql.ResultSet getColumns(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
          Accessor for table and column information for a catalog/schema in this datastore.
 java.sql.Connection getConnection(ConnectionProvider connProvider, javax.sql.DataSource[] ds, int isolationLevel)
          Accessor for a Connection to the datastore.
 java.lang.String getCreateIndexStatement(Index idx, org.datanucleus.store.mapped.IdentifierFactory factory)
          Returns the appropriate SQL to add an index to its table.
 java.lang.String getCreateTableStatement(TableImpl table, Column[] columns, java.util.Properties props)
          Returns the appropriate SQL to create the given table having the given columns.
 java.lang.String getDatastoreDateStatement()
          Accessor for a statement that will return the statement to use to get the datastore date.
 java.lang.String getDropTableStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
          Returns the appropriate SQL to drop the given table.
 java.lang.String getDropViewStatement(ViewImpl view)
          Returns the appropriate SQL to drop the given view.
 java.sql.ResultSet getExistingIndexes(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Provide the existing indexes in the database for the table
 java.lang.String getInsertStatementForNoColumns(Table table)
          Method to retutn the INSERT statement to use when inserting into a table that has no columns specified.
 java.lang.String getNonAnsiInnerJoinWhereClause(java.lang.String col1, java.lang.String col2)
          Accessor for the WHERE clause to add to provide an INNER JOIN using non-ANSI syntax.
 java.lang.String getNonAnsiLeftOuterJoinWhereClause(java.lang.String col1, java.lang.String col2)
          Accessor for the WHERE clause to add to provide a LEFT OUTER JOIN using non-ANSI syntax.
 java.lang.String getRangeByLimitSelectClause(long offset, long count)
          Method to return the SQL to append to the SELECT clause of a SELECT statement to handle restriction of ranges using the LIMIT keyword.
 java.lang.String getRangeByLimitWhereClause(long offset, long count)
          Method to return the SQL to append to the WHERE clause of a SELECT statement to handle restriction of ranges using the LIMIT keyword.
 java.lang.String getRangeByRowNumberColumn()
          Method to return the column name to use when handling ranges via a rownumber on the select.
 int getRequiredTransactionIsolationLevel()
          Accessor for the "required" transaction isolation level if it has to be a certain value for this adapter.
 java.lang.String getSchemaName(java.sql.Connection conn)
          Accessor for the Schema Name for this datastore.
 java.lang.String getSelectNewUUIDStmt()
          The function to creates a unique value of type uniqueidentifier.
 java.lang.String getSelectWithLockOption()
          The option to specify in "SELECT ...
 java.lang.String getSequenceCreateStmt(java.lang.String sequence_name, java.lang.String min, java.lang.String max, java.lang.String start, java.lang.String increment, java.lang.String cache_size)
          Accessor for the sequence create statement for this datastore.
 java.lang.String getSequenceNextStmt(java.lang.String sequence_name)
          Accessor for the sequence statement to get the next id for this datastore.
 java.lang.String getSurrogateForEmptyStrings()
          Some databases, Oracle, treats an empty string (0 length) equals null
 int getTransactionIsolationForSchemaCreation()
          Accessor for the transaction isolation level to use during schema creation.
 int getUnlimitedLengthPrecisionValue(SQLTypeInfo typeInfo)
          Returns the precision value to be used when creating string columns of "unlimited" length.
 boolean isValidPrimaryKeyType(int datatype)
          Method to return whether the specified JDBC type is valid for use in a PrimaryKey.
 java.util.Iterator iteratorReservedWords()
          Iterator for the reserved words constructed from the method DataBaseMetaData.getSQLKeywords + standard SQL reserved words
 void logConfiguration()
          Convenience method to log the configuration of this datastore adapter.
 ForeignKeyInfo newFKInfo(java.sql.ResultSet rs)
          Method to return ForeignKeyInfo for the current row of the ResultSet which will have been obtained from a call to DatabaseMetaData.getImportedKeys() or DatabaseMetaData.getExportedKeys().
 RDBMSColumnInfo newRDBMSColumnInfo(java.sql.ResultSet rs)
          Create a new column info from the current row of the passed ResultSet.
 SQLTypeInfo newSQLTypeInfo(java.sql.ResultSet rs)
          Create a new SQL type info from the current row of the passed ResultSet.
 org.datanucleus.store.mapped.expression.LogicSetExpression newTableExpression(org.datanucleus.store.mapped.expression.QueryExpression qs, org.datanucleus.store.mapped.DatastoreContainerObject table, org.datanucleus.store.mapped.DatastoreIdentifier rangeVar)
          Returns a new TableExpression object appropriate for this DBMS.
 boolean supportsTransactionIsolation(int level)
          Accessor for whether this database adapter supports the specified transaction isolation.
 
Methods inherited from interface org.datanucleus.store.mapped.DatastoreAdapter
getAdapterTime, getCatalogSeparator, getDatastoreIdentifierMaxLength, getDatastoreMajorVersion, getDatastoreMinorVersion, getIdentifierQuoteString, getMappingManager, getMaxForeignKeys, getMaxIndexes, getNumericExpressionForMethod, getSupportedOptions, getVendorID, initialiseDatastore, initialiseTypes, isIdentityFieldDataType, isReservedKeyword, modOperator, newQueryStatement, removeUnsupportedMappings, setProperties, supportsOption, supportsQueryFetchSize, toString
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionConversionAdapter
toNumericExpression, toStringExpression, toStringExpression
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionOperatorAdapter
concatOperator, getOperatorConcat
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionMethodAdapter
endsWithMethod, getCurrentDateMethod, getCurrentTimeMethod, getCurrentTimestampMethod, indexOfMethod, lowerMethod, matchesMethod, startsWithMethod, substringMethod, substringMethod, translateMethod, trimMethod, upperMethod
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionPatternAdapter
getEscapeCharacter, getEscapedPatternExpression, getEscapePatternExpression, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionLogicSetAdapter
cartersianProduct
 

Field Detail

VIEWS

static final java.lang.String VIEWS
Whether the RDBMS supports SQL VIEWs.

See Also:
Constant Field Values

UNION_SYNTAX

static final java.lang.String UNION_SYNTAX
Whether the RDBMS supports UNION syntax.

See Also:
Constant Field Values

USE_UNION_ALL

static final java.lang.String USE_UNION_ALL
Union combines the results of two or more queries into a single result set. Union include only distinct rows and Union all may include duplicates. When using the UNION statement, keep in mind that, by default, it performs the equivalent of a SELECT DISTINCT on the final result set. In other words, UNION takes the results of two like recordsets, combines them, and then performs a SELECT DISTINCT in order to eliminate any duplicate rows. This process occurs even if there are no duplicate records in the final recordset. If you know that there are duplicate records, and this presents a problem for your application, then by all means use the UNION statement to eliminate the duplicate rows. On the other hand, if you know that there will never be any duplicate rows, or if there are, and this presents no problem to your application, then you should use the UNION ALL statement instead of the UNION statement. The advantage of the UNION ALL is that is does not perform the SELECT DISTINCT function, which saves a lot of unnecessary SQL Server resources from being using.

See Also:
Constant Field Values

EXISTS_SYNTAX

static final java.lang.String EXISTS_SYNTAX
Whether the RDBMS supports use of EXISTS syntax.

See Also:
Constant Field Values

ALTER_TABLE_DROP_CONSTRAINT_SYNTAX

static final java.lang.String ALTER_TABLE_DROP_CONSTRAINT_SYNTAX
Whether this datastore supports ALTER TABLE DROP constraints

See Also:
Constant Field Values

ALTER_TABLE_DROP_FOREIGN_KEY_CONSTRAINT

static final java.lang.String ALTER_TABLE_DROP_FOREIGN_KEY_CONSTRAINT
Whether this datastore supports ALTER TABLE DROP FOREIGN KEY constraints

See Also:
Constant Field Values

DEFERRED_CONSTRAINTS

static final java.lang.String DEFERRED_CONSTRAINTS
Whether this datastore supports deferred constraints.

See Also:
Constant Field Values

DISTINCT_WITH_SELECT_FOR_UPDATE

static final java.lang.String DISTINCT_WITH_SELECT_FOR_UPDATE
Whether this datastore supports using DISTINCT when using SELECT ... FOR UPDATE.

See Also:
Constant Field Values

PERSIST_OF_UNASSIGNED_CHAR

static final java.lang.String PERSIST_OF_UNASSIGNED_CHAR
Whether the database server supports persist of an unassigned character ("0x0"). If not, any unassigned character will be replaced by " " (space) on persist.

See Also:
Constant Field Values

CHAR_COLUMNS_PADDED_WITH_SPACES

static final java.lang.String CHAR_COLUMNS_PADDED_WITH_SPACES
Some databases store character strings in CHAR(XX) columns and when read back in have been padded with spaces.

See Also:
Constant Field Values

NULL_EQUALS_EMPTY_STRING

static final java.lang.String NULL_EQUALS_EMPTY_STRING
Some databases, Oracle, treats an empty string (0 length) equals null.

See Also:
Constant Field Values

STATEMENT_BATCHING

static final java.lang.String STATEMENT_BATCHING
Whether this datastore supports batching of statements.

See Also:
Constant Field Values

CHECK_IN_CREATE_STATEMENTS

static final java.lang.String CHECK_IN_CREATE_STATEMENTS
Whether this datastore supports the use of "CHECK" in CREATE TABLE statements (DDL).

See Also:
Constant Field Values

CHECK_IN_END_CREATE_STATEMENTS

static final java.lang.String CHECK_IN_END_CREATE_STATEMENTS
Whether this datastore supports the use of CHECK after the column definitions in the CREATE TABLE statements (DDL). e.g.
CREATE TABLE XXX
 (
     COL_A int,
     COL_B char(1),
     PRIMARY KEY (COL_A),
     CHECK (COL_B IN ('Y','N'))
 )

See Also:
Constant Field Values

UNIQUE_IN_END_CREATE_STATEMENTS

static final java.lang.String UNIQUE_IN_END_CREATE_STATEMENTS
Whether this datastore supports the use of UNIQUE after the column definitions in CREATE TABLE statements (DDL). e.g.
CREATE TABLE XXX
 (
     COL_A int,
     COL_B char(1),
     PRIMARY KEY (COL_A),
     UNIQUE (COL_B ...)
 )

See Also:
Constant Field Values

PRIMARYKEY_IN_CREATE_STATEMENTS

static final java.lang.String PRIMARYKEY_IN_CREATE_STATEMENTS
Whether the datastore supports specification of the primary key in CREATE TABLE statements.

See Also:
Constant Field Values

GET_GENERATED_KEYS_STATEMENT

static final java.lang.String GET_GENERATED_KEYS_STATEMENT
Whether the datastore supports "Statement.getGeneratedKeys".

See Also:
Constant Field Values

NULLS_IN_CANDIDATE_KEYS

static final java.lang.String NULLS_IN_CANDIDATE_KEYS
Whether we support NULLs in candidate keys.

See Also:
Constant Field Values

NULLS_KEYWORD_IN_COLUMN_OPTIONS

static final java.lang.String NULLS_KEYWORD_IN_COLUMN_OPTIONS
Whether the database support NULLs in the column options for table creation.

See Also:
Constant Field Values

DEFAULT_KEYWORD_IN_COLUMN_OPTIONS

static final java.lang.String DEFAULT_KEYWORD_IN_COLUMN_OPTIONS
Whether we support DEFAULT tag in CREATE TABLE statements

See Also:
Constant Field Values

DEFAULT_KEYWORD_WITH_NOT_NULL_IN_COLUMN_OPTIONS

static final java.lang.String DEFAULT_KEYWORD_WITH_NOT_NULL_IN_COLUMN_OPTIONS
Whether we support DEFAULT tag together with NOT NULL in CREATE TABLE statements.
CREATE TABLE X ( MEMORY_SIZE BIGINT DEFAULT 0 NOT NULL )
Some databases only support DEFAULT {ConstantExpression | NULL}

See Also:
Constant Field Values

DEFAULT_BEFORE_NULL_IN_COLUMN_OPTIONS

static final java.lang.String DEFAULT_BEFORE_NULL_IN_COLUMN_OPTIONS
Whether any DEFAULT tag will be before any NULL/NOT NULL in the column options.

See Also:
Constant Field Values

ANSI_JOIN_SYNTAX

static final java.lang.String ANSI_JOIN_SYNTAX
Accessor for whether the RDBMS supports ANSI join syntax.

See Also:
Constant Field Values

AUTO_INCREMENT_KEYS_NULL_SPECIFICATION

static final java.lang.String AUTO_INCREMENT_KEYS_NULL_SPECIFICATION
Whether we support auto-increment/identity keys with nullability specification.

See Also:
Constant Field Values

AUTO_INCREMENT_COLUMN_TYPE_SPECIFICATION

static final java.lang.String AUTO_INCREMENT_COLUMN_TYPE_SPECIFICATION
Whether we support auto-increment/identity keys with column type specification.

See Also:
Constant Field Values

LOCK_WITH_SELECT_FOR_UPDATE

static final java.lang.String LOCK_WITH_SELECT_FOR_UPDATE
Whether this datastore supports SELECT ... FOR UPDATE.

See Also:
Constant Field Values

LOCK_OPTION_PLACED_AFTER_FROM

static final java.lang.String LOCK_OPTION_PLACED_AFTER_FROM
Whether the lock option (when doing SELECT FOR UPDATE) is to be placed after the FROM.

See Also:
Constant Field Values

LOCK_OPTION_PLACED_WITHIN_JOIN

static final java.lang.String LOCK_OPTION_PLACED_WITHIN_JOIN
Whether the lock option (when doing SELECT FOR UPDATE) is to be placed within the JOIN clause.

See Also:
Constant Field Values

BLOB_SET_USING_SETSTRING

static final java.lang.String BLOB_SET_USING_SETSTRING
Accessor for whether setting a BLOB value allows use of PreparedStatement.setString()

See Also:
Constant Field Values

CLOB_SET_USING_SETSTRING

static final java.lang.String CLOB_SET_USING_SETSTRING
Accessor for whether setting a CLOB value allows use of PreparedStatement.setString()

See Also:
Constant Field Values

CREATE_INDEXES_BEFORE_FOREIGN_KEYS

static final java.lang.String CREATE_INDEXES_BEFORE_FOREIGN_KEYS
Whether to create indexes before foreign keys.

See Also:
Constant Field Values

INCLUDE_ORDERBY_COLS_IN_SELECT

static final java.lang.String INCLUDE_ORDERBY_COLS_IN_SELECT
Whether to include any ORDER BY columns in a SELECT.

See Also:
Constant Field Values

DATETIME_STORES_MILLISECS

static final java.lang.String DATETIME_STORES_MILLISECS
Whether DATETIME stores milliseconds.

See Also:
Constant Field Values

ACCESS_PARENTQUERY_IN_SUBQUERY

static final java.lang.String ACCESS_PARENTQUERY_IN_SUBQUERY
Whether this database supports joining outer and inner queries using columns. i.e can you refer to a column of the outer query in a subquery.

See Also:
Constant Field Values

ORDERBY_USING_SELECT_COLUMN_INDEX

static final java.lang.String ORDERBY_USING_SELECT_COLUMN_INDEX
In SAPDB any orderby has to be using the index(es) of any SELECT column(s) rather than their name(s).

See Also:
Constant Field Values

FK_UPDATE_ACTION_CASCADE

static final java.lang.String FK_UPDATE_ACTION_CASCADE
See Also:
Constant Field Values

FK_UPDATE_ACTION_DEFAULT

static final java.lang.String FK_UPDATE_ACTION_DEFAULT
See Also:
Constant Field Values

FK_UPDATE_ACTION_NULL

static final java.lang.String FK_UPDATE_ACTION_NULL
See Also:
Constant Field Values

FK_UPDATE_ACTION_RESTRICT

static final java.lang.String FK_UPDATE_ACTION_RESTRICT
See Also:
Constant Field Values

FK_DELETE_ACTION_CASCADE

static final java.lang.String FK_DELETE_ACTION_CASCADE
See Also:
Constant Field Values

FK_DELETE_ACTION_DEFAULT

static final java.lang.String FK_DELETE_ACTION_DEFAULT
See Also:
Constant Field Values

FK_DELETE_ACTION_NULL

static final java.lang.String FK_DELETE_ACTION_NULL
See Also:
Constant Field Values

FK_DELETE_ACTION_RESTRICT

static final java.lang.String FK_DELETE_ACTION_RESTRICT
See Also:
Constant Field Values

TX_ISOLATION_NONE

static final java.lang.String TX_ISOLATION_NONE
See Also:
Constant Field Values

TX_ISOLATION_READ_COMMITTED

static final java.lang.String TX_ISOLATION_READ_COMMITTED
See Also:
Constant Field Values

TX_ISOLATION_READ_UNCOMMITTED

static final java.lang.String TX_ISOLATION_READ_UNCOMMITTED
See Also:
Constant Field Values

TX_ISOLATION_REPEATABLE_READ

static final java.lang.String TX_ISOLATION_REPEATABLE_READ
See Also:
Constant Field Values

TX_ISOLATION_SERIALIZABLE

static final java.lang.String TX_ISOLATION_SERIALIZABLE
See Also:
Constant Field Values
Method Detail

logConfiguration

void logConfiguration()
Convenience method to log the configuration of this datastore adapter.


getConnection

java.sql.Connection getConnection(ConnectionProvider connProvider,
                                  javax.sql.DataSource[] ds,
                                  int isolationLevel)
                                  throws java.sql.SQLException
Accessor for a Connection to the datastore.

Parameters:
connProvider - the ConnectionProvider
ds - The data source. Possible to have more than one datasource for failover
isolationLevel - The level of transaction isolation
Returns:
The Connection
Throws:
java.sql.SQLException - Thrown when an error occurs in the creation.

supportsTransactionIsolation

boolean supportsTransactionIsolation(int level)
Accessor for whether this database adapter supports the specified transaction isolation.

Parameters:
level - The isolation level (as defined by Connection enums).
Returns:
Whether it is supported.

getRangeByLimitSelectClause

java.lang.String getRangeByLimitSelectClause(long offset,
                                             long count)
Method to return the SQL to append to the SELECT clause of a SELECT statement to handle restriction of ranges using the LIMIT keyword. Defaults to an empty string (not supported). SELECT {LIMIT} params

Parameters:
offset - The offset to return from
count - The number of items to return
Returns:
The SQL to append to allow for ranges using LIMIT.

getRangeByLimitWhereClause

java.lang.String getRangeByLimitWhereClause(long offset,
                                            long count)
Method to return the SQL to append to the WHERE clause of a SELECT statement to handle restriction of ranges using the LIMIT keyword. Defaults to an empty string (not supported). SELECT param ... WHERE {LIMIT}

Parameters:
offset - The offset to return from
count - The number of items to return
Returns:
The SQL to append to allow for ranges using LIMIT.

getRangeByRowNumberColumn

java.lang.String getRangeByRowNumberColumn()
Method to return the column name to use when handling ranges via a rownumber on the select. Defaults to an empty string (not supported).

Returns:
The row number column.

getColumns

java.sql.ResultSet getColumns(java.sql.Connection conn,
                              java.lang.String catalog,
                              java.lang.String schema,
                              java.lang.String table,
                              java.lang.String columnNamePattern)
                              throws java.sql.SQLException
Accessor for table and column information for a catalog/schema in this datastore.

Parameters:
conn - Connection to use
catalog - The catalog (null if none)
schema - The schema (null if none)
table - The table (null if all)
columnNamePattern - The column name (null if all)
Returns:
ResultSet containing the table/column information
Throws:
java.sql.SQLException - Thrown if an error occurs

getInsertStatementForNoColumns

java.lang.String getInsertStatementForNoColumns(Table table)
Method to retutn the INSERT statement to use when inserting into a table that has no columns specified. This is the case when we have a single column in the table and that column is autoincrement/identity (and so is assigned automatically in the datastore).

Parameters:
table - The table
Returns:
The statement for the INSERT

getUnlimitedLengthPrecisionValue

int getUnlimitedLengthPrecisionValue(SQLTypeInfo typeInfo)
Returns the precision value to be used when creating string columns of "unlimited" length. Usually, if this value is needed it is provided in the database metadata. However, for some types in some databases the value must be computed.

Parameters:
typeInfo - the typeInfo object for which the precision value is needed.
Returns:
the precision value to be used when creating the column, or -1 if no value should be used.

getAutoIncrementStmt

java.lang.String getAutoIncrementStmt(Table table,
                                      java.lang.String columnName)
Accessor for the auto-increment/identity sql statement for this datastore.

Parameters:
table - Table (that the autoincrement is for)
columnName - (that the autoincrement is for)
Returns:
The statement for getting the latest auto-increment/identity key

getAutoIncrementKeyword

java.lang.String getAutoIncrementKeyword()
Accessor for the auto-increment/identity keyword for generating DDLs. (CREATE TABLEs...).

Returns:
The keyword for a column using auto-increment/identity

getDropTableStatement

java.lang.String getDropTableStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
Returns the appropriate SQL to drop the given table. It should return something like:

 DROP TABLE FOO CASCADE
 

Parameters:
table - The table to drop.
Returns:
The text of the SQL statement.

getAddCandidateKeyStatement

java.lang.String getAddCandidateKeyStatement(CandidateKey ck,
                                             org.datanucleus.store.mapped.IdentifierFactory factory)
Returns the appropriate SQL to add a candidate key to its table. It should return something like:

 ALTER TABLE FOO ADD CONSTRAINT FOO_CK UNIQUE (BAZ)
 

Parameters:
ck - An object describing the candidate key.
factory - Identifier factory
Returns:
The text of the SQL statement.

isValidPrimaryKeyType

boolean isValidPrimaryKeyType(int datatype)
Method to return whether the specified JDBC type is valid for use in a PrimaryKey.

Parameters:
datatype - The JDBC type.
Returns:
Whether it is valid for use in the PK

getAddColumnStatement

java.lang.String getAddColumnStatement(org.datanucleus.store.mapped.DatastoreContainerObject table,
                                       Column col)
Accessor for the SQL statement to add a column to a table.

Parameters:
table - The table
col - The column
Returns:
The SQL necessary to add the column

getCreateIndexStatement

java.lang.String getCreateIndexStatement(Index idx,
                                         org.datanucleus.store.mapped.IdentifierFactory factory)
Returns the appropriate SQL to add an index to its table. It should return something like:

 CREATE INDEX FOO_N1 ON FOO (BAR,BAZ)
 CREATE UNIQUE INDEX FOO_U1 ON FOO (BAR,BAZ)
 

Parameters:
idx - An object describing the index.
factory - Identifier factory
Returns:
The text of the SQL statement.

getExistingIndexes

java.sql.ResultSet getExistingIndexes(java.sql.Connection conn,
                                      java.lang.String catalog,
                                      java.lang.String schema,
                                      java.lang.String table)
                                      throws java.sql.SQLException
Provide the existing indexes in the database for the table

Parameters:
conn - the JDBC connection
catalog - the catalog name
schema - the schema name
table - the table name
Returns:
a ResultSet with the format @see DatabaseMetaData#getIndexInfo(java.lang.String, java.lang.String, java.lang.String, boolean, boolean)
Throws:
java.sql.SQLException

getCreateTableStatement

java.lang.String getCreateTableStatement(TableImpl table,
                                         Column[] columns,
                                         java.util.Properties props)
Returns the appropriate SQL to create the given table having the given columns. No column constraints or key definitions should be included. It should return something like:

 CREATE TABLE FOO (BAR VARCHAR(30), BAZ INTEGER)
 

Parameters:
table - The table to create.
columns - The columns of the table.
props - Properties for controlling the table creation
Returns:
The text of the SQL statement.

getAddPrimaryKeyStatement

java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk,
                                           org.datanucleus.store.mapped.IdentifierFactory factory)
Returns the appropriate SQL to add a primary key to its table. It should return something like:

 ALTER TABLE FOO ADD CONSTRAINT FOO_PK PRIMARY KEY (BAR)
 

Parameters:
pk - An object describing the primary key.
factory - Identifier factory
Returns:
The text of the SQL statement.

getAddForeignKeyStatement

java.lang.String getAddForeignKeyStatement(ForeignKey fk,
                                           org.datanucleus.store.mapped.IdentifierFactory factory)
Returns the appropriate SQL to add a foreign key to its table. It should return something like:

 ALTER TABLE FOO ADD CONSTRAINT FOO_FK1 FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2)
 

Parameters:
fk - An object describing the foreign key.
factory - Identifier factory
Returns:
The text of the SQL statement.

getDropViewStatement

java.lang.String getDropViewStatement(ViewImpl view)
Returns the appropriate SQL to drop the given view. It should return something like:

 DROP VIEW FOO
 

Parameters:
view - The view to drop.
Returns:
The text of the SQL statement.

getSurrogateForEmptyStrings

java.lang.String getSurrogateForEmptyStrings()
Some databases, Oracle, treats an empty string (0 length) equals null

Returns:
returns a surrogate to replace the empty string in the database otherwise it would be treated as null

getTransactionIsolationForSchemaCreation

int getTransactionIsolationForSchemaCreation()
Accessor for the transaction isolation level to use during schema creation.

Returns:
The transaction isolation level for schema generation process

getRequiredTransactionIsolationLevel

int getRequiredTransactionIsolationLevel()
Accessor for the "required" transaction isolation level if it has to be a certain value for this adapter.

Returns:
Transaction isolation level (-1 implies no restriction)

getCatalogName

java.lang.String getCatalogName(java.sql.Connection conn)
                                throws java.sql.SQLException
Accessor for the Catalog Name for this datastore.

Parameters:
conn - Connection to the datastore
Returns:
The catalog name
Throws:
java.sql.SQLException - Thrown if error occurs in determining the catalog name.

getSchemaName

java.lang.String getSchemaName(java.sql.Connection conn)
                               throws java.sql.SQLException
Accessor for the Schema Name for this datastore.

Parameters:
conn - Connection to the datastore
Returns:
The schema name
Throws:
java.sql.SQLException - Thrown if error occurs in determining the schema name.

getNonAnsiLeftOuterJoinWhereClause

java.lang.String getNonAnsiLeftOuterJoinWhereClause(java.lang.String col1,
                                                    java.lang.String col2)
Accessor for the WHERE clause to add to provide a LEFT OUTER JOIN using non-ANSI syntax.

Parameters:
col1 - The main datastore column
col2 - The secondary column to join to
Returns:
The Left Outer Join WHERE clause.

getNonAnsiInnerJoinWhereClause

java.lang.String getNonAnsiInnerJoinWhereClause(java.lang.String col1,
                                                java.lang.String col2)
Accessor for the WHERE clause to add to provide an INNER JOIN using non-ANSI syntax.

Parameters:
col1 - The main datastore column
col2 - The secondary column to join to
Returns:
The Inner Join WHERE clause.

getSelectWithLockOption

java.lang.String getSelectWithLockOption()
The option to specify in "SELECT ... FROM TABLE ... WITH (option)" to lock instances Null if not supported.

Returns:
The option to specify with "SELECT ... FROM TABLE ... WITH (option)"

newTableExpression

org.datanucleus.store.mapped.expression.LogicSetExpression newTableExpression(org.datanucleus.store.mapped.expression.QueryExpression qs,
                                                                              org.datanucleus.store.mapped.DatastoreContainerObject table,
                                                                              org.datanucleus.store.mapped.DatastoreIdentifier rangeVar)
Returns a new TableExpression object appropriate for this DBMS. This should be an instance of one of the three built-in styles of table expression: TableExprAsSubjoins is the default, which arguably produces the most readable SQL but doesn't work on all DBMS's. TableExprAsSubjoins should work anywhere, but may be less efficient.

Parameters:
qs - The query statement in which the table expression will be included.
table - The main table in the expression.
rangeVar - The SQL alias, or "range variable", to assign to the expression or to the main table.
Returns:
The expression

getSelectNewUUIDStmt

java.lang.String getSelectNewUUIDStmt()
The function to creates a unique value of type uniqueidentifier.

Returns:
The function. e.g. "SELECT NEWID()"

getSequenceNextStmt

java.lang.String getSequenceNextStmt(java.lang.String sequence_name)
Accessor for the sequence statement to get the next id for this datastore.

Parameters:
sequence_name - Name of the sequence
Returns:
The statement for getting the next id for the sequence

getSequenceCreateStmt

java.lang.String getSequenceCreateStmt(java.lang.String sequence_name,
                                       java.lang.String min,
                                       java.lang.String max,
                                       java.lang.String start,
                                       java.lang.String increment,
                                       java.lang.String cache_size)
Accessor for the sequence create statement for this datastore. TODO Change param types to int.

Parameters:
sequence_name - Name of the sequence
min - Minimum value for the sequence
max - Maximum value for the sequence
start - Start value for the sequence
increment - Increment value for the sequence
cache_size - Cache size for the sequence
Returns:
The statement for getting the next id from the sequence

iteratorReservedWords

java.util.Iterator iteratorReservedWords()
Iterator for the reserved words constructed from the method DataBaseMetaData.getSQLKeywords + standard SQL reserved words

Returns:
an Iterator with a set of reserved words

getDatastoreDateStatement

java.lang.String getDatastoreDateStatement()
Accessor for a statement that will return the statement to use to get the datastore date.

Returns:
SQL statement to get the datastore date

getCheckConstraintForValues

java.lang.String getCheckConstraintForValues(org.datanucleus.store.mapped.DatastoreIdentifier identifier,
                                             java.lang.Object[] values,
                                             boolean nullable)
Creates a CHECK constraint definition based on the given values e.g.
CHECK ("COLUMN" IN ('VAL1','VAL2') OR "COLUMN" IS NULL)

Parameters:
identifier - Column identifier
values - valid values
nullable - whether the datastore identifier is null
Returns:
The check constraint

newSQLTypeInfo

SQLTypeInfo newSQLTypeInfo(java.sql.ResultSet rs)
Create a new SQL type info from the current row of the passed ResultSet. Allows an adapter to override particular types where the JDBC driver is known to be buggy.

Parameters:
rs - ResultSet
Returns:
The SQL type info

newRDBMSColumnInfo

RDBMSColumnInfo newRDBMSColumnInfo(java.sql.ResultSet rs)
Create a new column info from the current row of the passed ResultSet. Allows an adapter to override particular column information where the JDBC driver is known to be buggy.

Parameters:
rs - Result Set
Returns:
The column info

newFKInfo

ForeignKeyInfo newFKInfo(java.sql.ResultSet rs)
Method to return ForeignKeyInfo for the current row of the ResultSet which will have been obtained from a call to DatabaseMetaData.getImportedKeys() or DatabaseMetaData.getExportedKeys().

Parameters:
rs - The result set returned from DatabaseMetaData.get??portedKeys()
Returns:
The foreign key info


Copyright © 2009. All Rights Reserved.