|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpox.store.mapped.AbstractDatastoreAdapter
org.jpox.store.rdbms.adapter.DatabaseAdapter
org.jpox.store.rdbms.adapter.PostgreSQLAdapter
public class PostgreSQLAdapter
Provides methods for adapting SQL language elements to the PostgreSQL database.
| 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.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.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 |
|---|
public static final java.lang.String POSTGRESQL_RESERVED_WORDS
protected java.util.Hashtable psqlTypes
| Constructor Detail |
|---|
public PostgreSQLAdapter(java.sql.DatabaseMetaData metadata)
metadata - MetaData for the DB| Method Detail |
|---|
public java.lang.String getVendorID()
getVendorID in interface org.jpox.store.mapped.DatastoreAdaptergetVendorID in class org.jpox.store.mapped.AbstractDatastoreAdapterpublic TypeInfo newTypeInfo(java.sql.ResultSet rs)
DatabaseAdapterResultSet 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()
newTypeInfo in class DatabaseAdapterrs - 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)
DatabaseAdapterResultSet 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 RDBMSAdapternewColumnInfo in class DatabaseAdapterrs - The result set returned from DatabaseMetaData.getColumns().
public ForeignKeyInfo newForeignKeyInfo(java.sql.ResultSet rs)
DatabaseAdapterResultSet 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 RDBMSAdapternewForeignKeyInfo in class DatabaseAdapterrs - The result set returned from DatabaseMetaData.get??portedKeys()
public boolean supportsTransactionIsolationLevel(int isolationLevel)
supportsTransactionIsolationLevel in interface RDBMSAdaptersupportsTransactionIsolationLevel in class DatabaseAdapterisolationLevel - the isolation level
public boolean isBitReallyBoolean()
isBitReallyBoolean in interface org.jpox.store.mapped.DatastoreAdapterisBitReallyBoolean in class org.jpox.store.mapped.AbstractDatastoreAdapterpublic boolean getCharColumnsPaddedWithSpaces()
getCharColumnsPaddedWithSpaces in interface RDBMSAdaptergetCharColumnsPaddedWithSpaces in class DatabaseAdapterpublic boolean getSupportsPersistOfUnassignedChar()
getSupportsPersistOfUnassignedChar in interface RDBMSAdaptergetSupportsPersistOfUnassignedChar in class DatabaseAdapter
public java.lang.String getAddColumnStatement(org.jpox.store.mapped.DatastoreContainerObject table,
Column col)
getAddColumnStatement in interface RDBMSAdaptergetAddColumnStatement in class DatabaseAdaptertable - The tablecol - The column
public java.lang.String getInsertStatementForNoColumns(Table table)
INSERT INTO tbl VALUES(DEFAULT)
getInsertStatementForNoColumns in interface RDBMSAdaptergetInsertStatementForNoColumns in class DatabaseAdaptertable - The table
public boolean supportsLockWithSelectForUpdate()
supportsLockWithSelectForUpdate in interface RDBMSAdaptersupportsLockWithSelectForUpdate in class DatabaseAdapterpublic boolean supportsDistinctWithSelectForUpdate()
supportsDistinctWithSelectForUpdate in interface RDBMSAdaptersupportsDistinctWithSelectForUpdate in class DatabaseAdapterpublic boolean supportsAlterTableDropConstraint()
supportsAlterTableDropConstraint in interface RDBMSAdaptersupportsAlterTableDropConstraint in class DatabaseAdapter
public java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk,
org.jpox.store.mapped.IdentifierFactory factory)
getAddPrimaryKeyStatement in interface RDBMSAdaptergetAddPrimaryKeyStatement in class DatabaseAdapterpk - An object describing the primary key.factory - Identifier factory
public boolean supportsPrimaryKeyInCreateStatements()
supportsPrimaryKeyInCreateStatements in interface RDBMSAdaptersupportsPrimaryKeyInCreateStatements in class DatabaseAdapterpublic java.lang.String getDropTableStatement(org.jpox.store.mapped.DatastoreContainerObject table)
getDropTableStatement in interface RDBMSAdaptergetDropTableStatement in class DatabaseAdaptertable - The table to drop.
public boolean supportsIdentityFields()
supportsIdentityFields in interface org.jpox.store.mapped.DatastoreAdaptersupportsIdentityFields in class org.jpox.store.mapped.AbstractDatastoreAdapter
public java.lang.String getAutoIncrementStmt(Table table,
java.lang.String columnName)
getAutoIncrementStmt in interface RDBMSAdaptergetAutoIncrementStmt in class DatabaseAdaptertable - table that the autoincrement is forcolumnName - Name of the column that the autoincrement is for
public java.lang.String getAutoIncrementKeyword()
getAutoIncrementKeyword in interface RDBMSAdaptergetAutoIncrementKeyword in class DatabaseAdapterpublic boolean supportsAutoIncrementKeysNullSpecification()
supportsAutoIncrementKeysNullSpecification in interface RDBMSAdaptersupportsAutoIncrementKeysNullSpecification in class DatabaseAdapterpublic boolean supportsAutoIncrementColumnTypeSpecification()
supportsAutoIncrementColumnTypeSpecification in interface RDBMSAdaptersupportsAutoIncrementColumnTypeSpecification in class DatabaseAdapterpublic boolean supportsSequences()
supportsSequences in interface org.jpox.store.mapped.DatastoreAdaptersupportsSequences in interface RDBMSAdaptersupportsSequences in class org.jpox.store.mapped.AbstractDatastoreAdapter
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 RDBMSAdaptergetSequenceCreateStmt in class DatabaseAdaptersequence_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 RDBMSAdaptergetSequenceNextStmt in class DatabaseAdaptersequence_name - Name of the sequence
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)
DatabaseAdapter
newTableExpression in interface RDBMSAdapternewTableExpression in class DatabaseAdapterqs - 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 supportsQueryFetchSize(int size)
supportsQueryFetchSize in interface org.jpox.store.mapped.DatastoreAdaptersupportsQueryFetchSize in class org.jpox.store.mapped.AbstractDatastoreAdaptersize - The value to set to
public java.lang.String getRangeByLimitWhereClause(long offset,
long count)
getRangeByLimitWhereClause in interface RDBMSAdaptergetRangeByLimitWhereClause in class DatabaseAdapteroffset - The offset to return fromcount - The number of items to return
public boolean supportsAnalysisMethods()
supportsAnalysisMethods in interface RDBMSAdaptersupportsAnalysisMethods in class DatabaseAdapterpublic java.lang.String getEscapePatternExpression()
getEscapePatternExpression in interface org.jpox.store.mapped.expression.ExpressionPatternAdaptergetEscapePatternExpression in class DatabaseAdapter
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)
since STRPOS returns the first character as position 1. Similarly the "pos" is based on the first position being 1.STRPOS(str, substr [, pos])-1
indexOfMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdapterindexOfMethod in class DatabaseAdaptersource - The expression we want to search.str - The argument to the indexOf() method.from - The from position
public org.jpox.store.mapped.expression.NumericExpression getDayMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
date_part("day",date)
getDayMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdaptergetDayMethod in class DatabaseAdapterdate - The date for the getDay() method.
public org.jpox.store.mapped.expression.NumericExpression getMonthMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
date_part("month",date)
getMonthMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdaptergetMonthMethod in class DatabaseAdapterdate - The date for the getMonth() method.
public org.jpox.store.mapped.expression.NumericExpression getYearMethod(org.jpox.store.mapped.expression.SqlTemporalExpression date)
date_part("year",date)
getYearMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdaptergetYearMethod in class DatabaseAdapterdate - The date for the getYear() method.
public org.jpox.store.mapped.expression.NumericExpression getHourMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
date_part("hour",time)
getHourMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdaptergetHourMethod in class DatabaseAdaptertime - The time for the getHour() method.
public org.jpox.store.mapped.expression.NumericExpression getMinuteMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
date_part("minute",time)
getMinuteMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdaptergetMinuteMethod in class DatabaseAdaptertime - The time for the getMinute() method.
public org.jpox.store.mapped.expression.NumericExpression getSecondMethod(org.jpox.store.mapped.expression.SqlTemporalExpression time)
date_part("second",time)
getSecondMethod in interface org.jpox.store.mapped.expression.ExpressionMethodAdaptergetSecondMethod in class DatabaseAdaptertime - The time for the getSecond() method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||