org.jpox.store.rdbms.adapter
Class PostgreSQLAdapter

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

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

Version:
$Revision: 1.52 $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jpox.store.rdbms.adapter.DatabaseAdapter
DatabaseAdapter.JDBCTypeInfo
 
Field Summary
static java.lang.String POSTGRESQL_RESERVED_WORDS
          List of Postgresql keywords that aren't in SQL92, SQL99
protected  java.util.Hashtable psqlTypes
           
 
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
PostgreSQLAdapter(java.sql.DatabaseMetaData metadata)
          Constructor.
 
Method Summary
 java.lang.String getAddColumnStatement(org.jpox.store.mapped.DatastoreContainerObject table, Column col)
          Accessor for the SQL statement to add a column to a table.
 java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk, org.jpox.store.mapped.IdentifierFactory factory)
          PostgreSQL allows specification of PRIMARY KEY in the CREATE TABLE, so we need nothing here.
 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 autoincrement sql access statement for this datastore.
 boolean getCharColumnsPaddedWithSpaces()
          Some databases store character strings in CHAR(XX) columns and when read back in have been padded with spaces.
 org.jpox.store.mapped.expression.NumericExpression getDayMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
          Returns the appropriate SQL expression for the JDOQL Date.getDay() method.
 java.lang.String getDropTableStatement(org.jpox.store.mapped.DatastoreContainerObject table)
          Accessor for the statement for dropping a table.
 java.lang.String getEscapePatternExpression()
          The character for escaping patterns.
 org.jpox.store.mapped.expression.NumericExpression getHourMethod(org.jpox.store.mapped.expression.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 and we dont want to specify columns.
 org.jpox.store.mapped.expression.NumericExpression getMinuteMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
          Returns the appropriate SQL expression for the JDOQL Time.getMinute() method.
 org.jpox.store.mapped.expression.NumericExpression getMonthMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
          Returns the appropriate SQL expression for the JDOQL Date.getMonth() method.
 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 LIMUT keyword.
 org.jpox.store.mapped.expression.NumericExpression getSecondMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
          Returns the appropriate SQL expression for the JDOQL Time.getSecond() method.
 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 statement to create the sequence.
 java.lang.String getSequenceNextStmt(java.lang.String sequence_name)
          Accessor for the statement for getting the next id from the sequence for this datastore.
 boolean getSupportsPersistOfUnassignedChar()
          Whether the database server supports persist of an unassigned character ("0x0").
 java.lang.String getVendorID()
          Accessor for the vendor id.
 org.jpox.store.mapped.expression.NumericExpression getYearMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
          Returns the appropriate SQL expression for the JDOQL Date.getYear() method.
 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)
          Returns the appropriate SQL expression for the JDOQL String.indexOf() method.
 boolean isBitReallyBoolean()
          Accessor for whether a JDBC Types.BIT is really mapped in the datastore to a boolean field.
 ColumnInfo newColumnInfo(java.sql.ResultSet rs)
          A factory for ColumnInfo objects.
 ForeignKeyInfo newForeignKeyInfo(java.sql.ResultSet rs)
          A factory for ForeignKeyInfo 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)
          Returns a new TableExpression object appropriate for this DBMS.
 TypeInfo newTypeInfo(java.sql.ResultSet rs)
          A factory for TypeInfo objects.
 boolean supportsAlterTableDropConstraint()
          PostgreSQL has supported the ALTER TABLE tbl-name DROP CONSTRAINT ...
 boolean supportsAnalysisMethods()
          Accessor for whether the SQL extensions CUBE, ROLLUP are supported.
 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 supportsDistinctWithSelectForUpdate()
          Whether this datastore supports using DISTINCT when using SELECT ...
 boolean supportsIdentityFields()
          Whether we support autoincrementing fields.
 boolean supportsLockWithSelectForUpdate()
          Whether this datastore supports locking using SELECT ...
 boolean supportsPrimaryKeyInCreateStatements()
          Whether the datastore supports specification of the primary key in CREATE TABLE statements.
 boolean supportsQueryFetchSize(int size)
          Whether the datastore will support setting the query fetch size to the supplied value.
 boolean supportsSequences()
          Whether we support sequences.
 boolean supportsTransactionIsolationLevel(int isolationLevel)
          Accessor for whether the adapter supports the transaction isolation level Postgresql doesnt support TRANSACTION_NONE.
 
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, getAddForeignKeyStatement, getCatalogName, getCatalogSeparator, getCheckConstraintForValues, getColumns, getColumns, getConnection, getContinuationString, getCreateIndexStatement, getCreateTableStatement, getCurrentDateMethod, getCurrentTimeMethod, getCurrentTimestampMethod, getDatastoreDateStatement, getDriverMajorVersion, getDriverMinorVersion, getDropViewStatement, getEscapeCharacter, getEscapedPatternExpression, getExistingIndexes, getMaxColumnNameLength, getMaxConstraintNameLength, getMaxForeignKeys, getMaxIndexes, getMaxIndexNameLength, getMaxTableNameLength, getNewMappingManager, getNewUUIDFunction, getNonAnsiInnerJoinWhereClause, getNonAnsiLeftOuterJoinWhereClause, getNonAnsiRightOuterJoinWhereClause, getOperatorConcat, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters, getPlaceWithOptionAfterFromClause, getPlaceWithOptionWithinJoinClauses, getRangeByLimitSelectClause, getRangeByRowNumberColumn, getRequiredTransactionIsolationLevel, getSchemaName, getSelectNewUUIDStmt, getSelectWithLockOption, getSurrogateForEmptyStrings, getTables, getTransactionIsolationForSchemaCreation, getTypeInfo, getUnlimitedLengthPrecisionValue, includeOrderByColumnsInSelect, initialiseDatastore, isIdentityFieldDataType, isNullEqualsEmptyStrings, isSQLKeyword, isStoresLowerCaseIdentifiers, isStoresLowerCaseQuotedIdentifiers, isStoresMixedCaseIdentifiers, isStoresMixedCaseQuotedIdentifiers, isStoresUpperCaseIdentifiers, isStoresUpperCaseQuotedIdentifiers, isValidPrimaryKeyType, iteratorReservedWords, iteratorTypeInfo, lengthMethod, loadDatastoreMapping, logConfiguration, logMethod, matchesMethod, newExportedKeyInfo, newQueryStatement, newQueryStatement, parseKeywordList, requiresColumnDefaultsInitialising, setDefaultTypeInfoForJDBCType, sinMethod, sqrtMethod, startsWithMethod, substringMethod, substringMethod, supportsAlterTableDropForeignKeyConstraint, supportsAnsiJoinSyntax, supportsBooleanComparison, supportsCatalogsInTableDefinitions, supportsCheckConstraintsInEndCreateStatements, supportsCheckInCreateStatements, supportsDefaultBeforeNullInColumnOptions, supportsDefaultKeywordInColumnOptions, supportsDefaultKeywordWithNotNullInColumnOptions, supportsDeferredConstraints, supportsEscapeExpressionInLikePredicate, supportsExistsSyntax, supportsForeignKeyDeleteAction, supportsForeignKeyUpdateAction, supportsNullsInCandidateKeys, supportsNullsKeywordInColumnOptions, supportsProjectionInTableReferenceJoins, supportsSchemasInTableDefinitions, supportsSettingBlobUsingSetString, supportsSettingClobUsingSetString, supportsStatementBatching, supportsStatementGetGeneratedKeys, 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, isReservedKeyword, modOperator
 
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, isReservedKeyword, modOperator
 

Field Detail

POSTGRESQL_RESERVED_WORDS

public static final java.lang.String POSTGRESQL_RESERVED_WORDS
List of Postgresql keywords that aren't in SQL92, SQL99

See Also:
Constant Field Values

psqlTypes

protected java.util.Hashtable psqlTypes
Constructor Detail

PostgreSQLAdapter

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

Parameters:
metadata - MetaData for the DB
Method Detail

getVendorID

public java.lang.String getVendorID()
Accessor for the vendor id.

Specified by:
getVendorID in interface org.jpox.store.mapped.DatastoreAdapter
Overrides:
getVendorID in class org.jpox.store.mapped.AbstractDatastoreAdapter
Returns:
The vendor id.

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.

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

newForeignKeyInfo

public ForeignKeyInfo newForeignKeyInfo(java.sql.ResultSet rs)
Description copied from class: DatabaseAdapter
A factory for ForeignKeyInfo objects. This method should always be used instead of directly constructing ForeignKeyInfo 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.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()

Specified by:
newForeignKeyInfo in interface RDBMSAdapter
Overrides:
newForeignKeyInfo in class DatabaseAdapter
Parameters:
rs - The result set returned from DatabaseMetaData.get??portedKeys()
Returns:
The foreign key info

supportsTransactionIsolationLevel

public boolean supportsTransactionIsolationLevel(int isolationLevel)
Accessor for whether the adapter supports the transaction isolation level Postgresql doesnt support TRANSACTION_NONE.

Specified by:
supportsTransactionIsolationLevel in interface RDBMSAdapter
Overrides:
supportsTransactionIsolationLevel in class DatabaseAdapter
Parameters:
isolationLevel - the isolation level
Returns:
Whether the transaction isolation level setting is supported.

isBitReallyBoolean

public boolean isBitReallyBoolean()
Accessor for whether a JDBC Types.BIT is really mapped in the datastore to a boolean field. Postgresql treats Types.BIT as boolean

Specified by:
isBitReallyBoolean in interface org.jpox.store.mapped.DatastoreAdapter
Overrides:
isBitReallyBoolean in class org.jpox.store.mapped.AbstractDatastoreAdapter
Returns:
Whether it is really a boolean

getCharColumnsPaddedWithSpaces

public boolean getCharColumnsPaddedWithSpaces()
Some databases store character strings in CHAR(XX) columns and when read back in have been padded with spaces.

Specified by:
getCharColumnsPaddedWithSpaces in interface RDBMSAdapter
Overrides:
getCharColumnsPaddedWithSpaces in class DatabaseAdapter
Returns:
whether this database pads char(XX) columns with spaces

getSupportsPersistOfUnassignedChar

public boolean getSupportsPersistOfUnassignedChar()
Whether the database server supports persist of an unassigned character ("0x0"). If not, any unassigned character will be replaced by " " (space) on persist.

Specified by:
getSupportsPersistOfUnassignedChar in interface RDBMSAdapter
Overrides:
getSupportsPersistOfUnassignedChar in class DatabaseAdapter
Returns:
Whether we support persisting an unassigned char.

getAddColumnStatement

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

Specified by:
getAddColumnStatement in interface RDBMSAdapter
Overrides:
getAddColumnStatement in class DatabaseAdapter
Parameters:
table - The table
col - The column
Returns:
The SQL necessary to add the column

getInsertStatementForNoColumns

public java.lang.String getInsertStatementForNoColumns(Table table)
Method to return the INSERT statement to use when inserting into a table and we dont want to specify columns. This is the case when we have a single column in the table and that column is autoincrement/identity (and so is assigned automatically in the datastore). Postgresql expects something like
 INSERT INTO tbl VALUES(DEFAULT)
 

Specified by:
getInsertStatementForNoColumns in interface RDBMSAdapter
Overrides:
getInsertStatementForNoColumns in class DatabaseAdapter
Parameters:
table - The table
Returns:
The statement for the INSERT

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.

supportsDistinctWithSelectForUpdate

public boolean supportsDistinctWithSelectForUpdate()
Whether this datastore supports using DISTINCT when using SELECT ... FOR UPDATE.

Specified by:
supportsDistinctWithSelectForUpdate in interface RDBMSAdapter
Overrides:
supportsDistinctWithSelectForUpdate in class DatabaseAdapter
Returns:
whether the datastore supports DISTINCT in same statement as FOR UPDATE

supportsAlterTableDropConstraint

public boolean supportsAlterTableDropConstraint()
PostgreSQL has supported the ALTER TABLE tbl-name DROP CONSTRAINT ... since 7.2

Specified by:
supportsAlterTableDropConstraint in interface RDBMSAdapter
Overrides:
supportsAlterTableDropConstraint in class DatabaseAdapter
Returns:
Whether it supports the ALTER TABLE DROP CONSTRAINT syntax

getAddPrimaryKeyStatement

public java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk,
                                                  org.jpox.store.mapped.IdentifierFactory factory)
PostgreSQL allows specification of PRIMARY KEY in the CREATE TABLE, so we need nothing here.

Specified by:
getAddPrimaryKeyStatement in interface RDBMSAdapter
Overrides:
getAddPrimaryKeyStatement in class DatabaseAdapter
Parameters:
pk - An object describing the primary key.
factory - Identifier factory
Returns:
The PK statement

supportsPrimaryKeyInCreateStatements

public boolean supportsPrimaryKeyInCreateStatements()
Whether the datastore supports specification of the primary key in CREATE TABLE statements.

Specified by:
supportsPrimaryKeyInCreateStatements in interface RDBMSAdapter
Overrides:
supportsPrimaryKeyInCreateStatements in class DatabaseAdapter
Returns:
Whether it allows "PRIMARY KEY ..."

getDropTableStatement

public java.lang.String getDropTableStatement(org.jpox.store.mapped.DatastoreContainerObject table)
Accessor for the statement for dropping a table. PostgreSQL has supported the DROP TABLE tbl-name CASCADE since 7.3.

Specified by:
getDropTableStatement in interface RDBMSAdapter
Overrides:
getDropTableStatement in class DatabaseAdapter
Parameters:
table - The table to drop.
Returns:
The statement for dropping a table.

supportsIdentityFields

public boolean supportsIdentityFields()
Whether we support autoincrementing fields.

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

getAutoIncrementStmt

public java.lang.String getAutoIncrementStmt(Table table,
                                             java.lang.String columnName)
Accessor for the autoincrement sql access statement for this datastore.

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

supportsAutoIncrementKeysNullSpecification

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

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

supportsAutoIncrementColumnTypeSpecification

public boolean supportsAutoIncrementColumnTypeSpecification()
Whether we support auto-increment/identity keys with column type specification.

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

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 statement to create the sequence.

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 statement for getting the next id from the sequence 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

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

supportsQueryFetchSize

public boolean supportsQueryFetchSize(int size)
Whether the datastore will support setting the query fetch size to the supplied value.

Specified by:
supportsQueryFetchSize in interface org.jpox.store.mapped.DatastoreAdapter
Overrides:
supportsQueryFetchSize in class org.jpox.store.mapped.AbstractDatastoreAdapter
Parameters:
size - The value to set to
Returns:
Whether it is supported.

getRangeByLimitWhereClause

public 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 LIMUT keyword.

Specified by:
getRangeByLimitWhereClause in interface RDBMSAdapter
Overrides:
getRangeByLimitWhereClause in class DatabaseAdapter
Parameters:
offset - The offset to return from
count - The number of items to return
Returns:
The SQL to append to allow for ranges using LIMIT.

supportsAnalysisMethods

public boolean supportsAnalysisMethods()
Accessor for whether the SQL extensions CUBE, ROLLUP are supported.

Specified by:
supportsAnalysisMethods in interface RDBMSAdapter
Overrides:
supportsAnalysisMethods in class DatabaseAdapter
Returns:
Whether the SQL extensions CUBE, ROLLUP are supported.

getEscapePatternExpression

public java.lang.String getEscapePatternExpression()
The character for escaping patterns.

Specified by:
getEscapePatternExpression in interface org.jpox.store.mapped.expression.ExpressionPatternAdapter
Overrides:
getEscapePatternExpression in class DatabaseAdapter
Returns:
Escape character(s)

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)
Returns the appropriate SQL expression for the JDOQL String.indexOf() method. It should return something like:

 STRPOS(str, substr [, pos])-1
 
since STRPOS returns the first character as position 1. Similarly the "pos" is based on the first position being 1.

Specified by:
indexOfMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
indexOfMethod in class DatabaseAdapter
Parameters:
source - The expression we want to search.
str - The argument to the indexOf() method.
from - The from position
Returns:
The text of the SQL expression.

getDayMethod

public org.jpox.store.mapped.expression.NumericExpression getDayMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
Returns the appropriate SQL expression for the JDOQL Date.getDay() method. It should return something like:
date_part("day",date)

Specified by:
getDayMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
getDayMethod in class DatabaseAdapter
Parameters:
date - The date for the getDay() method.
Returns:
The text of the SQL expression.

getMonthMethod

public org.jpox.store.mapped.expression.NumericExpression getMonthMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
Returns the appropriate SQL expression for the JDOQL Date.getMonth() method. It should return something like:
date_part("month",date)

Specified by:
getMonthMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
getMonthMethod in class DatabaseAdapter
Parameters:
date - The date for the getMonth() method.
Returns:
The text of the SQL expression.

getYearMethod

public org.jpox.store.mapped.expression.NumericExpression getYearMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
Returns the appropriate SQL expression for the JDOQL Date.getYear() method. It should return something like:
date_part("year",date)

Specified by:
getYearMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
getYearMethod in class DatabaseAdapter
Parameters:
date - The date for the getYear() method.
Returns:
The text of the SQL expression.

getHourMethod

public org.jpox.store.mapped.expression.NumericExpression getHourMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
Returns the appropriate SQL expression for the JDOQL Time.getHour() method. It should return something like:
date_part("hour",time)

Specified by:
getHourMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
getHourMethod in class DatabaseAdapter
Parameters:
time - The time for the getHour() method.
Returns:
The text of the SQL expression.

getMinuteMethod

public org.jpox.store.mapped.expression.NumericExpression getMinuteMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
Returns the appropriate SQL expression for the JDOQL Time.getMinute() method. It should return something like:
date_part("minute",time)

Specified by:
getMinuteMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
getMinuteMethod in class DatabaseAdapter
Parameters:
time - The time for the getMinute() method.
Returns:
The text of the SQL expression.

getSecondMethod

public org.jpox.store.mapped.expression.NumericExpression getSecondMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
Returns the appropriate SQL expression for the JDOQL Time.getSecond() method. It should return something like:
date_part("second",time)

Specified by:
getSecondMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapter
Overrides:
getSecondMethod in class DatabaseAdapter
Parameters:
time - The time for the getSecond() method.
Returns:
The text of the SQL expression.


Copyright © -2008 . All Rights Reserved.