EclipseLink 1.0_1.0M2 API Reference - Incubation

org.eclipse.persistence.platform.database
Class PostgreSQLPlatform

java.lang.Object
  extended by org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      extended by org.eclipse.persistence.platform.database.DatabasePlatform
          extended by org.eclipse.persistence.platform.database.PostgreSQLPlatform

public class PostgreSQLPlatform
extends DatabasePlatform

Purpose: Provides Postgres specific behaviour.

Responsibilities:

Since:
OracleAS TopLink 10g (10.1.3)

Constructor Summary
PostgreSQLPlatform()
           
 
Method Summary
protected  void appendBoolean(java.lang.Boolean bool, java.io.Writer writer)
          Appends a Boolean value.
protected  java.util.Hashtable buildFieldTypes()
           
 ValueReadQuery buildSelectQueryForIdentity()
          INTERNAL: Returns query used to read back the value generated by Identity.
 ValueReadQuery buildSelectQueryForSequenceObject(java.lang.String seqName, java.lang.Integer size)
          INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence).
 java.io.Writer buildSequenceObjectAlterIncrementWriter(java.io.Writer writer, java.lang.String fullSeqName, int increment)
          INTERNAL: Override this method if the platform supports sequence objects and isAlterSequenceObjectSupported returns true.
 java.io.Writer buildSequenceObjectCreationWriter(java.io.Writer writer, java.lang.String fullSeqName, int increment, int start)
          INTERNAL: Override this method if the platform supports sequence objects.
 java.io.Writer buildSequenceObjectDeletionWriter(java.io.Writer writer, java.lang.String fullSeqName)
          INTERNAL: Override this method if the platform supports sequence objects.
 java.lang.String getAssignmentString()
          INTERNAL Used for stored function calls.
protected  java.lang.String getCreateTempTableSqlBodyForTable(DatabaseTable table)
          INTERNAL:
protected  java.lang.String getCreateTempTableSqlPrefix()
          INTERNAL:
protected  java.lang.String getCreateTempTableSqlSuffix()
          INTERNAL:
 java.lang.String getInOutputProcedureToken()
          This method is used to print the output parameter token when stored procedures are called
 int getMaxFieldNameSize()
          INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
 java.lang.String getProcedureBeginString()
          INTERNAL: Used for sp calls.
 java.lang.String getProcedureCallHeader()
          INTERNAL: Used for sp calls.
 java.lang.String getProcedureEndString()
          INTERNAL: Used for sp calls.
protected  java.lang.String getQualifiedSequenceName(java.lang.String seqName)
          INTERNAL: Prepend sequence name with table qualifier (if any)
 ValueReadQuery getTimestampQuery()
          INTERNAL: This method returns the query to select the timestamp from the server for Derby.
protected  void initializePlatformOperators()
          INTERNAL: Initialize any platform-specific operators
 boolean isAlterSequenceObjectSupported()
          INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.
 boolean isPostgreSQL()
          INTERNAL: Answers whether platform is Derby
protected  ExpressionOperator operatorLocate()
          INTERNAL: Override the default locate operator
 void printFieldIdentityClause(java.io.Writer writer)
          INTERNAL: Append the receiver's field 'identity' constraint clause to a writer
 void printFieldTypeSize(java.io.Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause)
           
 void printFieldUnique(java.io.Writer writer, boolean shouldPrintFieldIdentityClause)
           
protected  void setPrimitiveParameterValue(java.sql.PreparedStatement statement, int index, java.lang.Object parameter)
          Set a primitive parameter.
 boolean shouldPrintOutputTokenAtStart()
          This is required in the construction of the stored procedures with output parameters
 boolean shouldUseJDBCOuterJoinSyntax()
          JDBC defines and outer join syntax, many drivers do not support this.
 boolean supportsGlobalTempTables()
          INTERNAL:
 boolean supportsIdentity()
          INTERNAL: Indicates whether the platform supports identity.
 boolean supportsSequenceObjects()
          INTERNAL: Indicates whether the platform supports sequence objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgreSQLPlatform

public PostgreSQLPlatform()
Method Detail

appendBoolean

protected void appendBoolean(java.lang.Boolean bool,
                             java.io.Writer writer)
                      throws java.io.IOException
Appends a Boolean value. Refer to : http://www.postgresql.org/docs/8.0/static/datatype-boolean.html In PostgreSQL the following are the values that are value for a boolean field Valid literal values for the "true" state are: TRUE, 't', 'true', 'y', 'yes', '1' Valid literal values for the false" state are : FALSE, 'f', 'false', 'n', 'no', '0' To be consistent with the other data platforms we are using the values '1' and '0' for true and false states of a boolean field.

Throws:
java.io.IOException

initializePlatformOperators

protected void initializePlatformOperators()
INTERNAL: Initialize any platform-specific operators


getTimestampQuery

public ValueReadQuery getTimestampQuery()
INTERNAL: This method returns the query to select the timestamp from the server for Derby.


getInOutputProcedureToken

public java.lang.String getInOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called


shouldPrintOutputTokenAtStart

public boolean shouldPrintOutputTokenAtStart()
This is required in the construction of the stored procedures with output parameters


isPostgreSQL

public boolean isPostgreSQL()
INTERNAL: Answers whether platform is Derby


getCreateTempTableSqlSuffix

protected java.lang.String getCreateTempTableSqlSuffix()
INTERNAL:


supportsIdentity

public boolean supportsIdentity()
INTERNAL: Indicates whether the platform supports identity. This method is to be used *ONLY* by sequencing classes


buildSelectQueryForIdentity

public ValueReadQuery buildSelectQueryForIdentity()
INTERNAL: Returns query used to read back the value generated by Identity. This method is called when identity NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsIdentity then (at least) one of buildSelectQueryForIdentity methods should return non-null query.


supportsSequenceObjects

public boolean supportsSequenceObjects()
INTERNAL: Indicates whether the platform supports sequence objects. This method is to be used *ONLY* by sequencing classes


buildSelectQueryForSequenceObject

public ValueReadQuery buildSelectQueryForSequenceObject(java.lang.String seqName,
                                                        java.lang.Integer size)
INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence). This method is called when sequence object NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject methods should return non-null query.


getQualifiedSequenceName

protected java.lang.String getQualifiedSequenceName(java.lang.String seqName)
INTERNAL: Prepend sequence name with table qualifier (if any)


getCreateTempTableSqlBodyForTable

protected java.lang.String getCreateTempTableSqlBodyForTable(DatabaseTable table)
INTERNAL:


printFieldIdentityClause

public void printFieldIdentityClause(java.io.Writer writer)
                              throws ValidationException
INTERNAL: Append the receiver's field 'identity' constraint clause to a writer

Throws:
ValidationException

buildFieldTypes

protected java.util.Hashtable buildFieldTypes()

operatorLocate

protected ExpressionOperator operatorLocate()
INTERNAL: Override the default locate operator


supportsGlobalTempTables

public boolean supportsGlobalTempTables()
INTERNAL:


getCreateTempTableSqlPrefix

protected java.lang.String getCreateTempTableSqlPrefix()
INTERNAL:


getMaxFieldNameSize

public int getMaxFieldNameSize()
INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.


getProcedureBeginString

public java.lang.String getProcedureBeginString()
INTERNAL: Used for sp calls.


getProcedureEndString

public java.lang.String getProcedureEndString()
INTERNAL: Used for sp calls.


getProcedureCallHeader

public java.lang.String getProcedureCallHeader()
INTERNAL: Used for sp calls.


getAssignmentString

public java.lang.String getAssignmentString()
INTERNAL Used for stored function calls.


printFieldTypeSize

public void printFieldTypeSize(java.io.Writer writer,
                               FieldDefinition field,
                               FieldTypeDefinition fieldType,
                               boolean shouldPrintFieldIdentityClause)
                        throws java.io.IOException
Throws:
java.io.IOException

printFieldUnique

public void printFieldUnique(java.io.Writer writer,
                             boolean shouldPrintFieldIdentityClause)
                      throws java.io.IOException
Throws:
java.io.IOException

shouldUseJDBCOuterJoinSyntax

public boolean shouldUseJDBCOuterJoinSyntax()
JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.


setPrimitiveParameterValue

protected void setPrimitiveParameterValue(java.sql.PreparedStatement statement,
                                          int index,
                                          java.lang.Object parameter)
                                   throws java.sql.SQLException
Set a primitive parameter. Postgres jdbc client driver give problem when doing a setObject() for wrapper types. Ideally this code should be in the DatabasePlatform so that all platforms can use this.

Throws:
java.sql.SQLException

buildSequenceObjectCreationWriter

public java.io.Writer buildSequenceObjectCreationWriter(java.io.Writer writer,
                                                        java.lang.String fullSeqName,
                                                        int increment,
                                                        int start)
                                                 throws java.io.IOException
INTERNAL: Override this method if the platform supports sequence objects. Returns sql used to create sequence object in the database.

Throws:
java.io.IOException

buildSequenceObjectDeletionWriter

public java.io.Writer buildSequenceObjectDeletionWriter(java.io.Writer writer,
                                                        java.lang.String fullSeqName)
                                                 throws java.io.IOException
INTERNAL: Override this method if the platform supports sequence objects. Returns sql used to delete sequence object from the database.

Throws:
java.io.IOException

buildSequenceObjectAlterIncrementWriter

public java.io.Writer buildSequenceObjectAlterIncrementWriter(java.io.Writer writer,
                                                              java.lang.String fullSeqName,
                                                              int increment)
                                                       throws java.io.IOException
INTERNAL: Override this method if the platform supports sequence objects and isAlterSequenceObjectSupported returns true. Returns sql used to alter sequence object's increment in the database.

Throws:
java.io.IOException

isAlterSequenceObjectSupported

public boolean isAlterSequenceObjectSupported()
INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.


EclipseLink 1.0_1.0M2 API Reference - Incubation