|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.store.AbstractDatastoreAdapter
org.jpox.store.rdbms.adapter.DatabaseAdapter
Provides methods for adapting SQL language elements to a specific vendor's database. A database adapter is primarily used to map generic JDBC data types and SQL identifiers to specific types/identifiers suitable for the database in use.
Each database adapter corresponds to a particular combination of database,
database version, driver, and driver version, as provided by the driver's
own metadata. Database adapters cannot be constructed directly, but must be
obtained using the RDBMSAdapterFactory
class.
RDBMSAdapterFactory
,
DatabaseMetaData
Field Summary | |
protected java.lang.String |
catalogSeparator
The String used to separate catalog and table name. |
protected int |
driverMajorVersion
The major version number of the underlying driver. |
protected int |
driverMinorVersion
The minor version number of the underlying driver. |
protected java.lang.String |
driverName
the JDBC driver name |
protected java.lang.String |
driverVersion
the JDBC driver version |
protected static Localiser |
LOCALISER
|
protected int |
maxColumnNameLength
The maximum length to be used for a column name. |
protected int |
maxConstraintNameLength
The maximum length to be used for a table constraint name. |
protected int |
maxIndexNameLength
The maximum length to be used for an index name. |
protected int |
maxTableNameLength
The maximum length to be used for a table name. |
protected boolean |
supportsCatalogsInTableDefinitions
true if the database supports catalogs in table definition |
protected boolean |
supportsSchemasInTableDefinitions
true if the database supports schemas in table definition |
protected java.util.HashMap |
typesByTypeNumber
JDBC types, keyed by the type number. |
Fields inherited from class org.jpox.store.AbstractDatastoreAdapter |
datastoreMajorVersion, datastoreMinorVersion, datastoreProductName, datastoreProductVersion, datastoreRevisionVersion, dictionary, identifierCase, identifierQuoteString, LOCALISER_BASE, mappingManager, reservedKeywords |
Fields inherited from interface org.jpox.store.DatastoreAdapter |
IDENTIFIER_LOWER_CASE, IDENTIFIER_LOWER_CASE_QUOTED, IDENTIFIER_MIXED_CASE, IDENTIFIER_MIXED_CASE_QUOTED, IDENTIFIER_UPPER_CASE, IDENTIFIER_UPPER_CASE_QUOTED |
Constructor Summary | |
protected |
DatabaseAdapter(Dictionary dictionary,
java.sql.DatabaseMetaData metadata)
Constructs a database adapter based on the given JDBC metadata. |
Method Summary | |
NumericExpression |
absMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.abs(EXPRESSION) method. |
NumericExpression |
acosMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.acos(EXPRESSION) method. |
NumericExpression |
asinMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.asin(EXPRESSION) method. |
NumericExpression |
atanMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.atan(EXPRESSION) method. |
java.lang.String |
cartersianProduct(LogicSetExpression Y)
Generates a expression that represents the cartesian product of two sets: X and Y . |
NumericExpression |
ceilMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL ceil(EXPRESSION) method. |
void |
closeConnection(java.sql.Connection conn)
Method to close a Connection to the datastore. |
ScalarExpression |
concatOperator(ScalarExpression operand1,
ScalarExpression operand2)
If only one operand expression is of type String, then string conversion is performed on the other operand to produce a string at run time. |
NumericExpression |
cosMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.cos(EXPRESSION) method. |
boolean |
createIndexesBeforeForeignKeys()
Whether to create indexes before foreign keys. |
protected void |
createTypeInfo(java.sql.DatabaseMetaData metadata)
Creates TypeInfo objects for all of the data types and indexes them in the typesByTypeNumber map by their JDBC data type number. |
BooleanExpression |
endsWithMethod(ScalarExpression leftOperand,
ScalarExpression rightOperand)
Returns whether this string ends with the specified string. |
NumericExpression |
expMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.exp(EXPRESSION) method. |
NumericExpression |
floorMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.floor(EXPRESSION) method. |
java.lang.String |
getAddCandidateKeyStatement(CandidateKey ck)
Returns the appropriate SQL to add a candidate key to its table. |
java.lang.String |
getAddColumnStatement(DatastoreContainerObject table,
Column col)
Accessor for the SQL statement to add a column to a table. |
java.lang.String |
getAddForeignKeyStatement(ForeignKey fk)
Returns the appropriate SQL to add a foreign key to its table. |
java.lang.String |
getAddPrimaryKeyStatement(PrimaryKey pk)
Returns the appropriate SQL to add a primary key to its table. |
java.lang.String |
getAutoIncrementKeyword()
Accessor for the autoincrementing keyword for generating DDLs. |
java.lang.String |
getAutoIncrementStmt(java.lang.String tableName,
java.lang.String columnName)
Accessor for the autoincrementing sql statement for this datastore. |
java.lang.String |
getCatalogName(java.sql.Connection conn)
Accessor for the Catalog Name for this datastore. |
java.lang.String |
getCatalogSeparator()
Accessor for the catalog separator. |
java.sql.ResultSet |
getColumns(java.sql.Connection conn,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Accessor for table and column information for a catalog/schema in this datastore. |
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(javax.sql.DataSource[] ds,
java.lang.String userName,
java.lang.String password,
int isolationLevel)
Accessor for a Connection to the datastore. |
java.lang.String |
getContinuationString()
Continuation string to use where the SQL statement goes over more than 1 line. |
java.lang.String |
getCreateIndexStatement(Index idx)
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. |
NumericExpression |
getDayMethod(SqlTemporalExpression date)
Returns the appropriate SQL expression for the JDOQL Date.getDay() method. |
java.lang.String |
getDropTableStatement(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.lang.String |
getEscapeCharacter()
The character for escaping characters in pattern expressions. |
ScalarExpression |
getEscapedPatternExpression(ScalarExpression patternExpression)
The pattern string for representing one character. |
java.lang.String |
getEscapePatternExpression()
The character for escaping characters in pattern expressions. |
java.sql.ResultSet |
getExistingIndexes(java.sql.Connection conn,
java.sql.DatabaseMetaData dmd,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Provide the existing indexes in the database for the table |
NumericExpression |
getHourMethod(SqlTemporalExpression time)
Returns the appropriate SQL expression for the JDOQL Time.getHour() method. |
java.lang.String |
getInsertStatementForNoColumns(Table table)
Method to return the INSERT statement to use when inserting into a table that has no columns specified. |
int |
getMaxColumnNameLength()
Accessor for the maximum column name length permitted on this datastore. |
int |
getMaxConstraintNameLength()
Accessor for the maximum constraint name length permitted on this datastore. |
int |
getMaxForeignKeys()
Accessor for the maximum foreign keys by table permitted for this datastore. |
int |
getMaxIndexes()
Accessor for the maximum indexes by schema permitted for this datastore. |
int |
getMaxIndexNameLength()
Accessor for the maximum index name length permitted on this datastore. |
int |
getMaxTableNameLength()
Accessor for the maximum table name length permitted on this datastore. |
NumericExpression |
getMinuteMethod(SqlTemporalExpression time)
Returns the appropriate SQL expression for the JDOQL Time.getMinute() method. |
NumericExpression |
getMonthMethod(SqlTemporalExpression date)
Returns the appropriate SQL expression for the JDOQL Date.getMonth() method. |
protected MappingManager |
getNewMappingManager()
Accessor for a new Mapping Manager |
java.lang.String |
getNewUUIDFunction()
The function to creates a unique value of type uniqueidentifier. |
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 |
getNonAnsiRightOuterJoinWhereClause(java.lang.String col1,
java.lang.String col2)
Accessor for the WHERE clause to add to provide a RIGHT OUTER JOIN using non-ANSI syntax. |
java.lang.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). |
java.lang.String |
getPatternExpressionAnyCharacter()
The pattern string for representing one character that is expanded in word searches. |
java.lang.String |
getPatternExpressionZeroMoreCharacters()
The pattern string for representing zero or more characters that is expanded in word searches. |
boolean |
getPlaceWithOptionAfterFromClause()
Determines whether the getSelectWithLockOption() is to be placed right
before the FROM clause, or at the end of the statement |
boolean |
getPlaceWithOptionWithinJoinClauses()
Determines whether lock option has to be placed within JOIN clauses as well. |
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. |
java.lang.String |
getSchemaName(java.sql.Connection conn)
Accessor for the Schema Name for this datastore. |
NumericExpression |
getSecondMethod(SqlTemporalExpression time)
Returns the appropriate SQL expression for the JDOQL Time.getSecond() method. |
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 |
java.sql.ResultSet |
getTables(java.sql.Connection conn,
java.lang.String catalog,
java.lang.String schema)
Accessor for table information for a catalog/schema in this datastore. |
int |
getTransactionIsolationForSchemaCreation()
Accessor for the transaction isolation level to use during schema creation. |
TypeInfo |
getTypeInfo(int dataType)
Returns type information for the database type that best implements the given JDBC type. |
TypeInfo |
getTypeInfo(int[] candidateDataTypes)
Returns type information for the first one of the given candidate JDBC data types supported by this database. |
int |
getUnlimitedLengthPrecisionValue(TypeInfo typeInfo)
Returns the precision value to be used when creating string columns of "unlimited" length. |
NumericExpression |
getYearMethod(SqlTemporalExpression date)
Returns the appropriate SQL expression for the JDOQL Date.getYear() method. |
boolean |
includeOrderByColumnsInSelect()
Whether to include ORDER BY columns in a SELECT. |
boolean |
includeOrderByColumnsInSelectUsingAlias()
Whether to specify ORDER BY columns in SELECTS using aliases. |
NumericExpression |
indexOfMethod(ScalarExpression source,
ScalarExpression str,
NumericExpression from)
Returns the appropriate SQL expression for the JDOQL String.indexOf() method. |
void |
initialiseDatastore(java.lang.Object conn)
Creates the auxiliary functions/procedures in the schema |
boolean |
isAutoIncrementingDataType(java.lang.String typeName)
Verifies if the given typeName is auto incremented by the datastore. |
boolean |
isBitReallyBoolean()
Accessor for whether a JDBC Types.BIT is really mapped in the datastore to a boolean field. |
boolean |
isNullEqualsEmptyStrings()
Some databases, Oracle, treats an empty string (0 length) equals null |
boolean |
isSQLKeyword(java.lang.String word)
Tests if a given string is a SQL key word. |
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 |
java.util.Iterator |
iteratorTypeInfo()
Iterator for the TypeInfo objects constructed from the method DataBaseMetaData.getTypeInfo |
NumericExpression |
lengthMethod(StringExpression str)
Returns the appropriate SQL expression for the JDOQL String.length() method. |
NumericExpression |
logMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.log(EXPRESSION) method. |
ColumnInfo |
newColumnInfo(java.sql.ResultSet rs)
A factory for ColumnInfo objects. |
ExportedKeyInfo |
newExportedKeyInfo(java.sql.ResultSet rs)
A factory for ForeignKeyInfo objects. |
ForeignKeyInfo |
newForeignKeyInfo(java.sql.ResultSet rs)
A factory for ForeignKeyInfo objects. |
QueryExpression |
newQueryStatement(DatastoreContainerObject table,
ClassLoaderResolver clr)
Accessor for a new query statement. |
QueryExpression |
newQueryStatement(DatastoreContainerObject table,
DatastoreIdentifier rangeVar,
ClassLoaderResolver clr)
Accessor for a new query statement. |
LogicSetExpression |
newTableExpression(QueryExpression qs,
DatastoreContainerObject table,
DatastoreIdentifier rangeVar)
Returns a new TableExpression object appropriate for this DBMS. |
protected TypeInfo |
newTypeInfo(java.sql.ResultSet rs)
A factory for TypeInfo objects. |
protected java.util.Set |
parseKeywordList(java.lang.String list)
Utility method to parse a list of keywords and split them out into words. |
boolean |
requiresColumnDefaultsInitialising()
Accessor for whether the column defaults need initialising for this datastore |
NumericExpression |
sinMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.sin(EXPRESSION) method. |
NumericExpression |
sqrtMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.sqrt(EXPRESSION) method. |
BooleanExpression |
startsWithMethod(ScalarExpression source,
ScalarExpression str)
Method to handle the starts with operation. |
StringExpression |
substringMethod(StringExpression str,
NumericExpression begin)
Returns the appropriate SQL expression for the JDOQL String.substring(str,begin) method. |
StringExpression |
substringMethod(StringExpression str,
NumericExpression begin,
NumericExpression end)
Returns the appropriate SQL expression for the JDOQL String.substring(str,begin,end) method. |
boolean |
supportsAlterTableDropConstraint()
Whether this datastore supports ALTER TABLE DROP constraints |
boolean |
supportsAlterTableDropForeignKeyConstraint()
Whether this datastore supports ALTER TABLE DROP FOREIGN KEY constraints |
boolean |
supportsAnsiJoinSyntax()
Accessor for whether the RDBMS supports ANSI join syntax. |
boolean |
supportsAutoIncrementColumnTypeSpecification()
Whether we support auto-increment/identity keys with column type specification. |
boolean |
supportsAutoIncrementKeysNullSpecification()
Whether we support autoincrementing keys with nullability specification. |
boolean |
supportsBooleanComparison()
Whether we support Boolean comparisons. |
boolean |
supportsCatalogsInTableDefinitions()
Whether this datastore supports the use of the catalog name in SQL table definitions (DDL). |
boolean |
supportsCheckConstraintsInEndCreateStatements()
Whether this datastore supports the use of CHECK after the column definitions in CREATE TABLE statements (DDL). |
boolean |
supportsCheckInCreateStatements()
Whether this datastore supports the use of CHECK in CREATE TABLE statements (DDL). |
boolean |
supportsDefaultBeforeNullInColumnOptions()
Whether any DEFAULT tag will be before any NULL/NOT NULL in the column options. |
boolean |
supportsDefaultKeywordInColumnOptions()
Whether we support DEFAULT tag in CREATE TABLE statements |
boolean |
supportsDefaultKeywordWithNotNullInColumnOptions()
Whether we support DEFAULT tag together with NOT NULL in CREATE TABLE statements. |
boolean |
supportsDeferredConstraints()
Whether this datastore supports deferred constraints. |
boolean |
supportsDistinctWithSelectForUpdate()
Whether this datastore supports using DISTINCT when using SELECT ... |
boolean |
supportsEscapeExpressionInLikePredicate()
Whether this datastore supports the use of the escape expression in like predicates |
boolean |
supportsExistsSyntax()
Whether the RDBMS supports use of EXISTS syntax. |
boolean |
supportsForeignKeyDeleteAction(ForeignKey.FKAction action)
Whether this datastore supports the specified foreign key delete action |
boolean |
supportsForeignKeyUpdateAction(ForeignKey.FKAction action)
Whether this datastore supports the specified foreign key update action |
boolean |
supportsLockWithSelectForUpdate()
Whether this datastore supports SELECT ... |
boolean |
supportsNullsInCandidateKeys()
Whether we support NULLs in candidate keys. |
boolean |
supportsNullsKeywordInColumnOptions()
Whether the database support NULLs in the column options for table creation. |
boolean |
supportsPrimaryKeyInCreateStatements()
Whether the datastore supports specification of the primary key in CREATE TABLE statements. |
boolean |
supportsSchemasInTableDefinitions()
Whether this datastore supports the use of the schema name in SQL table definitions (DDL). |
boolean |
supportsSettingBlobUsingSetString()
Accessor for whether setting a BLOB value allows use of PreparedStatement.setString() |
boolean |
supportsSettingClobUsingSetString()
Accessor for whether setting a CLOB value allows use of PreparedStatement.setString() |
boolean |
supportsStatementGetGeneratedKeys()
Whether the datastore supports Statement.getGeneratedKeys() |
boolean |
supportsTransactionIsolationLevel(int isolationLevel)
Accessor for whether the adapter supports the transaction isolation level |
boolean |
supportsUnionSyntax()
Whether the RDBMS supports use of UNION syntax. |
boolean |
supportsUniqueConstraintsInEndCreateStatements()
Whether this datastore supports the use of UNIQUE after the column definitions in CREATE TABLE statements (DDL). |
NumericExpression |
tanMethod(ScalarExpression expr)
Returns the appropriate SQL expression for the JDOQL Math.tan(EXPRESSION) method. |
NumericExpression |
toNumericExpression(CharacterExpression expr)
Returns the appropriate expression for the (int)'A' expression. |
java.lang.String |
toString()
Overridden toString() method adding more information. |
StringExpression |
toStringExpression(NumericExpression expr)
A String conversion that converts a numeric expression to string. |
StringExpression |
toStringExpression(StringLiteral expr)
A String conversion that converts a String literal to String expression. |
StringExpression |
trimMethod(StringExpression str)
Returns the appropriate SQL expression for the JDOQL String.trim(str) method. |
boolean |
useUnionAll()
Union combines the results of two or more queries into a single result set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jpox.store.rdbms.adapter.RDBMSAdapter |
getIdentifierQuoteString, supportsSequences |
Methods inherited from interface org.jpox.store.DatastoreAdapter |
getAdapterTime, getDatastoreMajorVersion, getDatastoreMinorVersion, getDictionary, getIdentifierCase, getIdentifierInAdapterCase, getMapping, getMapping, getMapping, getMapping, getMappingManager, getVendorID, isReservedKeyword, loadDatastoreMapping, modOperator, supportsAutoIncrementFields, supportsQueryFetchSizeLowerThanOne |
Field Detail |
protected static final Localiser LOCALISER
protected java.lang.String driverName
protected java.lang.String driverVersion
protected int driverMajorVersion
protected int driverMinorVersion
protected int maxTableNameLength
protected int maxConstraintNameLength
protected int maxIndexNameLength
protected int maxColumnNameLength
protected boolean supportsCatalogsInTableDefinitions
protected boolean supportsSchemasInTableDefinitions
protected java.lang.String catalogSeparator
protected final java.util.HashMap typesByTypeNumber
Constructor Detail |
protected DatabaseAdapter(Dictionary dictionary, java.sql.DatabaseMetaData metadata)
metadata
- the database metadata.Method Detail |
public void initialiseDatastore(java.lang.Object conn)
initialiseDatastore
in interface DatastoreAdapter
conn
- the connection to the datastorepublic int getMaxTableNameLength()
getMaxTableNameLength
in interface RDBMSAdapter
public int getMaxForeignKeys()
getMaxForeignKeys
in interface RDBMSAdapter
public int getMaxIndexes()
getMaxIndexes
in interface RDBMSAdapter
public int getMaxConstraintNameLength()
getMaxConstraintNameLength
in interface RDBMSAdapter
public int getMaxIndexNameLength()
getMaxIndexNameLength
in interface RDBMSAdapter
public int getMaxColumnNameLength()
getMaxColumnNameLength
in interface RDBMSAdapter
public java.util.Iterator iteratorTypeInfo()
iteratorTypeInfo
in interface RDBMSAdapter
public java.util.Iterator iteratorReservedWords()
iteratorReservedWords
in interface RDBMSAdapter
protected void createTypeInfo(java.sql.DatabaseMetaData metadata) throws java.sql.SQLException
metadata
- The MetaData for this datastore
java.sql.SQLException
- Thrown if error occurs in the creation.protected TypeInfo newTypeInfo(java.sql.ResultSet rs)
ResultSet
object passed must have been
obtained from a call to DatabaseMetaData.getTypeInfo().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
rs
- The result set returned from DatabaseMetaData.getTypeInfo().
null
if the type indicated by this row should be
excluded from use.public ColumnInfo newColumnInfo(java.sql.ResultSet rs)
ResultSet
object passed must have been
obtained from a call to DatabaseMetaData.getColumns().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
newColumnInfo
in interface RDBMSAdapter
rs
- The result set returned from DatabaseMetaData.getColumns().
public ForeignKeyInfo newForeignKeyInfo(java.sql.ResultSet rs)
ResultSet
object passed must have been
obtained from a call to DatabaseMetaData.getImportedKeys() or
DatabaseMetaData.getExportedKeys().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
newForeignKeyInfo
in interface RDBMSAdapter
rs
- The result set returned from DatabaseMetaData.get??portedKeys()
public ExportedKeyInfo newExportedKeyInfo(java.sql.ResultSet rs)
ResultSet
object passed must have been
obtained from a call to DatabaseMetaData.getExportedKeys().
The constructor only retrieves the values from the current row; the
caller is required to advance to the next row with ResultSet.next()
rs
- The result set returned from DatabaseMetaData.getExportedKeys()
protected java.util.Set parseKeywordList(java.lang.String list)
list
- The comma-separated list of keywords.
public boolean isSQLKeyword(java.lang.String word)
The list of key words tested against is defined to contain all SQL/92 key
words, 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.
isSQLKeyword
in interface RDBMSAdapter
word
- The word to test.
true
if word is a SQL key word for
this DBMS. The comparison is case-insensitive.SQLConstants
public TypeInfo getTypeInfo(int dataType) throws UnsupportedDataTypeException
getTypeInfo
in interface RDBMSAdapter
dataType
- JDBC type number of the data type.
UnsupportedDataTypeException
- Thrown if the specified datatype is
not supported.public TypeInfo getTypeInfo(int[] candidateDataTypes) throws UnsupportedDataTypeException
candidateDataTypes
- array of JDBC type numbers of the data types to be checked
in order of preference.
UnsupportedDataTypeException
- Thrown if one of the datatypes is
not supported.public int getUnlimitedLengthPrecisionValue(TypeInfo typeInfo)
TypeInfo.precision
). However, for some
types in some databases the value must be computed specially.
getUnlimitedLengthPrecisionValue
in interface RDBMSAdapter
typeInfo
- the typeInfo object for which the precision value is
needed.
public boolean isValidPrimaryKeyType(int datatype)
isValidPrimaryKeyType
in interface RDBMSAdapter
datatype
- The JDBC type.
public boolean isNullEqualsEmptyStrings()
isNullEqualsEmptyStrings
in interface RDBMSAdapter
public boolean isBitReallyBoolean()
isBitReallyBoolean
in interface RDBMSAdapter
public boolean supportsSettingBlobUsingSetString()
supportsSettingBlobUsingSetString
in interface RDBMSAdapter
public boolean supportsSettingClobUsingSetString()
supportsSettingClobUsingSetString
in interface RDBMSAdapter
public java.lang.String getSurrogateForEmptyStrings()
getSurrogateForEmptyStrings
in interface RDBMSAdapter
protected MappingManager getNewMappingManager()
getNewMappingManager
in class AbstractDatastoreAdapter
public boolean supportsTransactionIsolationLevel(int isolationLevel)
isolationLevel
- the isolation level
public int getTransactionIsolationForSchemaCreation()
getTransactionIsolationForSchemaCreation
in interface RDBMSAdapter
public java.sql.Connection getConnection(javax.sql.DataSource[] ds, java.lang.String userName, java.lang.String password, int isolationLevel) throws java.sql.SQLException
getConnection
in interface DatastoreAdapter
ds
- The data source. Possible to have more than one datasource for failoveruserName
- The username for the datastorepassword
- The password for the datastoreisolationLevel
- The level of transaction isolation
java.sql.SQLException
- Thrown when an error occurs in the creation.public void closeConnection(java.sql.Connection conn) throws java.sql.SQLException
closeConnection
in interface DatastoreAdapter
conn
- The connection
java.sql.SQLException
- Thrown if error occurs on the close.public java.lang.String getCatalogName(java.sql.Connection conn) throws java.sql.SQLException
getCatalogName
in interface RDBMSAdapter
conn
- Connection to the datastore
java.sql.SQLException
- Thrown if error occurs in determining the
catalog name.public java.lang.String getSchemaName(java.sql.Connection conn) throws java.sql.SQLException
getSchemaName
in interface RDBMSAdapter
conn
- Connection to the datastore
java.sql.SQLException
- Thrown if error occurs in determining the
schema name.public java.lang.String getCatalogSeparator()
getCatalogSeparator
in interface RDBMSAdapter
public boolean supportsEscapeExpressionInLikePredicate()
supportsEscapeExpressionInLikePredicate
in interface ExpressionSupportedFeaturesAdapter
public boolean supportsCatalogsInTableDefinitions()
supportsCatalogsInTableDefinitions
in interface RDBMSAdapter
public boolean supportsSchemasInTableDefinitions()
supportsSchemasInTableDefinitions
in interface RDBMSAdapter
public boolean supportsUnionSyntax()
supportsUnionSyntax
in interface RDBMSAdapter
public boolean supportsExistsSyntax()
supportsExistsSyntax
in interface RDBMSAdapter
public ScalarExpression getEscapedPatternExpression(ScalarExpression patternExpression)
getEscapedPatternExpression
in interface ExpressionPatternAdapter
patternExpression
- The expression that represents one character for a matcher/parser in the database
public java.lang.String getPatternExpressionAnyCharacter()
getPatternExpressionAnyCharacter
in interface ExpressionPatternAdapter
public java.lang.String getPatternExpressionZeroMoreCharacters()
getPatternExpressionZeroMoreCharacters
in interface ExpressionPatternAdapter
public java.lang.String getEscapePatternExpression()
getEscapePatternExpression
in interface ExpressionPatternAdapter
public java.lang.String getEscapeCharacter()
getEscapeCharacter
in interface ExpressionPatternAdapter
public java.lang.String getContinuationString()
public boolean createIndexesBeforeForeignKeys()
createIndexesBeforeForeignKeys
in interface RDBMSAdapter
public boolean includeOrderByColumnsInSelect()
includeOrderByColumnsInSelect
in interface RDBMSAdapter
public boolean includeOrderByColumnsInSelectUsingAlias()
public java.lang.String cartersianProduct(LogicSetExpression Y)
X
and Y
.
Actually, X
is not generated to the expression.
cartersianProduct
in interface ExpressionLogicSetAdapter
Y
- right hand set
public boolean useUnionAll()
useUnionAll
in interface RDBMSAdapter
public boolean supportsAlterTableDropConstraint()
supportsAlterTableDropConstraint
in interface RDBMSAdapter
public boolean supportsAlterTableDropForeignKeyConstraint()
supportsAlterTableDropForeignKeyConstraint
in interface RDBMSAdapter
public boolean supportsDeferredConstraints()
supportsDeferredConstraints
in interface RDBMSAdapter
public boolean supportsLockWithSelectForUpdate()
supportsLockWithSelectForUpdate
in interface RDBMSAdapter
public boolean supportsDistinctWithSelectForUpdate()
supportsDistinctWithSelectForUpdate
in interface RDBMSAdapter
public java.lang.String getSelectWithLockOption()
getSelectWithLockOption
in interface RDBMSAdapter
public boolean getPlaceWithOptionAfterFromClause()
getSelectWithLockOption()
is to be placed right
before the FROM clause, or at the end of the statement
getPlaceWithOptionAfterFromClause
in interface RDBMSAdapter
public boolean getPlaceWithOptionWithinJoinClauses()
getPlaceWithOptionWithinJoinClauses
in interface RDBMSAdapter
public java.lang.String getSelectNewUUIDStmt()
getSelectNewUUIDStmt
in interface RDBMSAdapter
public java.lang.String getNewUUIDFunction()
public boolean supportsForeignKeyUpdateAction(ForeignKey.FKAction action)
supportsForeignKeyUpdateAction
in interface RDBMSAdapter
action
- The update action
public boolean supportsForeignKeyDeleteAction(ForeignKey.FKAction action)
supportsForeignKeyDeleteAction
in interface RDBMSAdapter
action
- The delete action
public boolean supportsPrimaryKeyInCreateStatements()
supportsPrimaryKeyInCreateStatements
in interface RDBMSAdapter
public boolean supportsCheckInCreateStatements()
supportsCheckInCreateStatements
in interface RDBMSAdapter
public boolean supportsCheckConstraintsInEndCreateStatements()
CREATE TABLE XXX ( COL_A int, COL_B char(1), PRIMARY KEY (COL_A), CHECK (COL_B IN ('Y','N')) )
public boolean supportsUniqueConstraintsInEndCreateStatements()
CREATE TABLE XXX ( COL_A int, COL_B char(1), PRIMARY KEY (COL_A), UNIQUE (COL_B ...) )
supportsUniqueConstraintsInEndCreateStatements
in interface RDBMSAdapter
public boolean supportsStatementGetGeneratedKeys()
Statement.getGeneratedKeys()
supportsStatementGetGeneratedKeys
in interface RDBMSAdapter
public boolean supportsBooleanComparison()
supportsBooleanComparison
in interface ExpressionSupportedFeaturesAdapter
public boolean supportsNullsInCandidateKeys()
supportsNullsInCandidateKeys
in interface RDBMSAdapter
public boolean supportsNullsKeywordInColumnOptions()
supportsNullsKeywordInColumnOptions
in interface RDBMSAdapter
public boolean supportsDefaultKeywordInColumnOptions()
supportsDefaultKeywordInColumnOptions
in interface RDBMSAdapter
public boolean supportsDefaultKeywordWithNotNullInColumnOptions()
CREATE TABLE X ( MEMORY_SIZE BIGINT DEFAULT 0 NOT NULL )Some databases only support DEFAULT {ConstantExpression | NULL}
supportsDefaultKeywordWithNotNullInColumnOptions
in interface RDBMSAdapter
public boolean supportsDefaultBeforeNullInColumnOptions()
supportsDefaultBeforeNullInColumnOptions
in interface RDBMSAdapter
public boolean supportsAnsiJoinSyntax()
supportsAnsiJoinSyntax
in interface RDBMSAdapter
public java.lang.String getNonAnsiInnerJoinWhereClause(java.lang.String col1, java.lang.String col2)
getNonAnsiInnerJoinWhereClause
in interface RDBMSAdapter
col1
- The main datastore columncol2
- The secondary column to join to
public java.lang.String getNonAnsiLeftOuterJoinWhereClause(java.lang.String col1, java.lang.String col2)
getNonAnsiLeftOuterJoinWhereClause
in interface RDBMSAdapter
col1
- The main datastore columncol2
- The secondary column to join to
public java.lang.String getNonAnsiRightOuterJoinWhereClause(java.lang.String col1, java.lang.String col2)
col1
- The main datastore columncol2
- The secondary column to join to
public java.lang.String getAutoIncrementStmt(java.lang.String tableName, java.lang.String columnName)
getAutoIncrementStmt
in interface RDBMSAdapter
tableName
- Name of the table that the autoincrement is forcolumnName
- Name of the column that the autoincrement is for
public java.lang.String getAutoIncrementKeyword()
getAutoIncrementKeyword
in interface RDBMSAdapter
public boolean isAutoIncrementingDataType(java.lang.String typeName)
typeName
is auto incremented by the datastore.
isAutoIncrementingDataType
in interface DatastoreAdapter
typeName
- the datastore type name
typeName
has values auto incremented by the datastorepublic boolean supportsAutoIncrementKeysNullSpecification()
supportsAutoIncrementKeysNullSpecification
in interface RDBMSAdapter
public boolean supportsAutoIncrementColumnTypeSpecification()
supportsAutoIncrementColumnTypeSpecification
in interface RDBMSAdapter
public java.lang.String getInsertStatementForNoColumns(Table table)
getInsertStatementForNoColumns
in interface RDBMSAdapter
table
- The table
public 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)
getSequenceCreateStmt
in interface RDBMSAdapter
sequence_name
- Name of the sequencemin
- Minimum value for the sequencemax
- Maximum value for the sequencestart
- Start value for the sequenceincrement
- Increment value for the sequencecache_size
- Cache size for the sequence
public java.lang.String getSequenceNextStmt(java.lang.String sequence_name)
getSequenceNextStmt
in interface RDBMSAdapter
sequence_name
- Name of the sequence
public java.sql.ResultSet getExistingIndexes(java.sql.Connection conn, java.sql.DatabaseMetaData dmd, java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
getExistingIndexes
in interface RDBMSAdapter
conn
- the JDBC connectiondmd
- the DatabaseMetaDatacatalog
- the catalog nameschema
- the schema nametable
- the table name
java.sql.SQLException
public QueryExpression newQueryStatement(DatastoreContainerObject table, ClassLoaderResolver clr)
newQueryStatement
in interface DatastoreAdapter
newQueryStatement
in class AbstractDatastoreAdapter
table
- The table to queryclr
- The ClassLoaderResolver
public QueryExpression newQueryStatement(DatastoreContainerObject table, DatastoreIdentifier rangeVar, ClassLoaderResolver clr)
newQueryStatement
in interface DatastoreAdapter
newQueryStatement
in class AbstractDatastoreAdapter
table
- The table to queryrangeVar
- A range variable for the queryclr
- The ClassLoaderResolver
public LogicSetExpression newTableExpression(QueryExpression qs, DatastoreContainerObject table, DatastoreIdentifier rangeVar)
newTableExpression
in interface RDBMSAdapter
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.
public java.lang.String getCreateTableStatement(TableImpl table, Column[] columns, java.util.Properties props)
CREATE TABLE FOO ( BAR VARCHAR(30), BAZ INTEGER )
getCreateTableStatement
in interface RDBMSAdapter
table
- The table to create.columns
- The columns of the table.props
- Properties for controlling the table creation
public java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk)
ALTER TABLE FOO ADD CONSTRAINT FOO_PK PRIMARY KEY (BAR) ALTER TABLE FOO ADD PRIMARY KEY (BAR)
getAddPrimaryKeyStatement
in interface RDBMSAdapter
pk
- An object describing the primary key.
public java.lang.String getAddCandidateKeyStatement(CandidateKey ck)
ALTER TABLE FOO ADD CONSTRAINT FOO_CK UNIQUE (BAZ) ALTER TABLE FOO ADD UNIQUE (BAZ)
getAddCandidateKeyStatement
in interface RDBMSAdapter
ck
- An object describing the candidate key.
public java.lang.String getAddForeignKeyStatement(ForeignKey fk)
ALTER TABLE FOO ADD CONSTRAINT FOO_FK1 FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2) ALTER TABLE FOO ADD FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2)
getAddForeignKeyStatement
in interface RDBMSAdapter
fk
- An object describing the foreign key.
public java.lang.String getAddColumnStatement(DatastoreContainerObject table, Column col)
getAddColumnStatement
in interface RDBMSAdapter
table
- The tablecol
- The column
public java.lang.String getCreateIndexStatement(Index idx)
CREATE INDEX FOO_N1 ON FOO (BAR,BAZ) [Extended Settings] CREATE UNIQUE INDEX FOO_U1 ON FOO (BAR,BAZ) [Extended Settings]
getCreateIndexStatement
in interface RDBMSAdapter
idx
- An object describing the index.
public java.lang.String getDropTableStatement(DatastoreContainerObject table)
DROP TABLE FOO CASCADE
getDropTableStatement
in interface RDBMSAdapter
table
- The table to drop.
public java.lang.String getDropViewStatement(ViewImpl view)
DROP VIEW FOO
getDropViewStatement
in interface RDBMSAdapter
view
- The view to drop.
public java.lang.String getRangeByLimitSelectClause(long offset, long count)
getRangeByLimitSelectClause
in interface RDBMSAdapter
offset
- The offset to return fromcount
- The number of items to return
public java.lang.String getRangeByLimitWhereClause(long offset, long count)
getRangeByLimitWhereClause
in interface RDBMSAdapter
offset
- The offset to return fromcount
- The number of items to return
public java.lang.String getRangeByRowNumberColumn()
getRangeByRowNumberColumn
in interface RDBMSAdapter
public NumericExpression toNumericExpression(CharacterExpression expr)
(int)'A'
expression.
In SQL, it should compile something like:
ASCII('A')
toNumericExpression
in interface ExpressionConversionAdapter
expr
- The CharacterExpression
public NumericExpression absMethod(ScalarExpression expr)
ABS(str)
absMethod
in interface ExpressionMethodAdapter
expr
- The argument to the abs() method.
public NumericExpression sqrtMethod(ScalarExpression expr)
SQRT(str)
sqrtMethod
in interface ExpressionMethodAdapter
expr
- The argument to the sqrt() method.
public NumericExpression cosMethod(ScalarExpression expr)
COS(str)
cosMethod
in interface ExpressionMethodAdapter
expr
- The argument to the cos() method.
public NumericExpression sinMethod(ScalarExpression expr)
SIN(str)
sinMethod
in interface ExpressionMethodAdapter
expr
- The argument to the sin() method.
public NumericExpression tanMethod(ScalarExpression expr)
TAN(str)
tanMethod
in interface ExpressionMethodAdapter
expr
- The argument to the tan() method.
public NumericExpression acosMethod(ScalarExpression expr)
ACOS(str)
acosMethod
in interface ExpressionMethodAdapter
expr
- The argument to the cos() method.
public NumericExpression asinMethod(ScalarExpression expr)
ASIN(str)
asinMethod
in interface ExpressionMethodAdapter
expr
- The argument to the asin() method.
public NumericExpression atanMethod(ScalarExpression expr)
ATAN(str)
atanMethod
in interface ExpressionMethodAdapter
expr
- The argument to the atan() method.
public BooleanExpression endsWithMethod(ScalarExpression leftOperand, ScalarExpression rightOperand)
endsWithMethod
in interface ExpressionMethodAdapter
leftOperand
- the source stringrightOperand
- The string to compare against.
public NumericExpression expMethod(ScalarExpression expr)
EXP(str)
expMethod
in interface ExpressionMethodAdapter
expr
- The argument to the exp() method.
public NumericExpression logMethod(ScalarExpression expr)
LOG(str)
logMethod
in interface ExpressionMethodAdapter
expr
- The argument to the log() method.
public NumericExpression floorMethod(ScalarExpression expr)
FLOOR(str)
floorMethod
in interface ExpressionMethodAdapter
expr
- The argument to the floor() method.
public NumericExpression ceilMethod(ScalarExpression expr)
CEIL(str)
ceilMethod
in interface ExpressionMethodAdapter
expr
- The argument to the ceil() method.
public NumericExpression lengthMethod(StringExpression str)
CHAR_LENGTH(str)
lengthMethod
in interface ExpressionMethodAdapter
str
- The argument to the length() method.
public StringExpression toStringExpression(NumericExpression expr)
CAST(999999 AS VARCHAR(4000))
toStringExpression
in interface ExpressionConversionAdapter
expr
- The NumericExpression
public StringExpression toStringExpression(StringLiteral expr)
CAST(999999 AS VARCHAR(4000))
toStringExpression
in interface ExpressionConversionAdapter
expr
- The NumericExpression
public StringExpression substringMethod(StringExpression str, NumericExpression begin)
SUBSTRING(str FROM begin)Note that the value of begin is base 0(Java-style), while most SQL string functions use base 1.
substringMethod
in interface ExpressionMethodAdapter
str
- The first argument to the substring() method.begin
- The second argument to the substring() method.
public StringExpression trimMethod(StringExpression str)
TRIM(str)
trimMethod
in interface ExpressionMethodAdapter
str
- The first argument to the trim() method.
public StringExpression substringMethod(StringExpression str, NumericExpression begin, NumericExpression end)
Note that the value of begin is base 0 (Java-style), while most SQL string functions use base 1. Note also that an end position is given, while most SQL substring functions take a length.SUBSTRING(str FROM begin FOR len)
substringMethod
in interface ExpressionMethodAdapter
str
- The first argument to the substring() method.begin
- The second argument to the substring() method.end
- The third argument to the substring() method.
public BooleanExpression startsWithMethod(ScalarExpression source, ScalarExpression str)
source LIKE str%
startsWithMethod
in interface ExpressionMethodAdapter
source
- The expression with the searched stringstr
- The expression for the search string
public NumericExpression indexOfMethod(ScalarExpression source, ScalarExpression str, NumericExpression from)
since LOCATE returns the first character as position 1. Similarly the "pos" is based on the first position being 1.LOCATE(str, substr [,pos])-1
indexOfMethod
in interface ExpressionMethodAdapter
source
- The expression we want to search.str
- The argument to the indexOf() method.from
- The from position
public java.lang.String getOperatorConcat()
getOperatorConcat
in interface ExpressionOperatorAdapter
public ScalarExpression concatOperator(ScalarExpression operand1, ScalarExpression operand2)
If only one operand expression is of type String, then string conversion is performed on the other operand to produce a string at run time. The result is a reference to a String object (newly created, unless the expression is a compile-time constant expression (§15.28))that is the concatenation of the two operand strings. The characters of the left-hand operand precede the characters of the right-hand operand in the newly created string. If an operand of type String is null, then the string "null" is used instead of that operand. "null" is used instead of that operand.
Concatenates two or more character or binary strings, columns, or a combination of strings and column names into one expression (a string operator).
concatOperator
in interface ExpressionOperatorAdapter
operand1
- the left expressionoperand2
- the right expression
public NumericExpression getDayMethod(SqlTemporalExpression date)
DAY(date)
getDayMethod
in interface ExpressionMethodAdapter
date
- The date for the getDay() method.
public NumericExpression getMonthMethod(SqlTemporalExpression date)
MONTH(date)
getMonthMethod
in interface ExpressionMethodAdapter
date
- The date for the getMonth() method.
public NumericExpression getYearMethod(SqlTemporalExpression date)
YEAR(date)
getYearMethod
in interface ExpressionMethodAdapter
date
- The date for the getYear() method.
public NumericExpression getHourMethod(SqlTemporalExpression time)
HOUR(time)
getHourMethod
in interface ExpressionMethodAdapter
time
- The time for the getHour() method.
public NumericExpression getMinuteMethod(SqlTemporalExpression time)
MINUTE(time)
getMinuteMethod
in interface ExpressionMethodAdapter
time
- The time for the getMinute() method.
public NumericExpression getSecondMethod(SqlTemporalExpression time)
SECOND(time)
getSecondMethod
in interface ExpressionMethodAdapter
time
- The time for the getSecond() method.
public java.sql.ResultSet getColumns(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
getColumns
in interface RDBMSAdapter
conn
- Connection to usecatalog
- The catalog (null if none)schema
- The schema (null if none)table
- The table (null if all)
java.sql.SQLException
- Thrown if an error occurspublic java.sql.ResultSet getTables(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema) throws java.sql.SQLException
getTables
in interface RDBMSAdapter
conn
- Connection to usecatalog
- The catalog (null if none)schema
- The schema (null if none)
java.sql.SQLException
- Thrown if an error occurspublic 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
getColumns
in interface RDBMSAdapter
conn
- Connection to usecatalog
- The catalog (null if none)schema
- The schema (null if none)table
- The table (null if all)columnNamePattern
- The column name (null if all)
java.sql.SQLException
- Thrown if an error occurspublic boolean requiresColumnDefaultsInitialising()
requiresColumnDefaultsInitialising
in interface RDBMSAdapter
public java.lang.String toString()
toString
in interface DatastoreAdapter
toString
in class AbstractDatastoreAdapter
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |