org.datanucleus.store.rdbms.adapter
Class PostGISAdapter

java.lang.Object
  extended by org.datanucleus.store.rdbms.adapter.DatabaseAdapter
      extended by org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter
          extended by org.datanucleus.store.rdbms.adapter.PostGISAdapter
All Implemented Interfaces:
org.datanucleus.store.mapped.DatastoreAdapter, org.datanucleus.store.mapped.expression.ExpressionConversionAdapter, org.datanucleus.store.mapped.expression.ExpressionLogicSetAdapter, org.datanucleus.store.mapped.expression.ExpressionMethodAdapter, org.datanucleus.store.mapped.expression.ExpressionOperatorAdapter, org.datanucleus.store.mapped.expression.ExpressionPatternAdapter, org.datanucleus.store.rdbms.adapter.RDBMSAdapter, SpatialRDBMSAdapter

public class PostGISAdapter
extends org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter
implements SpatialRDBMSAdapter

Provides methods for adapting SQL language elements for the PostGIS extension.


Field Summary
static java.lang.String HAS_MEASURE_EXTENSION_KEY
          Key name for the hasMeasure extension.
protected static org.datanucleus.util.Localiser LOCALISER_POSTGIS
           
 
Fields inherited from class org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter
POSTGRESQL_RESERVED_WORDS, psqlTypes
 
Fields inherited from class org.datanucleus.store.rdbms.adapter.DatabaseAdapter
catalogSeparator, datastoreMajorVersion, datastoreMinorVersion, datastoreProductName, datastoreProductVersion, datastoreRevisionVersion, driverMajorVersion, driverMinorVersion, driverName, driverVersion, identifierQuoteString, LOCALISER, LOCALISER_BASE, maxColumnNameLength, maxConstraintNameLength, maxIndexNameLength, maxTableNameLength, properties, reservedKeywords, supportedOptions
 
Fields inherited from interface org.datanucleus.store.rdbms.adapter.SpatialRDBMSAdapter
DIMENSION_EXTENSION_KEY, SRID_EXTENSION_KEY
 
Fields inherited from interface org.datanucleus.store.rdbms.adapter.RDBMSAdapter
ACCESS_PARENTQUERY_IN_SUBQUERY, ALTER_TABLE_DROP_CONSTRAINT_SYNTAX, ALTER_TABLE_DROP_FOREIGN_KEY_CONSTRAINT, ANSI_JOIN_SYNTAX, AUTO_INCREMENT_COLUMN_TYPE_SPECIFICATION, AUTO_INCREMENT_KEYS_NULL_SPECIFICATION, BLOB_SET_USING_SETSTRING, CHAR_COLUMNS_PADDED_WITH_SPACES, CHECK_IN_CREATE_STATEMENTS, CHECK_IN_END_CREATE_STATEMENTS, CLOB_SET_USING_SETSTRING, CREATE_INDEXES_BEFORE_FOREIGN_KEYS, DATETIME_STORES_MILLISECS, DEFAULT_BEFORE_NULL_IN_COLUMN_OPTIONS, DEFAULT_KEYWORD_IN_COLUMN_OPTIONS, DEFAULT_KEYWORD_WITH_NOT_NULL_IN_COLUMN_OPTIONS, DEFERRED_CONSTRAINTS, DISTINCT_WITH_SELECT_FOR_UPDATE, EXISTS_SYNTAX, FK_DELETE_ACTION_CASCADE, FK_DELETE_ACTION_DEFAULT, FK_DELETE_ACTION_NULL, FK_DELETE_ACTION_RESTRICT, FK_UPDATE_ACTION_CASCADE, FK_UPDATE_ACTION_DEFAULT, FK_UPDATE_ACTION_NULL, FK_UPDATE_ACTION_RESTRICT, GET_GENERATED_KEYS_STATEMENT, INCLUDE_ORDERBY_COLS_IN_SELECT, LOCK_OPTION_PLACED_AFTER_FROM, LOCK_OPTION_PLACED_WITHIN_JOIN, LOCK_WITH_SELECT_FOR_UPDATE, NULL_EQUALS_EMPTY_STRING, NULLS_IN_CANDIDATE_KEYS, NULLS_KEYWORD_IN_COLUMN_OPTIONS, ORDERBY_USING_SELECT_COLUMN_INDEX, PERSIST_OF_UNASSIGNED_CHAR, PRIMARYKEY_IN_CREATE_STATEMENTS, STATEMENT_BATCHING, TX_ISOLATION_NONE, TX_ISOLATION_READ_COMMITTED, TX_ISOLATION_READ_UNCOMMITTED, TX_ISOLATION_REPEATABLE_READ, TX_ISOLATION_SERIALIZABLE, UNION_SYNTAX, UNIQUE_IN_END_CREATE_STATEMENTS, USE_UNION_ALL, VIEWS
 
Fields inherited from interface org.datanucleus.store.mapped.DatastoreAdapter
ANALYSIS_METHODS, BIT_IS_REALLY_BOOLEAN, BOOLEAN_COMPARISON, CATALOGS_IN_TABLE_DEFINITIONS, ESCAPE_EXPRESSION_IN_LIKE_PREDICATE, IDENTIFIERS_LOWERCASE, IDENTIFIERS_LOWERCASE_QUOTED, IDENTIFIERS_MIXEDCASE, IDENTIFIERS_MIXEDCASE_QUOTED, IDENTIFIERS_MIXEDCASE_QUOTED_SENSITIVE, IDENTIFIERS_MIXEDCASE_SENSITIVE, IDENTIFIERS_UPPERCASE, IDENTIFIERS_UPPERCASE_QUOTED, IDENTITY_COLUMNS, PROJECTION_IN_TABLE_REFERENCE_JOINS, SCHEMAS_IN_TABLE_DEFINITIONS, SEQUENCES
 
Constructor Summary
PostGISAdapter(java.sql.DatabaseMetaData metadata)
           
 
Method Summary
 java.lang.String getAddColumnStatement(org.datanucleus.store.mapped.DatastoreContainerObject table, org.datanucleus.store.rdbms.table.Column column)
           
 java.lang.String getAddPrimaryKeyStatement(org.datanucleus.store.rdbms.key.PrimaryKey pk, org.datanucleus.store.mapped.IdentifierFactory factory)
           
 java.lang.String getCalculateBoundsStatement(org.datanucleus.store.rdbms.table.Table table, org.datanucleus.store.rdbms.table.Column column)
          Returns the appropriate SQL statement that calculates the bounds of all geometries in the given column.
 java.lang.String getCreateTableStatement(org.datanucleus.store.rdbms.table.TableImpl table, org.datanucleus.store.rdbms.table.Column[] columns, java.util.Properties props)
           
 java.lang.String getRetrieveCrsNameStatement(org.datanucleus.store.rdbms.table.Table table, int srid)
          Returns the appropriate SQL statement to retrieve the name of the Coordinate Reference System (CRS) with the given srid.
 java.lang.String getRetrieveCrsWktStatement(org.datanucleus.store.rdbms.table.Table table, int srid)
          Returns the appropriate SQL statement to retrieve description of the Coordinate Reference System (CRS) with the given srid.
 void initialiseTypes(org.datanucleus.store.schema.StoreSchemaHandler handler, org.datanucleus.ManagedConnection mconn)
          Initialise the types for this datastore.
 boolean isGeometryColumn(org.datanucleus.store.rdbms.table.Column column)
          Checks whether the given column is geometry backed by the datastore.
 
Methods inherited from class org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter
getAutoIncrementKeyword, getAutoIncrementStmt, getDropTableStatement, getEscapePatternExpression, getInsertStatementForNoColumns, getNumericExpressionForMethod, getRangeByLimitWhereClause, getSequenceCreateStmt, getSequenceNextStmt, getVendorID, indexOfMethod, newFKInfo, newRDBMSColumnInfo, newSQLTypeInfo, supportsQueryFetchSize
 
Methods inherited from class org.datanucleus.store.rdbms.adapter.DatabaseAdapter
addSQLTypeForJDBCType, cartersianProduct, concatOperator, endsWithMethod, getAdapterTime, getAddCandidateKeyStatement, getAddForeignKeyStatement, getCatalogName, getCatalogSeparator, getCheckConstraintForValues, getColumns, getConnection, getContinuationString, getCreateIndexStatement, getCurrentDateMethod, getCurrentTimeMethod, getCurrentTimestampMethod, getDatastoreDateStatement, getDatastoreIdentifierMaxLength, getDatastoreMajorVersion, getDatastoreMinorVersion, getDriverMajorVersion, getDriverMinorVersion, getDropViewStatement, getEscapeCharacter, getEscapedPatternExpression, getExistingIndexes, getIdentifierQuoteString, getMapping, getMappingManager, getMaxForeignKeys, getMaxIndexes, getMiliseconds, getNewUUIDFunction, getNonAnsiInnerJoinWhereClause, getNonAnsiLeftOuterJoinWhereClause, getNonAnsiRightOuterJoinWhereClause, getNumericConversionFunction, getOperatorConcat, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters, getRangeByLimitSelectClause, getRangeByRowNumberColumn, getRequiredTransactionIsolationLevel, getSchemaName, getSelectForUpdateText, getSelectNewUUIDStmt, getSelectWithLockOption, getSupportedOptions, getSurrogateForEmptyStrings, getTime, getTransactionIsolationForSchemaCreation, getUnlimitedLengthPrecisionValue, getValueForProperty, initialiseDatastore, isIdentityFieldDataType, isKeyword, isReservedKeyword, isValidPrimaryKeyType, iteratorReservedWords, logConfiguration, lowerMethod, matchesMethod, modOperator, newQueryStatement, newTableExpression, parseKeywordList, removeUnsupportedMappings, setProperties, startsWithMethod, substringMethod, substringMethod, supportsOption, supportsTransactionIsolation, toNumericExpression, toString, toStringExpression, toStringExpression, translateMethod, trimMethod, upperMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.rdbms.adapter.RDBMSAdapter
getAddCandidateKeyStatement, getAddForeignKeyStatement, getAutoIncrementKeyword, getAutoIncrementStmt, getCatalogName, getCheckConstraintForValues, getColumns, getConnection, getCreateIndexStatement, getDatastoreDateStatement, getDropTableStatement, getDropViewStatement, getExistingIndexes, getInsertStatementForNoColumns, getNonAnsiInnerJoinWhereClause, getNonAnsiLeftOuterJoinWhereClause, getRangeByLimitSelectClause, getRangeByLimitWhereClause, getRangeByRowNumberColumn, getRequiredTransactionIsolationLevel, getSchemaName, getSelectNewUUIDStmt, getSelectWithLockOption, getSequenceCreateStmt, getSequenceNextStmt, getSurrogateForEmptyStrings, getTransactionIsolationForSchemaCreation, getUnlimitedLengthPrecisionValue, isValidPrimaryKeyType, iteratorReservedWords, logConfiguration, newFKInfo, newRDBMSColumnInfo, newSQLTypeInfo, newTableExpression, supportsTransactionIsolation
 
Methods inherited from interface org.datanucleus.store.mapped.DatastoreAdapter
getAdapterTime, getCatalogSeparator, getDatastoreIdentifierMaxLength, getDatastoreMajorVersion, getDatastoreMinorVersion, getIdentifierQuoteString, getMappingManager, getMaxForeignKeys, getMaxIndexes, getNumericExpressionForMethod, getSupportedOptions, getVendorID, initialiseDatastore, isIdentityFieldDataType, isReservedKeyword, modOperator, newQueryStatement, removeUnsupportedMappings, setProperties, supportsOption, supportsQueryFetchSize, toString
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionConversionAdapter
toNumericExpression, toStringExpression, toStringExpression
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionOperatorAdapter
concatOperator, getOperatorConcat
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionMethodAdapter
endsWithMethod, getCurrentDateMethod, getCurrentTimeMethod, getCurrentTimestampMethod, indexOfMethod, lowerMethod, matchesMethod, startsWithMethod, substringMethod, substringMethod, translateMethod, trimMethod, upperMethod
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionPatternAdapter
getEscapeCharacter, getEscapedPatternExpression, getEscapePatternExpression, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters
 
Methods inherited from interface org.datanucleus.store.mapped.expression.ExpressionLogicSetAdapter
cartersianProduct
 

Field Detail

LOCALISER_POSTGIS

protected static final org.datanucleus.util.Localiser LOCALISER_POSTGIS

HAS_MEASURE_EXTENSION_KEY

public static final java.lang.String HAS_MEASURE_EXTENSION_KEY
Key name for the hasMeasure extension.

See Also:
Constant Field Values
Constructor Detail

PostGISAdapter

public PostGISAdapter(java.sql.DatabaseMetaData metadata)
Method Detail

initialiseTypes

public void initialiseTypes(org.datanucleus.store.schema.StoreSchemaHandler handler,
                            org.datanucleus.ManagedConnection mconn)
Initialise the types for this datastore.

Specified by:
initialiseTypes in interface org.datanucleus.store.mapped.DatastoreAdapter
Overrides:
initialiseTypes in class org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter
Parameters:
handler - SchemaHandler that we initialise the types for
mconn - Managed connection to use

getAddPrimaryKeyStatement

public java.lang.String getAddPrimaryKeyStatement(org.datanucleus.store.rdbms.key.PrimaryKey pk,
                                                  org.datanucleus.store.mapped.IdentifierFactory factory)
Specified by:
getAddPrimaryKeyStatement in interface org.datanucleus.store.rdbms.adapter.RDBMSAdapter
Overrides:
getAddPrimaryKeyStatement in class org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter

getAddColumnStatement

public java.lang.String getAddColumnStatement(org.datanucleus.store.mapped.DatastoreContainerObject table,
                                              org.datanucleus.store.rdbms.table.Column column)
Specified by:
getAddColumnStatement in interface org.datanucleus.store.rdbms.adapter.RDBMSAdapter
Overrides:
getAddColumnStatement in class org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter

getCreateTableStatement

public java.lang.String getCreateTableStatement(org.datanucleus.store.rdbms.table.TableImpl table,
                                                org.datanucleus.store.rdbms.table.Column[] columns,
                                                java.util.Properties props)
Specified by:
getCreateTableStatement in interface org.datanucleus.store.rdbms.adapter.RDBMSAdapter
Overrides:
getCreateTableStatement in class org.datanucleus.store.rdbms.adapter.DatabaseAdapter

getRetrieveCrsWktStatement

public java.lang.String getRetrieveCrsWktStatement(org.datanucleus.store.rdbms.table.Table table,
                                                   int srid)
Description copied from interface: SpatialRDBMSAdapter
Returns the appropriate SQL statement to retrieve description of the Coordinate Reference System (CRS) with the given srid.

Specified by:
getRetrieveCrsWktStatement in interface SpatialRDBMSAdapter
Parameters:
table - A table
srid - The srid
Returns:
SQL statement, null if not available for the datastore

getRetrieveCrsNameStatement

public java.lang.String getRetrieveCrsNameStatement(org.datanucleus.store.rdbms.table.Table table,
                                                    int srid)
Description copied from interface: SpatialRDBMSAdapter
Returns the appropriate SQL statement to retrieve the name of the Coordinate Reference System (CRS) with the given srid.

Specified by:
getRetrieveCrsNameStatement in interface SpatialRDBMSAdapter
Parameters:
table - A table
srid - The srid
Returns:
SQL statement, null if not available for the datastore

getCalculateBoundsStatement

public java.lang.String getCalculateBoundsStatement(org.datanucleus.store.rdbms.table.Table table,
                                                    org.datanucleus.store.rdbms.table.Column column)
Description copied from interface: SpatialRDBMSAdapter
Returns the appropriate SQL statement that calculates the bounds of all geometries in the given column.

Specified by:
getCalculateBoundsStatement in interface SpatialRDBMSAdapter
Parameters:
table - The table
column - The column
Returns:
SQL statement, null if not available for the datastore

isGeometryColumn

public boolean isGeometryColumn(org.datanucleus.store.rdbms.table.Column column)
Description copied from interface: SpatialRDBMSAdapter
Checks whether the given column is geometry backed by the datastore.

Specified by:
isGeometryColumn in interface SpatialRDBMSAdapter
Parameters:
column - Column to check
Returns:
true if the given column is geometry backed, false otherwise


Copyright © 2009. All Rights Reserved.