org.jpox.store.rdbms.adapter
Class SybaseAdapter

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.SybaseAdapter
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 SybaseAdapter
extends DatabaseAdapter

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

Version:
$Revision: 1.23 $

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
SybaseAdapter(java.sql.DatabaseMetaData metadata)
          Constructor.
 
Method Summary
 java.lang.String getAutoIncrementKeyword()
          Accessor for the auto-increment keyword for generating DDLs (CREATE TABLEs...).
 java.lang.String getAutoIncrementStmt(Table table, java.lang.String columnName)
          Accessor for the auto-increment sql statement for this datastore.
 java.lang.String getDropTableStatement(org.jpox.store.mapped.DatastoreContainerObject table)
          Accessor for the DROP TABLE statement for Sybase.
 java.lang.String getVendorID()
           
 org.jpox.store.mapped.expression.NumericExpression indexOfMethod(org.jpox.store.mapped.expression.ScalarExpression source, org.jpox.store.mapped.expression.ScalarExpression str, org.jpox.store.mapped.expression.NumericExpression from)
          Method to handle the indexOf operation.
 ColumnInfo newColumnInfo(java.sql.ResultSet rs)
          A factory for ColumnInfo objects.
 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)
          Accessor for TableExpression for Sybase.
 TypeInfo newTypeInfo(java.sql.ResultSet rs)
          A 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 supportsAutoIncrementKeysNullSpecification()
          Whether we support auto-increment/identity keys with nullability spec.
 boolean supportsBooleanComparison()
          Accessor for whether Sybase supports Boolean comparisons.
 boolean supportsDeferredConstraints()
          Accessor for whether Sybase supports deferred constraints.
 boolean supportsIdentityFields()
          Whether we support auto-increment fields.
 boolean supportsLockWithSelectForUpdate()
          Whether this datastore supports locking using SELECT ...
 
Methods inherited from class org.jpox.store.rdbms.adapter.DatabaseAdapter
absMethod, acosMethod, addTypeInfo, asinMethod, atanMethod, cartersianProduct, ceilMethod, closeConnection, concatOperator, cosMethod, createIndexesBeforeForeignKeys, endsWithMethod, expMethod, floorMethod, getAddCandidateKeyStatement, getAddColumnStatement, getAddForeignKeyStatement, getAddPrimaryKeyStatement, 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, getSequenceCreateStmt, getSequenceNextStmt, getSupportsPersistOfUnassignedChar, getSurrogateForEmptyStrings, getTables, getTransactionIsolationForSchemaCreation, getTypeInfo, getUnlimitedLengthPrecisionValue, getYearMethod, includeOrderByColumnsInSelect, initialiseDatastore, isIdentityFieldDataType, isNullEqualsEmptyStrings, isSQLKeyword, isStoresLowerCaseIdentifiers, isStoresLowerCaseQuotedIdentifiers, isStoresMixedCaseIdentifiers, isStoresMixedCaseQuotedIdentifiers, isStoresUpperCaseIdentifiers, isStoresUpperCaseQuotedIdentifiers, isValidPrimaryKeyType, iteratorReservedWords, iteratorTypeInfo, lengthMethod, loadDatastoreMapping, logConfiguration, logMethod, matchesMethod, newExportedKeyInfo, newForeignKeyInfo, newQueryStatement, newQueryStatement, parseKeywordList, requiresColumnDefaultsInitialising, setDefaultTypeInfoForJDBCType, sinMethod, sqrtMethod, startsWithMethod, supportsAlterTableDropConstraint, supportsAlterTableDropForeignKeyConstraint, supportsAnalysisMethods, supportsAnsiJoinSyntax, supportsAutoIncrementColumnTypeSpecification, supportsCatalogsInTableDefinitions, supportsCheckConstraintsInEndCreateStatements, supportsCheckInCreateStatements, supportsDefaultBeforeNullInColumnOptions, supportsDefaultKeywordInColumnOptions, supportsDefaultKeywordWithNotNullInColumnOptions, supportsDistinctWithSelectForUpdate, supportsEscapeExpressionInLikePredicate, supportsExistsSyntax, supportsForeignKeyDeleteAction, supportsForeignKeyUpdateAction, supportsNullsInCandidateKeys, supportsNullsKeywordInColumnOptions, 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, supportsQueryFetchSize, supportsSequences
 
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.mapped.DatastoreAdapter
getAdapterTime, getDatastoreMajorVersion, getDatastoreMinorVersion, getMapping, getMapping, getMapping, getMapping, getMappingManager, isBitReallyBoolean, isReservedKeyword, modOperator, supportsQueryFetchSize
 

Constructor Detail

SybaseAdapter

public SybaseAdapter(java.sql.DatabaseMetaData metadata)
Constructor.

Parameters:
metadata - MetaData for the DB
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)
Accessor for the DROP TABLE statement for Sybase. Sybase doesnt support CASCADE CONSTRAINTS so we just return a simple DROP TABLE table-name

Specified by:
getDropTableStatement in interface RDBMSAdapter
Overrides:
getDropTableStatement in class DatabaseAdapter
Parameters:
table - The table to drop.
Returns:
The DROP TABLE statement

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)
Accessor for TableExpression for Sybase. Sybase (TransactSQL) accepts the TableExprAsJoins style. The TableExprAsSubjoins doesnt work here.

Specified by:
newTableExpression in interface RDBMSAdapter
Overrides:
newTableExpression in class DatabaseAdapter
Parameters:
qs - The query statement
table - The table in question
rangeVar - range variable (?)
Returns:
The Table Expression

supportsDeferredConstraints

public boolean supportsDeferredConstraints()
Accessor for whether Sybase supports deferred constraints. Sybase doesnt support INITIALLY DEFERRED keywords so we return false.

Specified by:
supportsDeferredConstraints in interface RDBMSAdapter
Overrides:
supportsDeferredConstraints in class DatabaseAdapter
Returns:
Whether Sybase supports deferred constraints

supportsBooleanComparison

public boolean supportsBooleanComparison()
Accessor for whether Sybase supports Boolean comparisons.

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

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.

newColumnInfo

public ColumnInfo newColumnInfo(java.sql.ResultSet rs)
Description copied from class: DatabaseAdapter
A factory for ColumnInfo objects. This method should always be used instead of directly constructing ColumnInfo objects in order to give the DatabaseAdapter an opportunity to modify and/or correct the metadata obtained from the JDBC driver. The column information object is constructed from the current row of the given result set. The 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()

Specified by:
newColumnInfo in interface RDBMSAdapter
Overrides:
newColumnInfo in class DatabaseAdapter
Parameters:
rs - The result set returned from DatabaseMetaData.getColumns().
Returns:
The column info

newTypeInfo

public TypeInfo newTypeInfo(java.sql.ResultSet rs)
Description copied from class: DatabaseAdapter
A factory for TypeInfo objects. This method should always be used instead of directly constructing TypeInfo objects in order to give the DatabaseAdapter an opportunity to modify and/or correct the metadata obtained from the JDBC driver. The type information object is constructed from the current row of the given result set. The 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()

Overrides:
newTypeInfo in class DatabaseAdapter
Parameters:
rs - The result set returned from DatabaseMetaData.getTypeInfo().
Returns:
A TypeInfo object constructed from the current result set row, or null if the type indicated by this row should be excluded from use.

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.

indexOfMethod

public org.jpox.store.mapped.expression.NumericExpression indexOfMethod(org.jpox.store.mapped.expression.ScalarExpression source,
                                                                        org.jpox.store.mapped.expression.ScalarExpression str,
                                                                        org.jpox.store.mapped.expression.NumericExpression from)
Method to handle the indexOf operation.

Specified by:
indexOfMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
indexOfMethod in class DatabaseAdapter
Parameters:
source - The expression with the searched string
str - The expression for the search string
from - The from position (or null if not specified)
Returns:
The expression.

getAutoIncrementStmt

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

Specified by:
getAutoIncrementStmt in interface RDBMSAdapter
Overrides:
getAutoIncrementStmt in class DatabaseAdapter
Parameters:
table - Name of the table that the autoincrement is for
columnName - Name of the column that the autoincrement is for
Returns:
The statement for getting the latest auto-increment key

getAutoIncrementKeyword

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

Specified by:
getAutoIncrementKeyword in interface RDBMSAdapter
Overrides:
getAutoIncrementKeyword in class DatabaseAdapter
Returns:
The keyword for a column using auto-increment

supportsIdentityFields

public boolean supportsIdentityFields()
Whether we support auto-increment fields.

Specified by:
supportsIdentityFields in interface org.jpox.store.mapped.DatastoreAdapter
Overrides:
supportsIdentityFields in class org.jpox.store.mapped.AbstractDatastoreAdapter
Returns:
whether we support auto-increment fields.

supportsAutoIncrementKeysNullSpecification

public boolean supportsAutoIncrementKeysNullSpecification()
Whether we support auto-increment/identity keys with nullability spec.

Specified by:
supportsAutoIncrementKeysNullSpecification in interface RDBMSAdapter
Overrides:
supportsAutoIncrementKeysNullSpecification in class DatabaseAdapter
Returns:
whether we support auto-increment keys with nullability spec.


Copyright © -2008 . All Rights Reserved.