org.jpox.store.rdbms.adapter
Class FirebirdAdapter

java.lang.Object
  extended by org.jpox.store.mapped.AbstractDatastoreAdapter
      extended by org.jpox.store.rdbms.adapter.DatabaseAdapter
          extended by org.jpox.store.rdbms.adapter.FirebirdAdapter
All Implemented Interfaces:
org.jpox.store.mapped.DatastoreAdapter, org.jpox.store.mapped.expression.ExpressionConversionAdapter, org.jpox.store.mapped.expression.ExpressionLogicSetAdapter, org.jpox.store.mapped.expression.ExpressionMethodAdapter, org.jpox.store.mapped.expression.ExpressionOperatorAdapter, org.jpox.store.mapped.expression.ExpressionPatternAdapter, org.jpox.store.mapped.expression.ExpressionSupportedFeaturesAdapter, RDBMSAdapter

public class FirebirdAdapter
extends DatabaseAdapter

Provides methods for adapting SQL language elements to the Firebird database.

Version:
$Revision: 1.19 $
See Also:
DatabaseAdapter

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jpox.store.rdbms.adapter.DatabaseAdapter
DatabaseAdapter.JDBCTypeInfo
 
Field Summary
 
Fields inherited from class org.jpox.store.rdbms.adapter.DatabaseAdapter
catalogSeparator, driverMajorVersion, driverMinorVersion, driverName, driverVersion, LOCALISER, maxColumnNameLength, maxConstraintNameLength, maxIndexNameLength, maxTableNameLength, storesLowerCaseIdentifiers, storesLowerCaseQuotedIdentifiers, storesMixedCaseIdentifiers, storesMixedCaseQuotedIdentifiers, storesMixedCaseQuotedSensitiveIdentifiers, storesMixedCaseSensitiveIdentifiers, storesUpperCaseIdentifiers, storesUpperCaseQuotedIdentifiers, supportsCatalogsInTableDefinitions, supportsSchemasInTableDefinitions, supportsStatementBatching, typesByTypeNumber
 
Fields inherited from class org.jpox.store.mapped.AbstractDatastoreAdapter
datastoreMajorVersion, datastoreMinorVersion, datastoreProductName, datastoreProductVersion, datastoreRevisionVersion, identifierQuoteString, LOCALISER_BASE, mappingManager, reservedKeywords
 
Constructor Summary
FirebirdAdapter(java.sql.DatabaseMetaData metadata)
          Constructs a Firebird adapter based on the given JDBC metadata.
 
Method Summary
 boolean createIndexesBeforeForeignKeys()
          Whether to create indexes before foreign keys.
 java.lang.String getDropTableStatement(org.jpox.store.mapped.DatastoreContainerObject table)
          Returns the appropriate SQL to drop the given table.
 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 getVendorID()
           
 boolean includeOrderByColumnsInSelect()
          Firebird doesn't like 'order by' in selects.
 org.jpox.store.mapped.expression.NumericExpression lengthMethod(org.jpox.store.mapped.expression.StringExpression str)
          Returns the appropriate SQL expression for the JDOQL String.length() method.
 org.jpox.store.mapped.expression.LogicSetExpression newTableExpression(org.jpox.store.mapped.expression.QueryExpression qs, org.jpox.store.mapped.DatastoreContainerObject table, org.jpox.store.mapped.DatastoreIdentifier rangeVar)
          Returns a new TableExpression object appropriate for this DBMS.
 TypeInfo newTypeInfo(java.sql.ResultSet rs)
          Factory for TypeInfo objects.
 org.jpox.store.mapped.expression.StringExpression substringMethod(org.jpox.store.mapped.expression.StringExpression str, org.jpox.store.mapped.expression.NumericExpression begin)
          Returns the appropriate SQL expression for the JDOQL String.substring(str,begin) method.
 org.jpox.store.mapped.expression.StringExpression substringMethod(org.jpox.store.mapped.expression.StringExpression str, org.jpox.store.mapped.expression.NumericExpression begin, org.jpox.store.mapped.expression.NumericExpression end)
          Returns the appropriate SQL expression for the JDOQL String.substring(str,begin,end) method.
 boolean supportsAlterTableDropForeignKeyConstraint()
          Whether this datastore supports ALTER TABLE DROP FOREIGN KEY constraints
 boolean supportsBooleanComparison()
          Whether we support Boolean comparisons.
 boolean supportsDeferredConstraints()
          Whether this datastore supports deferred constraints.
 boolean supportsLockWithSelectForUpdate()
          Whether this datastore supports locking using 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 supportsSequences()
          Whether we support sequences.
 
Methods inherited from class org.jpox.store.rdbms.adapter.DatabaseAdapter
absMethod, acosMethod, addTypeInfo, asinMethod, atanMethod, cartersianProduct, ceilMethod, closeConnection, concatOperator, cosMethod, endsWithMethod, expMethod, floorMethod, getAddCandidateKeyStatement, getAddColumnStatement, getAddForeignKeyStatement, getAddPrimaryKeyStatement, getAutoIncrementKeyword, getAutoIncrementStmt, getCatalogName, getCatalogSeparator, getCharColumnsPaddedWithSpaces, getCheckConstraintForValues, getColumns, getColumns, getConnection, getContinuationString, getCreateIndexStatement, getCreateTableStatement, getCurrentDateMethod, getCurrentTimeMethod, getCurrentTimestampMethod, getDatastoreDateStatement, getDayMethod, getDriverMajorVersion, getDriverMinorVersion, getDropViewStatement, getEscapeCharacter, getEscapedPatternExpression, getEscapePatternExpression, getExistingIndexes, getHourMethod, getInsertStatementForNoColumns, getMaxColumnNameLength, getMaxConstraintNameLength, getMaxForeignKeys, getMaxIndexes, getMaxIndexNameLength, getMaxTableNameLength, getMinuteMethod, getMonthMethod, getNewMappingManager, getNewUUIDFunction, getNonAnsiInnerJoinWhereClause, getNonAnsiLeftOuterJoinWhereClause, getNonAnsiRightOuterJoinWhereClause, getOperatorConcat, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters, getPlaceWithOptionAfterFromClause, getPlaceWithOptionWithinJoinClauses, getRangeByLimitSelectClause, getRangeByLimitWhereClause, getRangeByRowNumberColumn, getRequiredTransactionIsolationLevel, getSchemaName, getSecondMethod, getSelectNewUUIDStmt, getSelectWithLockOption, getSupportsPersistOfUnassignedChar, getSurrogateForEmptyStrings, getTables, getTransactionIsolationForSchemaCreation, getTypeInfo, getUnlimitedLengthPrecisionValue, getYearMethod, indexOfMethod, initialiseDatastore, isIdentityFieldDataType, isNullEqualsEmptyStrings, isSQLKeyword, isStoresLowerCaseIdentifiers, isStoresLowerCaseQuotedIdentifiers, isStoresMixedCaseIdentifiers, isStoresMixedCaseQuotedIdentifiers, isStoresUpperCaseIdentifiers, isStoresUpperCaseQuotedIdentifiers, isValidPrimaryKeyType, iteratorReservedWords, iteratorTypeInfo, loadDatastoreMapping, logConfiguration, logMethod, matchesMethod, newColumnInfo, newExportedKeyInfo, newForeignKeyInfo, newQueryStatement, newQueryStatement, parseKeywordList, requiresColumnDefaultsInitialising, setDefaultTypeInfoForJDBCType, sinMethod, sqrtMethod, startsWithMethod, supportsAlterTableDropConstraint, supportsAnalysisMethods, supportsAnsiJoinSyntax, supportsAutoIncrementColumnTypeSpecification, supportsAutoIncrementKeysNullSpecification, supportsCatalogsInTableDefinitions, supportsCheckConstraintsInEndCreateStatements, supportsCheckInCreateStatements, supportsDefaultBeforeNullInColumnOptions, supportsDefaultKeywordInColumnOptions, supportsDefaultKeywordWithNotNullInColumnOptions, supportsDistinctWithSelectForUpdate, supportsEscapeExpressionInLikePredicate, supportsExistsSyntax, supportsForeignKeyDeleteAction, supportsForeignKeyUpdateAction, supportsPrimaryKeyInCreateStatements, supportsProjectionInTableReferenceJoins, supportsSchemasInTableDefinitions, supportsSettingBlobUsingSetString, supportsSettingClobUsingSetString, supportsStatementBatching, supportsStatementGetGeneratedKeys, supportsTransactionIsolationLevel, supportsUnionSyntax, supportsUniqueConstraintsInEndCreateStatements, tanMethod, toNumericExpression, toString, toStringExpression, toStringExpression, translateMethod, trimMethod, useUnionAll
 
Methods inherited from class org.jpox.store.mapped.AbstractDatastoreAdapter
getAdapterTime, getDatastoreMajorVersion, getDatastoreMinorVersion, getIdentifierQuoteString, getMapping, getMapping, getMapping, getMapping, getMapping, getMappingManager, getMiliseconds, getTime, isBitReallyBoolean, isReservedKeyword, modOperator, supportsIdentityFields, supportsQueryFetchSize
 
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
 
Methods inherited from interface org.jpox.store.mapped.DatastoreAdapter
getAdapterTime, getDatastoreMajorVersion, getDatastoreMinorVersion, getMapping, getMapping, getMapping, getMapping, getMappingManager, isBitReallyBoolean, isReservedKeyword, modOperator, supportsIdentityFields, supportsQueryFetchSize
 

Constructor Detail

FirebirdAdapter

public FirebirdAdapter(java.sql.DatabaseMetaData metadata)
Constructs a Firebird adapter based on the given JDBC metadata.

Parameters:
metadata - the database metadata.
Method Detail

getVendorID

public java.lang.String getVendorID()
Specified by:
getVendorID in interface org.jpox.store.mapped.DatastoreAdapter
Overrides:
getVendorID in class org.jpox.store.mapped.AbstractDatastoreAdapter

getDropTableStatement

public java.lang.String getDropTableStatement(org.jpox.store.mapped.DatastoreContainerObject table)
Description copied from class: DatabaseAdapter
Returns the appropriate SQL to drop the given table. It should return something like:

 DROP TABLE FOO CASCADE
 

Specified by:
getDropTableStatement in interface RDBMSAdapter
Overrides:
getDropTableStatement in class DatabaseAdapter
Parameters:
table - The table to drop.
Returns:
The text of the SQL statement.

supportsDeferredConstraints

public boolean supportsDeferredConstraints()
Description copied from class: DatabaseAdapter
Whether this datastore supports deferred constraints.

Specified by:
supportsDeferredConstraints in interface RDBMSAdapter
Overrides:
supportsDeferredConstraints in class DatabaseAdapter
Returns:
whether we support deferred constraints.

createIndexesBeforeForeignKeys

public boolean createIndexesBeforeForeignKeys()
Whether to create indexes before foreign keys.

Specified by:
createIndexesBeforeForeignKeys in interface RDBMSAdapter
Overrides:
createIndexesBeforeForeignKeys in class DatabaseAdapter
Returns:
Whether to create indexes before foreign keys

supportsBooleanComparison

public boolean supportsBooleanComparison()
Description copied from class: DatabaseAdapter
Whether we support Boolean comparisons.

Specified by:
supportsBooleanComparison in interface org.jpox.store.mapped.expression.ExpressionSupportedFeaturesAdapter
Overrides:
supportsBooleanComparison in class DatabaseAdapter
Returns:
whether we support Boolean comparisons.

supportsNullsInCandidateKeys

public boolean supportsNullsInCandidateKeys()
Description copied from class: DatabaseAdapter
Whether we support NULLs in candidate keys.

Specified by:
supportsNullsInCandidateKeys in interface RDBMSAdapter
Overrides:
supportsNullsInCandidateKeys in class DatabaseAdapter
Returns:
whether we support NULLs in candidate keys.

supportsNullsKeywordInColumnOptions

public boolean supportsNullsKeywordInColumnOptions()
Whether the database support NULLs in the column options for table creation.

Specified by:
supportsNullsKeywordInColumnOptions in interface RDBMSAdapter
Overrides:
supportsNullsKeywordInColumnOptions in class DatabaseAdapter
Returns:
whether the database support NULLs in the column options for table creation.

includeOrderByColumnsInSelect

public boolean includeOrderByColumnsInSelect()
Firebird doesn't like 'order by' in selects.

Specified by:
includeOrderByColumnsInSelect in interface RDBMSAdapter
Overrides:
includeOrderByColumnsInSelect in class DatabaseAdapter
Returns:
Whether to include ORDER BY in SELECTs, always false for Firebird

supportsAlterTableDropForeignKeyConstraint

public boolean supportsAlterTableDropForeignKeyConstraint()
Whether this datastore supports ALTER TABLE DROP FOREIGN KEY constraints

Specified by:
supportsAlterTableDropForeignKeyConstraint in interface RDBMSAdapter
Overrides:
supportsAlterTableDropForeignKeyConstraint in class DatabaseAdapter
Returns:
whether we support ALTER TABLE DROP FOREIGN KEY constraints

supportsLockWithSelectForUpdate

public boolean supportsLockWithSelectForUpdate()
Whether this datastore supports locking using SELECT ... FOR UPDATE.

Specified by:
supportsLockWithSelectForUpdate in interface RDBMSAdapter
Overrides:
supportsLockWithSelectForUpdate in class DatabaseAdapter
Returns:
whether we support locking using SELECT ... FOR UPDATE.

newTableExpression

public org.jpox.store.mapped.expression.LogicSetExpression newTableExpression(org.jpox.store.mapped.expression.QueryExpression qs,
                                                                              org.jpox.store.mapped.DatastoreContainerObject table,
                                                                              org.jpox.store.mapped.DatastoreIdentifier rangeVar)
Description copied from class: DatabaseAdapter
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.

Specified by:
newTableExpression in interface RDBMSAdapter
Overrides:
newTableExpression in class DatabaseAdapter
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

lengthMethod

public org.jpox.store.mapped.expression.NumericExpression lengthMethod(org.jpox.store.mapped.expression.StringExpression str)
Description copied from class: DatabaseAdapter
Returns the appropriate SQL expression for the JDOQL String.length() method. It should return something like:

 CHAR_LENGTH(str)
 

Specified by:
lengthMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
lengthMethod in class DatabaseAdapter
Parameters:
str - The argument to the length() method.
Returns:
The text of the SQL expression.

substringMethod

public org.jpox.store.mapped.expression.StringExpression substringMethod(org.jpox.store.mapped.expression.StringExpression str,
                                                                         org.jpox.store.mapped.expression.NumericExpression begin)
Description copied from class: DatabaseAdapter
Returns the appropriate SQL expression for the JDOQL String.substring(str,begin) method. It should return something like:

 SUBSTRING(str FROM begin)
 
Note that the value of begin is base 0(Java-style), while most SQL string functions use base 1.

Specified by:
substringMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
substringMethod in class DatabaseAdapter
Parameters:
str - The first argument to the substring() method.
begin - The second argument to the substring() method.
Returns:
The text of the SQL expression.

substringMethod

public org.jpox.store.mapped.expression.StringExpression substringMethod(org.jpox.store.mapped.expression.StringExpression str,
                                                                         org.jpox.store.mapped.expression.NumericExpression begin,
                                                                         org.jpox.store.mapped.expression.NumericExpression end)
Description copied from class: DatabaseAdapter
Returns the appropriate SQL expression for the JDOQL String.substring(str,begin,end) method. It should return something like:

 SUBSTRING(str FROM begin FOR len)
 
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.

Specified by:
substringMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
substringMethod in class DatabaseAdapter
Parameters:
str - The first argument to the substring() method.
begin - The second argument to the substring() method.
end - The third argument to the substring() method.
Returns:
The text of the SQL expression.

newTypeInfo

public TypeInfo newTypeInfo(java.sql.ResultSet rs)
Factory for TypeInfo objects.

Overrides:
newTypeInfo in class DatabaseAdapter
Parameters:
rs - The ResultSet from DatabaseMetaData.getTypeInfo().
Returns:
A TypeInfo object.

supportsSequences

public boolean supportsSequences()
Whether we support sequences.

Specified by:
supportsSequences in interface org.jpox.store.mapped.DatastoreAdapter
Specified by:
supportsSequences in interface RDBMSAdapter
Overrides:
supportsSequences in class org.jpox.store.mapped.AbstractDatastoreAdapter
Returns:
whether we support sequences.

getSequenceCreateStmt

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)
Accessor for the sequence create statement for this datastore. TODO Change param types to int.

Specified by:
getSequenceCreateStmt in interface RDBMSAdapter
Overrides:
getSequenceCreateStmt in class DatabaseAdapter
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

getSequenceNextStmt

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

Specified by:
getSequenceNextStmt in interface RDBMSAdapter
Overrides:
getSequenceNextStmt in class DatabaseAdapter
Parameters:
sequence_name - Name of the sequence
Returns:
The statement for getting the next id for the sequence


Copyright © -2008 . All Rights Reserved.