public class PostgreSQLPlatform extends DatabasePlatform
Purpose: Provides Postgres specific behavior.
Responsibilities:
DEFAULT_VARCHAR_SIZE
batchWritingMechanism, castSizeForVarcharParameter, classTypes, cursorCode, DEFAULT_MAX_BATCH_WRITING_SIZE, DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE, driverName, driverSupportsNationalCharacterVarying, fieldTypes, IS_VALID_TIMEOUT, isCastRequired, maxBatchWritingSize, partitioningCallback, pingSQL, printInnerJoinInWhereClause, printOuterJoinInWhereClause, shouldBindAllParameters, shouldBindLiterals, shouldCacheAllStatements, shouldCreateIndicesOnForeignKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, storedProcedureTerminationToken, stringBindingSize, structConverters, supportsAutoCommit, tableCreationSuffix, transactionIsolation, typeConverters, Types_NCLOB, Types_SQLXML, useJDBCStoredProcedureSyntax, useNationalCharacterVarying, useRownumFiltering, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesStreamsForBinding, usesStringBinding
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultNativeSequenceToTable, defaultSequence, endDelimiter, platformOperators, sequences, sequencesLock, startDelimiter, tableQualifier, timestampQuery
Constructor and Description |
---|
PostgreSQLPlatform() |
Modifier and Type | Method and Description |
---|---|
protected void |
appendBoolean(java.lang.Boolean bool,
java.io.Writer writer)
Appends a Boolean value.
|
org.eclipse.persistence.internal.databaseaccess.DatabaseCall |
buildCallWithReturning(SQLCall sqlCall,
java.util.Vector returnFields)
INTERNAL:
Uses the returning clause on Postgres.
|
protected java.util.Hashtable |
buildFieldTypes() |
java.lang.String |
buildProcedureCallString(StoredProcedureCall call,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord row)
INTERNAL: Used for sp calls.
|
ValueReadQuery |
buildSelectQueryForIdentity()
INTERNAL: Returns query used to read back the value generated by
Identity.
|
ValueReadQuery |
buildSelectQueryForSequenceObject(java.lang.String qualifiedSeqName,
java.lang.Integer size)
INTERNAL: Returns query used to read value generated by sequence object
(like Oracle sequence).
|
boolean |
canBuildCallWithReturning()
INTERNAL:
Postgres has a returning clause.
|
int |
computeMaxRowsForSQL(int firstResultIndex,
int maxResults)
INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute
a value to use when limiting the results of a query in SQL.
|
java.lang.String |
getAssignmentString()
INTERNAL Used for stored function calls.
|
protected java.lang.String |
getCreateTempTableSqlPrefix()
INTERNAL:
|
protected java.lang.String |
getCreateTempTableSqlSuffix()
INTERNAL:
|
java.lang.String |
getDropCascadeString()
Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.
|
java.lang.String |
getInOutputProcedureToken()
This method is used to print the output parameter token when stored
procedures are called
|
int |
getJDBCType(java.lang.Class javaType)
Return the JDBC type for the Java type.
|
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 |
getProcedureEndString()
INTERNAL: Used for sp calls.
|
ValueReadQuery |
getTimestampQuery()
INTERNAL: This method returns the query to select the timestamp from the
server for Postgres.
|
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 |
isJDBCExecuteCompliant()
Calling a stored procedure query on PostgreSQL with no output parameters
always returns true from an execute call regardless if a result set is
returned or not.
|
boolean |
isPostgreSQL()
INTERNAL: Answers whether platform is Postgres.
|
protected ExpressionOperator |
operatorLocate()
INTERNAL: Override the default locate operator.
|
protected ExpressionOperator |
operatorLocate2()
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,
org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition fieldType,
boolean shouldPrintFieldIdentityClause) |
void |
printFieldUnique(java.io.Writer writer,
boolean shouldPrintFieldIdentityClause) |
void |
printSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call,
org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer,
org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
Print the pagination SQL using Postgres syntax
" LIMIT <max> OFFSET <first>".
|
static ExpressionOperator |
regexpOperator()
INTERNAL:
Create the ~ operator.
|
boolean |
shouldPrintAliasForUpdate()
INTERNAL: Indicates whether locking OF clause should print alias for
field.
|
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 |
supportsIdentity()
INTERNAL: Indicates whether the platform supports identity.
|
boolean |
supportsLocalTempTables()
INTERNAL:
|
boolean |
supportsSequenceObjects()
INTERNAL: Indicates whether the platform supports sequence objects.
|
protected ExpressionOperator |
toNumberOperator()
INTERNAL: Postgres to_number has two arguments, as fix format argument.
|
void |
writeUpdateOriginalFromTempTableSql(java.io.Writer writer,
org.eclipse.persistence.internal.helper.DatabaseTable table,
java.util.Collection pkFields,
java.util.Collection assignedFields)
INTERNAL: May need to override this method if the platform supports
temporary tables and the generated sql doesn't work.
|
addBatch, addStructConverter, allowsSizeInProcedureArguments, appendByteArray, appendCalendar, appendDate, appendLiteralToCall, appendLiteralToCallWithBinding, appendNumber, appendParameter, appendParameterInternal, appendString, appendTime, appendTimestamp, autoCommit, beginTransaction, buildBatchCriteria, buildBatchCriteriaForComplexId, buildClassTypes, buildCreateIndex, buildCreateIndex, buildDropIndex, buildDropIndex, buildSequenceObjectAlterIncrementWriter, buildSequenceObjectCreationWriter, buildSequenceObjectDeletionWriter, canBatchWriteWithOptimisticLocking, commitTransaction, convertToDatabaseType, copyInto, createArray, createArray, createPlatformDefaultSequence, createStruct, createStruct, dontBindUpdateAllQueryUsingTempTables, executeBatch, executeStoredProcedure, freeTemporaryObject, getBatchBeginString, getBatchDelimiterString, getBatchEndString, getBatchRowCountAssignString, getBatchRowCountDeclareString, getBatchRowCountReturnString, getBatchWritingMechanism, getCastSizeForVarcharParameter, getClassTypes, getConnection, getConnectionUserName, getConstraintDeletionString, getCreateDatabaseSchemaString, getCreateTempTableSqlBodyForTable, getCreateViewString, getCreationInOutputProcedureToken, getCreationOutputProcedureToken, getCursorCode, getCustomModifyValueForCall, getDefaultSequenceTableName, getDriverSupportsNVarChar, getDropDatabaseSchemaString, getFieldTypeDefinition, getFieldTypes, getFunctionCallHeader, getIdentifierQuoteCharacter, getIndexNamePrefix, getInputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCTypeForSetNull, getJdbcTypeName, getMaxBatchWritingSize, getMaxForeignKeyNameSize, getMaxIndexNameSize, getMaxUniqueKeyNameSize, getNoWaitString, getObjectFromResultSet, getOutputProcedureToken, getPartitioningCallback, getPingSQL, getProcedureArgumentSetter, getProcedureArgumentString, getProcedureAsString, getProcedureCallHeader, getProcedureCallTail, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTableCreationSuffix, getTempTableForTable, getTransactionIsolation, getTypeConverters, getUniqueConstraintDeletionString, getUseNationalCharacterVaryingTypeForString, getVPDClearIdentifierQuery, getVPDCreationFunctionString, getVPDCreationPolicyString, getVPDDeletionString, getVPDSetIdentifierQuery, hasPartitioningCallback, initialize, initializeConnectionData, isCastRequired, isDynamicSQLRequiredForFunctions, isForUpdateCompatibleWithDistinct, isInformixOuterJoin, isLobCompatibleWithDistinct, isLockTimeoutException, isNullAllowedInSelectClause, isOutputAllowWithResultSet, isRowCountOutputParameterRequired, isXDBDocument, maximumNumericValues, minimumNumericValues, minimumTimeIncrement, prepareBatchStatement, printFieldNotNullClause, printFieldNullClause, printFieldTypeSize, printFieldUnique, printStoredFunctionReturnKeyWord, printValuelist, printValuelist, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureBrackets, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTableInIndexDropDDL, requiresTypeNameToRegisterOutputParameter, requiresUniqueConstraintCreationOnTableCreate, retrieveFirstPrimaryKeyOrOne, rollbackTransaction, setBatchWritingMechanism, setCastSizeForVarcharParameter, setClassTypes, setCursorCode, setDriverName, setDriverSupportsNVarChar, setFieldTypes, setIsCastRequired, setMaxBatchWritingSize, setNullFromDatabaseField, setParameterValueInDatabaseCall, setPartitioningCallback, setPingSQL, setPrintInnerJoinInWhereClause, setPrintOuterJoinInWhereClause, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldBindLiterals, setShouldCacheAllStatements, setShouldCreateIndicesOnForeignKeys, setShouldForceBindAllParameters, setShouldForceFieldNamesToUpperCase, setShouldIgnoreCaseOnFieldComparisons, setShouldOptimizeDataConversion, setShouldTrimStrings, setShouldUseRownumFiltering, setStatementCacheSize, setStoredProcedureTerminationToken, setStringBindingSize, setSupportsAutoCommit, setTableCreationSuffix, setTransactionIsolation, setUseJDBCStoredProcedureSyntax, setUseNationalCharacterVaryingTypeForString, setUsesBatchWriting, setUsesByteArrayBinding, setUsesJDBCBatchWriting, setUsesNativeBatchWriting, setUsesNativeSQL, setUsesStreamsForBinding, setUsesStringBinding, shouldAlwaysUseTempStorageForModifyAll, shouldBindAllParameters, shouldBindLiterals, shouldCacheAllStatements, shouldCreateIndicesForPrimaryKeys, shouldCreateIndicesOnForeignKeys, shouldCreateIndicesOnUniqueKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldIgnoreException, shouldOptimizeDataConversion, shouldPrintConstraintNameAfter, shouldPrintFieldIdentityClause, shouldPrintForUpdateClause, shouldPrintInnerJoinInWhereClause, shouldPrintInOutputTokenBeforeType, shouldPrintInputTokenAtStart, shouldPrintLockingClauseAfterWhereClause, shouldPrintOuterJoinInWhereClause, shouldPrintOutputTokenBeforeType, shouldPrintStoredProcedureArgumentNameInCall, shouldPrintStoredProcedureVariablesAfterBeginString, shouldTempTableSpecifyPrimaryKeys, shouldTrimStrings, shouldUseCustomModifyForCall, shouldUseGetSetNString, shouldUseRownumFiltering, supportsANSIInnerJoinSyntax, supportsAutoCommit, supportsAutoConversionToNumericForArithmeticOperations, supportsConnectionUserName, supportsCountDistinctWithMultipleFields, supportsDeleteOnCascade, supportsForeignKeyConstraints, supportsGlobalTempTables, supportsIndexes, supportsIndividualTableLocking, supportsLockingQueriesWithMultipleTables, supportsNestingOuterJoins, supportsOuterJoinsWithBrackets, supportsPrimaryKeyConstraint, supportsStoredFunctions, supportsTempTables, supportsUniqueColumns, supportsUniqueKeyConstraints, supportsVPD, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAddColumnClause, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDeleteFromTargetTableUsingTempTableSql, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeParameterMarker, writeTableCreationSuffix
addOperator, addSequence, addSequence, buildNativeCall, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, clone, convertObject, createConnectionCustomizer, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultNativeSequenceToTable, getDefaultSequence, getDefaultSequenceToWrite, getEndDelimiter, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, hasDefaultSequence, initializeDefaultQueries, isAccess, isAttunity, isCloudscape, isDB2, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMaxDB, isMySQL, isODBC, isOracle, isOracle9, isPervasive, isPointBase, isSQLAnywhere, isSQLServer, isSybase, isSymfoware, isTimesTen, isTimesTen7, removeAllSequences, removeSequence, sequencesAfterCloneCleanup, setConversionManager, setDefaultNativeSequenceToTable, setDefaultSequence, setEndDelimiter, setSelectSequenceNumberQuery, setSequencePreallocationSize, setSequences, setStartDelimiter, setTableQualifier, setTimestampQuery, setUpdateSequenceQuery, shouldNativeSequenceUseTransaction, shouldPrepare, shouldSelectDistinctIncludeOrderBy, shouldSelectIncludeOrderBy, supportsNativeSequenceNumbers, toString, usesPlatformDefaultSequence
public int getJDBCType(java.lang.Class javaType)
getJDBCType
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
protected void appendBoolean(java.lang.Boolean bool, java.io.Writer writer) throws java.io.IOException
appendBoolean
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
java.io.IOException
public int computeMaxRowsForSQL(int firstResultIndex, int maxResults)
computeMaxRowsForSQL
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
firstResultIndex
- maxResults
- MySQLPlatform
protected void initializePlatformOperators()
initializePlatformOperators
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
public static ExpressionOperator regexpOperator()
protected ExpressionOperator toNumberOperator()
public ValueReadQuery getTimestampQuery()
getTimestampQuery
in interface org.eclipse.persistence.internal.databaseaccess.Platform
getTimestampQuery
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
public java.lang.String getInOutputProcedureToken()
getInOutputProcedureToken
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public boolean shouldPrintOutputTokenAtStart()
shouldPrintOutputTokenAtStart
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public boolean isJDBCExecuteCompliant()
isJDBCExecuteCompliant
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
PostgreSQLPlatform
public boolean isPostgreSQL()
isPostgreSQL
in interface org.eclipse.persistence.internal.databaseaccess.Platform
isPostgreSQL
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
protected java.lang.String getCreateTempTableSqlSuffix()
getCreateTempTableSqlSuffix
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public boolean shouldPrintAliasForUpdate()
shouldPrintAliasForUpdate
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public boolean supportsIdentity()
supportsIdentity
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
public ValueReadQuery buildSelectQueryForIdentity()
buildSelectQueryForIdentity
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
public boolean supportsSequenceObjects()
supportsSequenceObjects
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
public ValueReadQuery buildSelectQueryForSequenceObject(java.lang.String qualifiedSeqName, java.lang.Integer size)
buildSelectQueryForSequenceObject
in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
public void printFieldIdentityClause(java.io.Writer writer) throws ValidationException
printFieldIdentityClause
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
ValidationException
protected java.util.Hashtable buildFieldTypes()
buildFieldTypes
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
protected ExpressionOperator operatorLocate()
protected ExpressionOperator operatorLocate2()
public boolean supportsLocalTempTables()
supportsLocalTempTables
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
protected java.lang.String getCreateTempTableSqlPrefix()
getCreateTempTableSqlPrefix
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public int getMaxFieldNameSize()
getMaxFieldNameSize
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public java.lang.String getProcedureBeginString()
getProcedureBeginString
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public java.lang.String getProcedureEndString()
getProcedureEndString
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public java.lang.String buildProcedureCallString(StoredProcedureCall call, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord row)
buildProcedureCallString
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public java.lang.String getAssignmentString()
getAssignmentString
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public java.lang.String getDropCascadeString()
getDropCascadeString
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public void printFieldTypeSize(java.io.Writer writer, FieldDefinition field, org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause) throws java.io.IOException
printFieldTypeSize
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
java.io.IOException
public void printFieldUnique(java.io.Writer writer, boolean shouldPrintFieldIdentityClause) throws java.io.IOException
printFieldUnique
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
java.io.IOException
public boolean shouldUseJDBCOuterJoinSyntax()
shouldUseJDBCOuterJoinSyntax
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public boolean isAlterSequenceObjectSupported()
isAlterSequenceObjectSupported
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public void printSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
printSQLSelectStatement
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public void writeUpdateOriginalFromTempTableSql(java.io.Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, java.util.Collection pkFields, java.util.Collection assignedFields) throws java.io.IOException
writeUpdateOriginalFromTempTableSql
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
writer
- for writing the sqltable
- is original table for which temp table is
created.pkFields
- - primary key fields for the original
table.assignedFields
- - fields to be assigned a new value.java.io.IOException
public boolean canBuildCallWithReturning()
canBuildCallWithReturning
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
public org.eclipse.persistence.internal.databaseaccess.DatabaseCall buildCallWithReturning(SQLCall sqlCall, java.util.Vector returnFields)
buildCallWithReturning
in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform