|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.adapter.DatabaseAdapter
org.datanucleus.store.rdbms.adapter.PostgreSQLAdapter
public class PostgreSQLAdapter
Provides methods for adapting SQL language elements to the PostgreSQL database.
| 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.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.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 | |
|---|---|
PostgreSQLAdapter(java.sql.DatabaseMetaData metadata)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.String |
getAddColumnStatement(org.datanucleus.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.datanucleus.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. |
java.lang.String |
getDropTableStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
Accessor for the statement for dropping a table. |
java.lang.String |
getEscapePatternExpression()
The character for escaping patterns. |
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.datanucleus.store.mapped.expression.NumericExpression |
getNumericExpressionForMethod(java.lang.String method,
org.datanucleus.store.mapped.expression.ScalarExpression expr)
Accessor for a numeric expression to represent the method call, with passed argument. |
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. |
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. |
java.lang.String |
getVendorID()
Accessor for the vendor id. |
org.datanucleus.store.mapped.expression.NumericExpression |
indexOfMethod(org.datanucleus.store.mapped.expression.ScalarExpression source,
org.datanucleus.store.mapped.expression.ScalarExpression str,
org.datanucleus.store.mapped.expression.NumericExpression from)
Returns the appropriate SQL expression for the JDOQL String.indexOf() method. |
void |
initialiseTypes(org.datanucleus.store.schema.StoreSchemaHandler handler,
org.datanucleus.ManagedConnection mconn)
Initialise the types for this datastore. |
ForeignKeyInfo |
newFKInfo(java.sql.ResultSet rs)
Method to return ForeignKeyInfo for the current row of the ResultSet which will have been obtained from a call to DatabaseMetaData.getImportedKeys() or DatabaseMetaData.getExportedKeys(). |
RDBMSColumnInfo |
newRDBMSColumnInfo(java.sql.ResultSet rs)
Method to create a column info for the current row. |
SQLTypeInfo |
newSQLTypeInfo(java.sql.ResultSet rs)
Create a new SQL type info from the current row of the passed ResultSet. |
boolean |
supportsQueryFetchSize(int size)
Whether the datastore will support setting the query fetch size to the supplied value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 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 void initialiseTypes(org.datanucleus.store.schema.StoreSchemaHandler handler,
org.datanucleus.ManagedConnection mconn)
initialiseTypes in interface org.datanucleus.store.mapped.DatastoreAdapterinitialiseTypes in class DatabaseAdapterhandler - SchemaHandler that we initialise the types formconn - Managed connection to usepublic java.lang.String getVendorID()
getVendorID in interface org.datanucleus.store.mapped.DatastoreAdaptergetVendorID in class DatabaseAdapterpublic SQLTypeInfo newSQLTypeInfo(java.sql.ResultSet rs)
RDBMSAdapter
newSQLTypeInfo in interface RDBMSAdapternewSQLTypeInfo in class DatabaseAdapterrs - ResultSet
public RDBMSColumnInfo newRDBMSColumnInfo(java.sql.ResultSet rs)
newRDBMSColumnInfo in interface RDBMSAdapternewRDBMSColumnInfo in class DatabaseAdapterrs - ResultSet from DatabaseMetaData.getColumns()
public ForeignKeyInfo newFKInfo(java.sql.ResultSet rs)
newFKInfo in interface RDBMSAdapternewFKInfo in class DatabaseAdapterrs - The result set returned from DatabaseMetaData.get??portedKeys()
public java.lang.String getAddColumnStatement(org.datanucleus.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 java.lang.String getAddPrimaryKeyStatement(PrimaryKey pk,
org.datanucleus.store.mapped.IdentifierFactory factory)
getAddPrimaryKeyStatement in interface RDBMSAdaptergetAddPrimaryKeyStatement in class DatabaseAdapterpk - An object describing the primary key.factory - Identifier factory
public java.lang.String getDropTableStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
getDropTableStatement in interface RDBMSAdaptergetDropTableStatement in class DatabaseAdaptertable - The table to drop.
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 DatabaseAdapter
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 boolean supportsQueryFetchSize(int size)
supportsQueryFetchSize in interface org.datanucleus.store.mapped.DatastoreAdaptersupportsQueryFetchSize in class DatabaseAdaptersize - 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 java.lang.String getEscapePatternExpression()
getEscapePatternExpression in interface org.datanucleus.store.mapped.expression.ExpressionPatternAdaptergetEscapePatternExpression in class DatabaseAdapter
public org.datanucleus.store.mapped.expression.NumericExpression indexOfMethod(org.datanucleus.store.mapped.expression.ScalarExpression source,
org.datanucleus.store.mapped.expression.ScalarExpression str,
org.datanucleus.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.datanucleus.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.datanucleus.store.mapped.expression.NumericExpression getNumericExpressionForMethod(java.lang.String method,
org.datanucleus.store.mapped.expression.ScalarExpression expr)
getNumericExpressionForMethod in interface org.datanucleus.store.mapped.DatastoreAdaptergetNumericExpressionForMethod in class DatabaseAdaptermethod - The method (case insensitive)expr - The argument to the method
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||