|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Adapter for relational databases
Field Summary |
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 |
Method Summary | |
boolean |
createIndexesBeforeForeignKeys()
Whether to create indexes before foreign keys. |
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 auto-increment/identity keyword for generating DDLs. |
java.lang.String |
getAutoIncrementStmt(java.lang.String tableName,
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 |
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.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. |
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.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 |
java.lang.String |
getIdentifierQuoteString()
Accessor for an identifier quote string. |
java.lang.String |
getInsertStatementForNoColumns(Table table)
Method to retutn 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 datastore. |
int |
getMaxIndexes()
Accessor for the maximum indexes by schema permitted 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. |
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. |
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. |
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. |
int |
getUnlimitedLengthPrecisionValue(TypeInfo typeInfo)
Returns the precision value to be used when creating string columns of "unlimited" length. |
boolean |
includeOrderByColumnsInSelect()
Whether to include ORDER BY columns in a SELECT. |
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 |
ColumnInfo |
newColumnInfo(java.sql.ResultSet rs)
A factory for ColumnInfo objects. |
ForeignKeyInfo |
newForeignKeyInfo(java.sql.ResultSet rs)
A factory for ForeignKeyInfo objects. |
LogicSetExpression |
newTableExpression(QueryExpression qs,
DatastoreContainerObject table,
DatastoreIdentifier rangeVar)
Returns a new TableExpression object appropriate for this DBMS. |
boolean |
requiresColumnDefaultsInitialising()
Accessor for whether the column defaults need initialising for this datastore |
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 auto-increment/identity keys with nullability specification. |
boolean |
supportsCatalogsInTableDefinitions()
Whether this datastore supports the use of the catalog name in SQL table definitions (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 |
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 |
supportsSequences()
Whether we support sequences. |
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 |
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). |
boolean |
useUnionAll()
Union combines the results of two or more queries into a single result set. |
Methods inherited from interface org.jpox.store.expression.ExpressionConversionAdapter |
toNumericExpression, toStringExpression, toStringExpression |
Methods inherited from interface org.jpox.store.expression.ExpressionOperatorAdapter |
concatOperator, getOperatorConcat |
Methods inherited from interface org.jpox.store.expression.ExpressionMethodAdapter |
absMethod, acosMethod, asinMethod, atanMethod, ceilMethod, cosMethod, endsWithMethod, expMethod, floorMethod, getDayMethod, getHourMethod, getMinuteMethod, getMonthMethod, getSecondMethod, getYearMethod, indexOfMethod, lengthMethod, logMethod, sinMethod, sqrtMethod, startsWithMethod, substringMethod, substringMethod, tanMethod, trimMethod |
Methods inherited from interface org.jpox.store.expression.ExpressionSupportedFeaturesAdapter |
supportsBooleanComparison, supportsEscapeExpressionInLikePredicate |
Methods inherited from interface org.jpox.store.expression.ExpressionPatternAdapter |
getEscapeCharacter, getEscapedPatternExpression, getEscapePatternExpression, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters |
Methods inherited from interface org.jpox.store.expression.ExpressionLogicSetAdapter |
cartersianProduct |
Method Detail |
public java.lang.String getRangeByLimitSelectClause(long offset, long count)
offset
- The offset to return fromcount
- The number of items to return
public java.lang.String getRangeByLimitWhereClause(long offset, long count)
offset
- The offset to return fromcount
- The number of items to return
public java.lang.String getRangeByRowNumberColumn()
public int getMaxForeignKeys()
public int getMaxIndexes()
public java.lang.String getCatalogSeparator()
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()
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()
rs
- The result set returned from DatabaseMetaData.get??portedKeys()
public java.lang.String getIdentifierQuoteString()
getIdentifierQuoteString
in interface DatastoreAdapter
public boolean supportsCatalogsInTableDefinitions()
public boolean supportsSchemasInTableDefinitions()
public boolean supportsUnionSyntax()
public boolean supportsExistsSyntax()
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
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 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
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 java.sql.ResultSet getTables(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema) throws java.sql.SQLException
conn
- Connection to usecatalog
- The catalog (null if none)schema
- The schema (null if none)
java.sql.SQLException
- Thrown if an error occurspublic boolean supportsForeignKeyUpdateAction(ForeignKey.FKAction action)
action
- The update action
public boolean supportsForeignKeyDeleteAction(ForeignKey.FKAction action)
action
- The delete action
public boolean supportsDeferredConstraints()
public boolean includeOrderByColumnsInSelect()
public java.lang.String getInsertStatementForNoColumns(Table table)
table
- The table
public int getMaxConstraintNameLength()
public int getMaxColumnNameLength()
public boolean isBitReallyBoolean()
public boolean supportsSettingBlobUsingSetString()
public boolean supportsSettingClobUsingSetString()
public int getUnlimitedLengthPrecisionValue(TypeInfo typeInfo)
TypeInfo.precision
). However, for some
types in some databases the value must be computed specially.
typeInfo
- the typeInfo object for which the precision value is
needed.
public boolean supportsDefaultBeforeNullInColumnOptions()
public boolean supportsDefaultKeywordInColumnOptions()
public boolean supportsDefaultKeywordWithNotNullInColumnOptions()
CREATE TABLE X ( MEMORY_SIZE BIGINT DEFAULT 0 NOT NULL )Some databases only support DEFAULT {ConstantExpression | NULL}
public boolean supportsNullsKeywordInColumnOptions()
public boolean supportsCheckInCreateStatements()
public java.lang.String getAutoIncrementStmt(java.lang.String tableName, java.lang.String columnName)
tableName
- Name of table (that the autoincrement is for)columnName
- (that the autoincrement is for)
public java.lang.String getAutoIncrementKeyword()
public boolean supportsAutoIncrementKeysNullSpecification()
public boolean supportsAutoIncrementColumnTypeSpecification()
public boolean supportsUniqueConstraintsInEndCreateStatements()
CREATE TABLE XXX ( COL_A int, COL_B char(1), PRIMARY KEY (COL_A), UNIQUE (COL_B ...) )
public int getMaxTableNameLength()
public int getMaxIndexNameLength()
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.
word
- The word to test.
true
if word is a SQL key word for
this DBMS. The comparison is case-insensitive.SQLConstants
public java.lang.String getDropTableStatement(DatastoreContainerObject table)
DROP TABLE FOO CASCADE
table
- The table to drop.
public java.lang.String getAddCandidateKeyStatement(CandidateKey ck)
ALTER TABLE FOO ADD CONSTRAINT FOO_CK UNIQUE (BAZ)
ck
- An object describing the candidate key.
public boolean supportsNullsInCandidateKeys()
public boolean isValidPrimaryKeyType(int datatype)
datatype
- The JDBC type.
public java.lang.String getAddColumnStatement(DatastoreContainerObject table, Column col)
table
- The tablecol
- The column
public boolean createIndexesBeforeForeignKeys()
public boolean supportsAlterTableDropConstraint()
public boolean supportsAlterTableDropForeignKeyConstraint()
public java.lang.String getCreateIndexStatement(Index idx)
CREATE INDEX FOO_N1 ON FOO (BAR,BAZ) CREATE UNIQUE INDEX FOO_U1 ON FOO (BAR,BAZ)
idx
- An object describing the index.
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
conn
- the JDBC connectiondmd
- the DatabaseMetaDatacatalog
- the catalog nameschema
- the schema nametable
- the table name
java.sql.SQLException
public java.lang.String getCreateTableStatement(TableImpl table, Column[] columns, java.util.Properties props)
CREATE TABLE FOO (BAR VARCHAR(30), BAZ INTEGER)
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)
pk
- An object describing the primary key.
public java.lang.String getAddForeignKeyStatement(ForeignKey fk)
ALTER TABLE FOO ADD CONSTRAINT FOO_FK1 FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2)
fk
- An object describing the foreign key.
public java.lang.String getDropViewStatement(ViewImpl view)
DROP VIEW FOO
view
- The view to drop.
public TypeInfo getTypeInfo(int dataType) throws UnsupportedDataTypeException
dataType
- JDBC type number of the data type.
UnsupportedDataTypeException
- Thrown if the specified datatype is
not supported.public boolean isNullEqualsEmptyStrings()
public java.lang.String getSurrogateForEmptyStrings()
public boolean supportsSequences()
supportsSequences
in interface DatastoreAdapter
public boolean requiresColumnDefaultsInitialising()
public int getTransactionIsolationForSchemaCreation()
public java.lang.String getCatalogName(java.sql.Connection conn) throws java.sql.SQLException
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
conn
- Connection to the datastore
java.sql.SQLException
- Thrown if error occurs in determining the
schema name.public boolean supportsAnsiJoinSyntax()
public java.lang.String getNonAnsiLeftOuterJoinWhereClause(java.lang.String col1, java.lang.String col2)
col1
- The main datastore columncol2
- The secondary column to join to
public java.lang.String getNonAnsiInnerJoinWhereClause(java.lang.String col1, java.lang.String col2)
col1
- The main datastore columncol2
- The secondary column to join to
public boolean supportsLockWithSelectForUpdate()
public java.lang.String getSelectWithLockOption()
public boolean getPlaceWithOptionAfterFromClause()
getSelectWithLockOption()
is to be placed right
before the FROM clause, or at the end of the statement
public boolean getPlaceWithOptionWithinJoinClauses()
public LogicSetExpression newTableExpression(QueryExpression qs, DatastoreContainerObject table, DatastoreIdentifier rangeVar)
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 boolean useUnionAll()
public boolean supportsDistinctWithSelectForUpdate()
public java.lang.String getSelectNewUUIDStmt()
public java.lang.String getSequenceNextStmt(java.lang.String sequence_name)
sequence_name
- Name of the sequence
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)
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.util.Iterator iteratorTypeInfo()
public java.util.Iterator iteratorReservedWords()
public boolean supportsPrimaryKeyInCreateStatements()
public boolean supportsStatementGetGeneratedKeys()
Statement.getGeneratedKeys()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |