com.triactive.jdo.store
Class PostgreSQLAdapter

java.lang.Object
  extended by com.triactive.jdo.store.DatabaseAdapter
      extended by com.triactive.jdo.store.PostgreSQLAdapter

public class PostgreSQLAdapter
extends DatabaseAdapter

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

Author:
Levente S?ntha, Mike Martin

Field Summary
 
Fields inherited from class com.triactive.jdo.store.DatabaseAdapter
databaseMajorVersion, databaseMinorVersion, databaseProductName, databaseProductVersion, identifierQuoteString, keywords, maxColumnNameLength, maxConstraintNameLength, maxIndexNameLength, maxTableNameLength, storesLowerCaseIdentifiers, storesUpperCaseIdentifiers, typeMappings, typesByTypeNumber
 
Constructor Summary
PostgreSQLAdapter(java.sql.DatabaseMetaData metadata)
           
 
Method Summary
 java.lang.String getDropTableStatement(BaseTable table)
          Returns the appropriate SQL to drop the given table.
 SQLState getSQLState(java.sql.SQLException se)
          Returns a SQLState object for the specified SQLException, if one is present and valid.
 java.lang.String getVendorID()
           
 ColumnInfo newColumnInfo(java.sql.ResultSet rs)
          A factory for ColumnInfo objects.
 ForeignKeyInfo newForeignKeyInfo(java.sql.ResultSet rs)
          A factory for ForeignKeyInfo objects.
 TableExpression newTableExpression(QueryStatement qs, Table table, SQLIdentifier rangeVar)
          Returns a new TableExpression object appropriate for this DBMS.
 TypeInfo newTypeInfo(java.sql.ResultSet rs)
          A factory for TypeInfo objects.
 boolean supportsAlterTableDropConstraint()
           
 
Methods inherited from class com.triactive.jdo.store.DatabaseAdapter
closeConnection, createIndexesBeforeForeignKeys, createTypeInfo, getAddCandidateKeyStatement, getAddForeignKeyStatement, getAddPrimaryKeyStatement, getConnection, getCreateIndexStatement, getCreateTableStatement, getDropViewStatement, getIdentifierQuoteString, getInstance, getMapping, getMapping, getMapping, getMappingClass, getMaxColumnNameLength, getMaxConstraintNameLength, getMaxIndexNameLength, getMaxTableNameLength, getSchemaName, getTypeInfo, getTypeInfo, getUnlimitedLengthPrecisionValue, includeOrderByColumnsInSelect, isEmbeddedType, isSQLKeyword, lengthMethod, newDataStoreException, newQueryStatement, newQueryStatement, parseKeywordList, storesLowerCaseIdentifiers, storesUpperCaseIdentifiers, substringMethod, substringMethod, supportsBooleanComparison, supportsDeferredConstraints, supportsNullsInCandidateKeys, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PostgreSQLAdapter

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

getVendorID

public java.lang.String getVendorID()
Overrides:
getVendorID in class DatabaseAdapter

getSQLState

public SQLState getSQLState(java.sql.SQLException se)
Description copied from class: DatabaseAdapter
Returns a SQLState object for the specified SQLException, if one is present and valid.

Overrides:
getSQLState in class DatabaseAdapter
Parameters:
se - A caught SQL exception.
Returns:
A SQLState object, or null if se does not contain a valid 5-character SQLSTATE.

newTableExpression

public TableExpression newTableExpression(QueryStatement qs,
                                          Table table,
                                          SQLIdentifier 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.

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.

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().

Overrides:
newColumnInfo in class DatabaseAdapter
Parameters:
rs - The result set returned from DatabaseMetaData.getColumns().

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().

Overrides:
newForeignKeyInfo in class DatabaseAdapter
Parameters:
rs - The result set returned from DatabaseMetaData.get??portedKeys().

supportsAlterTableDropConstraint

public boolean supportsAlterTableDropConstraint()
Overrides:
supportsAlterTableDropConstraint in class DatabaseAdapter

getDropTableStatement

public java.lang.String getDropTableStatement(BaseTable table)
Description copied from class: DatabaseAdapter
Returns the appropriate SQL to drop the given table. It should return something like:

 DROP TABLE FOO CASCADE
 

Overrides:
getDropTableStatement in class DatabaseAdapter
Parameters:
table - The table to drop.
Returns:
The text of the SQL statement.


Copyright ? 2001 TriActive, Inc. All Rights Reserved.