Module org.eclipse.persistence.core
Class PostgreSQLPlatform
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
- org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
- org.eclipse.persistence.platform.database.DatabasePlatform
-
- org.eclipse.persistence.platform.database.PostgreSQLPlatform
-
- All Implemented Interfaces:
Serializable,Cloneable,CorePlatform<ConversionManager>,Platform
- Direct Known Subclasses:
PostgreSQL10Platform
public class PostgreSQLPlatform extends DatabasePlatform
Purpose: Provides Postgres specific behavior.
Responsibilities:
- Native SQL for Date, Time, & Timestamp.
- Native sequencing.
- Mapping of class types to database types for the schema framework.
- Pessimistic locking.
- Platform specific operators.
- LIMIT/OFFSET query syntax for select statements.
- Since:
- OracleAS TopLink 10g (10.1.3)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.platform.database.DatabasePlatform
DEFAULT_VARCHAR_SIZE
-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
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, shouldBindPartialParameters, shouldCacheAllStatements, shouldCreateIndicesOnForeignKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, storedProcedureTerminationToken, stringBindingSize, structConverters, supportsAutoCommit, tableCreationSuffix, transactionIsolation, typeConverters, useJDBCStoredProcedureSyntax, useNationalCharacterVarying, useRownumFiltering, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesStreamsForBinding, usesStringBinding
-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultNativeSequenceToTable, defaultSeqenceAtNextValue, defaultSequence, endDelimiter, platformOperators, sequences, sequencesLock, startDelimiter, supportsReturnGeneratedKeys, tableQualifier, timestampQuery, uuidQuery
-
-
Constructor Summary
Constructors Constructor Description PostgreSQLPlatform()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendBoolean(Boolean bool, Writer writer)Appends a Boolean value.DatabaseCallbuildCallWithReturning(SQLCall sqlCall, Vector<DatabaseField> returnFields)INTERNAL: Uses the returning clause on Postgres.protected Hashtable<Class<?>,FieldTypeDefinition>buildFieldTypes()Return the mapping of class types to database types for the schema framework.StringbuildProcedureCallString(StoredProcedureCall call, AbstractSession session, AbstractRecord row)INTERNAL: Used for sp calls.ValueReadQuerybuildSelectQueryForIdentity()INTERNAL: Returns query used to read back the value generated by Identity.ValueReadQuerybuildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size)INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence).booleancanBuildCallWithReturning()INTERNAL: Postgres has a returning clause.intcomputeMaxRowsForSQL(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.StringgetAssignmentString()INTERNAL Used for stored function calls.protected StringgetCreateTempTableSqlPrefix()INTERNAL:protected StringgetCreateTempTableSqlSuffix()INTERNAL:StringgetDropCascadeString()Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.StringgetInOutputProcedureToken()This method is used to print the output parameter token when stored procedures are calledintgetJDBCType(Class<?> javaType)Return the JDBC type for the Java type.intgetMaxFieldNameSize()INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.StringgetProcedureBeginString()INTERNAL: Used for sp calls.StringgetProcedureEndString()INTERNAL: Used for sp calls.ValueReadQuerygetTimestampQuery()INTERNAL: This method returns the query to select the timestamp from the server for Postgres.protected voidinitializePlatformOperators()INTERNAL: Initialize any platform-specific operatorsbooleanisAlterSequenceObjectSupported()INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.booleanisJDBCExecuteCompliant()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.booleanisPostgreSQL()INTERNAL: Answers whether platform is Postgres.protected ExpressionOperatoroperatorLocate()INTERNAL: Override the default locate operator.protected ExpressionOperatoroperatorLocate2()INTERNAL: Override the default locate operator.voidprintFieldIdentityClause(Writer writer)INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.voidprintFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause)voidprintFieldUnique(Writer writer, boolean shouldPrintFieldIdentityClause)voidprintSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement)Print the pagination SQL using Postgres syntax " LIMIT <max> OFFSET <first>".static ExpressionOperatorregexpOperator()INTERNAL: Create the ~ operator.protected voidsetNullFromDatabaseField(DatabaseField databaseField, PreparedStatement statement, int index)voidsetParameterValueInDatabaseCall(Object parameter, CallableStatement statement, String name, AbstractSession session)INTERNAL Set the parameter in the JDBC statement at the given index in case it is a UUID value.voidsetParameterValueInDatabaseCall(Object parameter, PreparedStatement statement, int index, AbstractSession session)INTERNAL Set the parameter in the JDBC statement at the given index in case it is a UUID value.booleanshouldPrintAliasForUpdate()INTERNAL: Indicates whether locking OF clause should print alias for field.booleanshouldPrintOutputTokenAtStart()This is required in the construction of the stored procedures with output parametersbooleanshouldUseJDBCOuterJoinSyntax()JDBC defines and outer join syntax, many drivers do not support this.booleansupportsIdentity()INTERNAL: Indicates whether the platform supports identity.booleansupportsLocalTempTables()INTERNAL:booleansupportsSequenceObjects()INTERNAL: Indicates whether the platform supports sequence objects.protected ExpressionOperatortoNumberOperator()INTERNAL: Postgres to_number has two arguments, as fix format argument.voidwriteUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, Collection<DatabaseField> pkFields, Collection<DatabaseField> assignedFields)INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work.-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
addBatch, addStructConverter, allowBindingForSelectClause, 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, checkTableExists, commitTransaction, convertToDatabaseType, copyInto, createArray, createArray, createPlatformDefaultSequence, createStruct, 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, getIndexNamePrefix, getInputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCTypeForSetNull, getJdbcTypeName, getJsonPlatform, getMaxBatchWritingSize, getMaxForeignKeyNameSize, getMaxIndexNameSize, getMaxUniqueKeyNameSize, getNoWaitString, getObjectFromResultSet, getOutputProcedureToken, getParameterValueFromDatabaseCall, getParameterValueFromDatabaseCall, getPartitioningCallback, getPingSQL, getProcedureArgument, getProcedureArgumentString, getProcedureAsString, getProcedureCallHeader, getProcedureCallTail, getProcedureOptionList, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTableCreationSuffix, getTableExistsQuery, 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, registerOutputParameter, registerOutputParameter, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureBrackets, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTableInIndexDropDDL, requiresTypeNameToRegisterOutputParameter, requiresUniqueConstraintCreationOnTableCreate, retrieveFirstPrimaryKeyOrOne, rollbackTransaction, setBatchWritingMechanism, setCastSizeForVarcharParameter, setClassTypes, setCursorCode, setDriverName, setDriverSupportsNVarChar, setFieldTypes, setIsCastRequired, setMaxBatchWritingSize, setNullFromDatabaseField, setPartitioningCallback, setPingSQL, setPrintInnerJoinInWhereClause, setPrintOuterJoinInWhereClause, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldBindLiterals, setShouldBindPartialParameters, 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, shouldBindPartialParameters, 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, supportsOrderByParameters, supportsOuterJoinsWithBrackets, supportsPrimaryKeyConstraint, supportsStoredFunctions, supportsTempTables, supportsUniqueColumns, supportsUniqueKeyConstraints, supportsVPD, supportsWaitForUpdate, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAddColumnClause, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDeleteFromTargetTableUsingTempTableSql, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeParameterMarker, writeTableCreationSuffix
-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
addOperator, addSequence, addSequence, buildNativeCall, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, clone, convertObject, createConnectionCustomizer, createExpressionFor, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultNativeSequenceToTable, getDefaultSeqenceAtNextValue, getDefaultSequence, getDefaultSequenceToWrite, getDriverVersion, getEndDelimiter, getINClauseLimit, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, getUUIDQuery, hasDefaultSequence, initializeDefaultQueries, initIdentitySequences, isAccess, isAttunity, isCloudscape, isDB2, isDB2Z, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMariaDB, isMaxDB, isMySQL, isODBC, isOracle, isOracle12, isOracle23, isOracle9, isPervasive, isPointBase, isSQLAnywhere, isSQLServer, isSybase, isSymfoware, isTimesTen, isTimesTen7, removeAllSequences, removeIdentitySequences, removeSequence, sequencesAfterCloneCleanup, setConversionManager, setDefaultNativeSequenceToTable, setDefaultSeqenceAtNextValue, setDefaultSequence, setEndDelimiter, setSelectSequenceNumberQuery, setSequencePreallocationSize, setSequences, setStartDelimiter, setSupportsReturnGeneratedKeys, setTableQualifier, setTimestampQuery, setUpdateSequenceQuery, setUUIDQuery, shouldNativeSequenceUseTransaction, shouldPrepare, shouldSelectDistinctIncludeOrderBy, shouldSelectIncludeOrderBy, supportsNativeSequenceNumbers, supportsReturnGeneratedKeys, toString, usesPlatformDefaultSequence
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.internal.databaseaccess.Platform
connectionProperties
-
-
-
-
Method Detail
-
getJDBCType
public int getJDBCType(Class<?> javaType)
Return the JDBC type for the Java type. For some reason PostgreSQL does not seem to like the JDBC Blob type (PostgreSQL 8.2).- Overrides:
getJDBCTypein classDatabasePlatform
-
appendBoolean
protected void appendBoolean(Boolean bool, Writer writer) throws 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.- Overrides:
appendBooleanin classDatabasePlatform- Throws:
IOException
-
computeMaxRowsForSQL
public 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. These limits tend to be used in two ways. 1. MaxRows is the index of the last row to be returned (like JDBC maxResults) 2. MaxRows is the number of rows to be returned PostGreSQL uses case #2 and therefore the maxResults has to be altered based on the firstResultIndex- Overrides:
computeMaxRowsForSQLin classDatabasePlatform- See Also:
MySQLPlatform
-
initializePlatformOperators
protected void initializePlatformOperators()
INTERNAL: Initialize any platform-specific operators- Overrides:
initializePlatformOperatorsin classDatasourcePlatform
-
regexpOperator
public static ExpressionOperator regexpOperator()
INTERNAL: Create the ~ operator. REGEXP allows for comparison through regular expression.
-
toNumberOperator
protected ExpressionOperator toNumberOperator()
INTERNAL: Postgres to_number has two arguments, as fix format argument.
-
getTimestampQuery
public ValueReadQuery getTimestampQuery()
INTERNAL: This method returns the query to select the timestamp from the server for Postgres.- Specified by:
getTimestampQueryin interfacePlatform- Overrides:
getTimestampQueryin classDatasourcePlatform
-
getInOutputProcedureToken
public String getInOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called- Overrides:
getInOutputProcedureTokenin classDatabasePlatform
-
shouldPrintOutputTokenAtStart
public boolean shouldPrintOutputTokenAtStart()
This is required in the construction of the stored procedures with output parameters- Overrides:
shouldPrintOutputTokenAtStartin classDatabasePlatform
-
isJDBCExecuteCompliant
public 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. This flag will help avoid throwing a JPA mandated exception on an executeUpdate call (which calls jdbc execute and checks the return value to ensure no results sets are returned (true))- Overrides:
isJDBCExecuteCompliantin classDatabasePlatform- See Also:
PostgreSQLPlatform
-
isPostgreSQL
public boolean isPostgreSQL()
INTERNAL: Answers whether platform is Postgres.- Specified by:
isPostgreSQLin interfacePlatform- Overrides:
isPostgreSQLin classDatasourcePlatform
-
getCreateTempTableSqlSuffix
protected String getCreateTempTableSqlSuffix()
INTERNAL:- Overrides:
getCreateTempTableSqlSuffixin classDatabasePlatform
-
shouldPrintAliasForUpdate
public boolean shouldPrintAliasForUpdate()
INTERNAL: Indicates whether locking OF clause should print alias for field. Example: on Oracle platform (method returns false): SELECT ADDRESS_ID, ... FROM ADDRESS T1 WHERE (T1.ADDRESS_ID = ?) FOR UPDATE OF T1.ADDRESS_ID on Postgres platform (method returns true): SELECT ADDRESS_ID, ... FROM ADDRESS T1 WHERE (T1.ADDRESS_ID = ?) FOR UPDATE OF T1- Overrides:
shouldPrintAliasForUpdatein classDatabasePlatform
-
supportsIdentity
public boolean supportsIdentity()
INTERNAL: Indicates whether the platform supports identity.- Overrides:
supportsIdentityin classDatasourcePlatform
-
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.- Overrides:
buildSelectQueryForIdentityin classDatasourcePlatform
-
supportsSequenceObjects
public boolean supportsSequenceObjects()
INTERNAL: Indicates whether the platform supports sequence objects.- Overrides:
supportsSequenceObjectsin classDatasourcePlatform
-
buildSelectQueryForSequenceObject
public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, 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.- Overrides:
buildSelectQueryForSequenceObjectin classDatasourcePlatform
-
printFieldIdentityClause
public void printFieldIdentityClause(Writer writer) throws ValidationException
INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.- Overrides:
printFieldIdentityClausein classDatabasePlatform- Throws:
ValidationException
-
buildFieldTypes
protected Hashtable<Class<?>,FieldTypeDefinition> buildFieldTypes()
Description copied from class:DatabasePlatformReturn the mapping of class types to database types for the schema framework.- Overrides:
buildFieldTypesin classDatabasePlatform
-
operatorLocate
protected ExpressionOperator operatorLocate()
INTERNAL: Override the default locate operator.
-
operatorLocate2
protected ExpressionOperator operatorLocate2()
INTERNAL: Override the default locate operator.
-
supportsLocalTempTables
public boolean supportsLocalTempTables()
INTERNAL:- Overrides:
supportsLocalTempTablesin classDatabasePlatform
-
getCreateTempTableSqlPrefix
protected String getCreateTempTableSqlPrefix()
INTERNAL:- Overrides:
getCreateTempTableSqlPrefixin classDatabasePlatform
-
getMaxFieldNameSize
public int getMaxFieldNameSize()
INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.- Overrides:
getMaxFieldNameSizein classDatabasePlatform
-
getProcedureBeginString
public String getProcedureBeginString()
INTERNAL: Used for sp calls.- Overrides:
getProcedureBeginStringin classDatabasePlatform
-
getProcedureEndString
public String getProcedureEndString()
INTERNAL: Used for sp calls.- Overrides:
getProcedureEndStringin classDatabasePlatform
-
buildProcedureCallString
public String buildProcedureCallString(StoredProcedureCall call, AbstractSession session, AbstractRecord row)
INTERNAL: Used for sp calls. PostGreSQL uses a different method for executing StoredProcedures than other platforms.- Overrides:
buildProcedureCallStringin classDatabasePlatform
-
getAssignmentString
public String getAssignmentString()
INTERNAL Used for stored function calls.- Overrides:
getAssignmentStringin classDatabasePlatform
-
getDropCascadeString
public String getDropCascadeString()
Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.- Overrides:
getDropCascadeStringin classDatabasePlatform
-
printFieldTypeSize
public void printFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause) throws IOException
- Overrides:
printFieldTypeSizein classDatabasePlatform- Throws:
IOException
-
printFieldUnique
public void printFieldUnique(Writer writer, boolean shouldPrintFieldIdentityClause) throws IOException
- Overrides:
printFieldUniquein classDatabasePlatform- Throws:
IOException
-
shouldUseJDBCOuterJoinSyntax
public boolean shouldUseJDBCOuterJoinSyntax()
JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.- Overrides:
shouldUseJDBCOuterJoinSyntaxin classDatabasePlatform
-
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.- Overrides:
isAlterSequenceObjectSupportedin classDatabasePlatform
-
printSQLSelectStatement
public void printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement)
Print the pagination SQL using Postgres syntax " LIMIT <max> OFFSET <first>".- Overrides:
printSQLSelectStatementin classDatabasePlatform
-
writeUpdateOriginalFromTempTableSql
public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, Collection<DatabaseField> pkFields, Collection<DatabaseField> assignedFields) throws IOException
INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work. Write an sql string for updating the original table from the temporary table. Precondition: supportsTempTables() == true. Precondition: pkFields and assignFields don't intersect.- Overrides:
writeUpdateOriginalFromTempTableSqlin classDatabasePlatform- Parameters:
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.- Throws:
IOException
-
canBuildCallWithReturning
public boolean canBuildCallWithReturning()
INTERNAL: Postgres has a returning clause.- Overrides:
canBuildCallWithReturningin classDatabasePlatform
-
buildCallWithReturning
public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector<DatabaseField> returnFields)
INTERNAL: Uses the returning clause on Postgres.- Overrides:
buildCallWithReturningin classDatabasePlatform
-
setNullFromDatabaseField
protected void setNullFromDatabaseField(DatabaseField databaseField, PreparedStatement statement, int index) throws SQLException
- Overrides:
setNullFromDatabaseFieldin classDatabasePlatform- Throws:
SQLException
-
setParameterValueInDatabaseCall
public void setParameterValueInDatabaseCall(Object parameter, PreparedStatement statement, int index, AbstractSession session) throws SQLException
INTERNAL Set the parameter in the JDBC statement at the given index in case it is a UUID value.- Overrides:
setParameterValueInDatabaseCallin classDatabasePlatform- Parameters:
parameter- the parameter to setstatement- targetPreparedStatementinstanceindex- index of the parameter in the statementsession- current database session- Throws:
SQLException
-
setParameterValueInDatabaseCall
public void setParameterValueInDatabaseCall(Object parameter, CallableStatement statement, String name, AbstractSession session) throws SQLException
INTERNAL Set the parameter in the JDBC statement at the given index in case it is a UUID value.- Overrides:
setParameterValueInDatabaseCallin classDatabasePlatform- Parameters:
parameter- the parameter to setstatement- targetCallableStatementinstancename- name of the parameter in the statementsession- current database session- Throws:
SQLException
-
-