Class DatabasePlatform
- All Implemented Interfaces:
Serializable
,Cloneable
,CorePlatform<ConversionManager>
,Platform
- Direct Known Subclasses:
DatabasePlatform
- Since:
- TOPLink/Java 1.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected BatchWritingMechanism
Allow for a custom batch writing mechanism.protected int
used for casting of input parameters in certain DBsStores mapping of class types to database types for schema creation.protected int
Allow for the code that is used for preparing cursored outs for a storedprocedure to be settable.static final int
Bug#3214927 The default is 32000 for DynamicSQLBatchWritingMechanism.static final int
protected String
protected boolean
True if the current jdbc driver supports get/setNString methodsprotected Map
<Class<?>, FieldTypeDefinition> Holds a map of values used to map JAVA types to database types for table creationstatic final int
Timeout used is isValid() check for dead connections.protected boolean
Allow platform specific cast to be enabled.protected int
Allow for the batch size to be set as many database have strict limits.protected DataPartitioningCallback
Used to integrate with data partitioning in an external DataSource such as UCP.protected String
This attribute will store the SQL query that will be used to 'ping' the database connection in order to check the health of a connection.protected Boolean
Allow configuration option to use Where clause joining or From clause joining.protected Boolean
Allow configuration option to use Where clause outer joining or From clause joining.protected Boolean
Bind all arguments to any SQL statement.protected boolean
Allow user to require literals to be bound.protected boolean
Bind some arguments to any SQL statement.protected boolean
Cache all prepared statements, this requires full parameter binding as well.protected boolean
Allows auto-indexing for foreign keys to be set.protected boolean
Bind all arguments to any SQL statement.protected boolean
Can be used if the app expects upper case but the database is not return consistent case, i.e.static boolean
Allow for case in field names to be ignored as some databases are not case sensitive and when using custom this can be an issue.protected boolean
Allow for driver level data conversion optimization to be disabled, required because some drivers can loose precision.protected boolean
Indicates (if true) to remove blanks characters from the right of CHAR strings.protected int
The statement cache size for prepare parameterized statements.protected String
The delimiter between stored procedures in multiple stored procedure calls.protected int
Indicates the size above which strings will be bound NOTE: does not work with ODBCprotected Map
<String, StructConverter> The following two maps, provide two ways of looking up StructConverters.protected boolean
Some JDBC drivers do not support AutoCommit in the way EclipseLink expects.protected String
String used on all table creation statements generated from the DefaultTableGenerator with a session using this project.protected int
The transaction isolation level to be set on the connection (optional).protected Map
<Class<?>, StructConverter> protected Boolean
protected boolean
If true, the platform should map String columns to a type that supports national characters.protected boolean
Some platforms allow a query's maxRows and FirstResult settings to be specified in SQL.protected boolean
Batch all write statementsprotected boolean
Indicates that binding will be used for BLOB data.protected boolean
Allow for our batch writing support to be used in JDK 1.2.protected boolean
bug 4241441: Allow custom batch writing to enable batching with optimistic locking.protected boolean
Indicates that native SQL should be used for literal values instead of ODBC escape format Only used with Oracle, Sybase & DB2protected boolean
Indicates that streams will be used to store BLOB data.protected boolean
Indicates that strings will above the stringBindingSize will be bound NOTE: does not work with ODBCFields 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
-
Method Summary
Modifier and TypeMethodDescriptionint
addBatch
(PreparedStatement statement) INTERNAL: This gets called on each iteration to add parameters to the batch Needs to be implemented so that it returns the number of rows successfully modified by this statement for optimistic locking purposes (if useNativeBatchWriting is enabled, and the call uses optimistic locking).void
addStructConverter
(StructConverter converter) PUBLIC: Add a StructConverter to this DatabasePlatform This StructConverter will be invoked for all writes to the database for the class returned by its getJavaType() method and for all reads from the database for the Structs described by its getStructName() methodboolean
boolean
Used for stored procedure definitions.protected void
appendBoolean
(Boolean bool, Writer writer) Appends a Boolean value as a numberprotected void
appendByteArray
(byte[] bytes, Writer writer) Append the ByteArray in ODBC literal format ({b hexString}).protected void
appendCalendar
(Calendar calendar, Writer writer) Answer a platform correct string representation of a Calendar as a Timestamp, suitable for SQL generation.protected void
appendDate
(Date date, Writer writer) Answer a platform correct string representation of a Date, suitable for SQL generation.void
appendLiteralToCall
(Call call, Writer writer, Object literal, Boolean canBind) INTERNAL: In case shouldBindLiterals is true, instead of null value a DatabaseField value may be passed (so that it's type could be used for binding null).protected void
appendLiteralToCallWithBinding
(Call call, Writer writer, Object literal) INTERNAL: Override this method in case the platform needs to do something special for binding literals.protected void
appendNumber
(Number number, Writer writer) Write number to SQL string.void
appendParameter
(Call call, Writer writer, Object parameter) Write a database-friendly representation of the given parameter to the writer.int
appendParameterInternal
(Call call, Writer writer, Object parameter) Returns the number of parameters that used binding.protected void
appendString
(String string, Writer writer) Write the string.protected void
appendTime
(Time time, Writer writer) Answer a platform correct string representation of a Time, suitable for SQL generation.protected void
appendTimestamp
(Timestamp timestamp, Writer writer) Answer a platform correct string representation of a Timestamp, suitable for SQL generation.void
autoCommit
(DatabaseAccessor accessor) Used by JDBC drivers that do not support autocommit so simulate an autocommit.void
beginTransaction
(DatabaseAccessor accessor) Used for jdbc drivers which do not support autocommit to explicitly begin a transaction This method is a no-op for databases which implement autocommit as expected.buildBatchCriteria
(ExpressionBuilder builder, Expression field) INTERNAL: Return the selection criteria used to IN batch fetching.buildBatchCriteriaForComplexId
(ExpressionBuilder builder, List<Expression> fields) INTERNAL: Return the selection criteria used to IN batch fetching.buildCallWithReturning
(SQLCall sqlCall, Vector<DatabaseField> returnFields) INTERNAL Returns null unless the platform supports call with returningReturn the mapping of class types to database types for the schema framework.buildCreateIndex
(String fullTableName, String indexName, String... columnNames) INTERNAL: Don't override this method.buildCreateIndex
(String fullTableName, String indexName, String qualifier, boolean isUnique, String... columnNames) INTERNAL: Override this method with the platform's CREATE INDEX statement.buildDropIndex
(String fullTableName, String indexName) INTERNAL: Don't override this method.buildDropIndex
(String fullTableName, String indexName, String qualifier) INTERNAL: Override this method with the platform's DROP INDEX statement.protected Hashtable
<Class<?>, FieldTypeDefinition> Return the mapping of class types to database types for the schema framework.buildProcedureCallString
(StoredProcedureCall call, AbstractSession session, AbstractRecord row) Return the proc syntax for this platform.buildSequenceObjectAlterIncrementWriter
(Writer writer, String fullSeqName, int increment) INTERNAL: Returns sql used to alter sequence object's increment in the database.buildSequenceObjectCreationWriter
(Writer writer, String fullSeqName, int increment, int start) INTERNAL: Returns sql used to create sequence object in the database.buildSequenceObjectDeletionWriter
(Writer writer, String fullSeqName) INTERNAL: Returns sql used to delete sequence object from the database.boolean
INTERNAL: Supports Batch Writing with Optimistic Locking.boolean
INTERNAL Indicates whether the platform can build call with returning.boolean
checkTableExists
(DatabaseSessionImpl session, TableDefinition table, boolean suppressLogging) INTERNAL: Executes and evaluates query to check whether given table exists.void
commitTransaction
(DatabaseAccessor accessor) Used for jdbc drivers which do not support autocommit to explicitly commit a transaction This method is a no-op for databases which implement autocommit as expected.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.convertToDatabaseType
(Object value) INTERNAL We support more primitive than JDBC does so we must do conversion before printing or binding.void
Copy the state into the new platform.createArray
(String elementDataTypeName, Object[] elements, Connection connection) INTERNAL: Platforms that support java.sql.Array may override this method.createArray
(String elementDataTypeName, Object[] elements, AbstractSession session, Connection connection) INTERNAL: This method builds an Array using the unwrapped connection within the sessionprotected Sequence
INTERNAL: Create platform-default SequencecreateStruct
(String structTypeName, Object[] attributes, Connection connection) INTERNAL: Platforms that support java.sql.Struct may override this method.createStruct
(String structTypeName, Object[] attributes, AbstractRecord row, Vector<DatabaseField> orderedFields, AbstractSession session, Connection connection) INTERNAL: This method builds a Struct using the unwrapped connection within the sessioncreateStruct
(String structTypeName, Object[] attributes, AbstractSession session, Connection connection) INTERNAL: This method builds a Struct using the unwrapped connection within the sessionboolean
INTERNAL: May need to override this method if the sql generated for UpdateAllQuery using temp tables fails in case parameter binding is used.int
executeBatch
(Statement statement, boolean isStatementPrepared) Internal: This gets called on each batch statement execution Needs to be implemented so that it returns the number of rows successfully modified by this statement for optimistic locking purposes.executeStoredProcedure
(DatabaseCall dbCall, PreparedStatement statement, DatabaseAccessor accessor, AbstractSession session) because each platform has different requirements for accessing stored procedures and the way that we can combine resultsets and output params, the stored procedure call is being executed on the platform.void
freeTemporaryObject
(Object value) INTERNAL: Used by some platforms during reading of ResultSet to free temporary objects.Used for stored function calls.Used for batch writing and sp defs.Used for batch writing and sp defs.Used for batch writing and sp defs.Used for batch writing for row count return.Used for batch writing for row count return.Used for batch writing for row count return.Return the custom batch writing mechanism.int
ADVANCED: Get the maximum length allowed by the database for a Varchar Parameter This is used by subclasses when writing SQL for parametersReturn the class type to database type mapping for the schema framework.getConnection
(AbstractSession session, Connection connection) INTERNAL: This method is used to unwrap the oracle connection wrapped by the application server.INTERNAL: Returns user name retrieved from JDBC connection.Used for constraint deletion.getCreateDatabaseSchemaString
(String schema) Return the create schema SQL syntax.protected String
INTERNAL: May override this method if the platform supports temporary tables.protected String
INTERNAL: Override this method if the platform supports temporary tables.protected String
INTERNAL: May override this method if the platform support temporary tables./** Used for view creation.This method is used to print the required output parameter token for the specific platform.This method is used to print the required output parameter token for the specific platform.int
ADVANCED: Return the code for preparing cursored output parameters in a stored proceduregetCustomModifyValueForCall
(Call call, Object value, DatabaseField field, boolean shouldBind) This method determines if any special processing needs to occur prior to writing a field.Returns the table name used by TableSequence by default.boolean
Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.getDropDatabaseSchemaString
(String schema) Return the drop schema SQL syntax.getFieldTypeDefinition
(Class<?> javaClass) Return the field type object describing this databases platform specific representation of the Java primitive class name.Return the class type to database type mappings for the schema framework.Used for stored function calls.getIndexNamePrefix
(boolean isUniqueSetOnField) Used to allow platforms to define their own index prefixesThis method is used to print the output parameter token when stored procedures are calledUsed for stored procedure creation: Prefix for INPUT parameters.Returns the JDBC outer join operator for SELECT statements.int
getJDBCType
(Class<?> javaType) Return the JDBC type for the Java type.int
getJDBCType
(DatabaseField field) Return the JDBC type for the given database field.int
Return the JDBC type for the given database field to be passed to Statement.setNullgetJdbcTypeName
(int jdbcType) INTERNAL: Returns the type name corresponding to the jdbc typeGet JSON support extension instance.int
PUBLIC: Allow for the max batch writing size to be set.int
INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.int
INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.int
INTERNAL: returns the maximum number of characters that can be used in an index name on this platform.int
INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform.This syntax does no wait on the lock.getObjectFromResultSet
(ResultSet resultSet, int columnNumber, int type, AbstractSession session) INTERNAL: Get the object from the JDBC Result set.This method is used to print the output parameter token when stored procedures are calledgetParameterValueFromDatabaseCall
(CallableStatement statement, int index, AbstractSession session) INTERNAL Get the parameter from the JDBC statement with the given index.getParameterValueFromDatabaseCall
(CallableStatement statement, String name, AbstractSession session) INTERNAL Get the parameter from the JDBC statement with the given name.Return callback.Used for determining if an SQL exception was communication based.getProcedureArgument
(String name, Object parameter, DatasourceCall.ParameterType parameterType, StoredProcedureCall call, AbstractSession session) Obtain the platform specific argument stringUsed for sp defs.Used for stored procedure defs.Used for stored procedure defs.Used for sp calls.Used for sp calls.Used for stored procedure defs.Some platforms have an option list Only to be used for stored procedure creation.getQualifiedName
(String name) getRefValue
(Ref ref, Connection connection) INTERNAL: Platforms that support java.sql.Ref may override this method.getRefValue
(Ref ref, AbstractSession executionSession, Connection connection) INTERNAL: This method builds a REF using the unwrapped connection within the sessionThis syntax does no wait on the lock.For fine-grained pessimistic locking the column names can be specified individually.Most database support a syntax.getSelectForUpdateWaitString
(Integer waitTimeout) Platforms that support the WAIT option should override this method.int
int
The statement cache size for prepare parameterized statements.Returns the delimiter between stored procedures in multiple stored procedure calls.int
INTERNAL: Get the map of StructConverters that will be used to preprocess STRUCT data as it is readPUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).protected DataReadQuery
INTERNAL: Returns query to check whether given table exists.INTERNAL: May override this method if the platform support temporary tables.int
Returns the transaction isolation setting for a connection.Map
<Class<?>, StructConverter> INTERNAL: Get the map of TypeConverters This map indexes StructConverters by the Java Class they are meant to convertUsed for constraint deletion.boolean
getVPDClearIdentifierQuery
(String vpdIdentifier) Any platform that supports VPD should implement this method.getVPDCreationFunctionString
(String tableName, String tenantFieldName) Any platform that supports VPD should implement this method.getVPDCreationPolicyString
(String tableName, AbstractSession session) Any platform that supports VPD should implement this method.getVPDDeletionString
(String tableName, AbstractSession session) Any platform that supports VPD should implement this method.getVPDSetIdentifierQuery
(String vpdIdentifier) Any platform that supports VPD should implement this method.boolean
Check if has callback.void
Initialize operators to avoid concurrency issues.void
initializeConnectionData
(Connection connection) INTERNAL: Allow initialization from the connection.boolean
INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.boolean
Return if casting is enabled for platforms that support it.boolean
INTERNAL: Some databases have issues with using parameters on certain functions and relations.boolean
INTERNAL: Indicates whether SELECT DISTINCT ...boolean
Some database require outer joins to be given in the where clause, others require it in the from clause.boolean
Returns true if this platform complies with the expected behavior from a jdbc execute call.boolean
INTERNAL: Indicates whether SELECT DISTINCT lob FROM ...boolean
Return true is the given exception occurred as a result of a lock time out exception (WAIT clause).boolean
INTERNAL: Override this if the platform cannot handle NULL in select clause.boolean
INTERNAL: Return true if output parameters can be built with result sets.boolean
Return if the platform does not maintain the row count on batch executes and requires an output parameter to maintain the row count.boolean
isXDBDocument
(Object obj) INTERNAL: Indicates whether the passed object is an instance of XDBDocument.Builds a table of maximum numeric values keyed on java class.Builds a table of minimum numeric values keyed on java class.long
INTERNAL: Returns the minimum time increment supported by the platform.prepareBatchStatement
(Statement statement, int maxBatchWritingSize) Internal: Allows setting the batch size on the statement Is used with parameterized SQL, and should only be passed in prepared statementsvoid
printFieldIdentityClause
(Writer writer) Append the receiver's field 'identity' constraint clause to a writer.void
printFieldNotNullClause
(Writer writer) Append the receiver's field 'NOT NULL' constraint clause to a writer.void
printFieldNullClause
(Writer writer) Append the receiver's field 'NULL' constraint clause to a writer.protected void
printFieldTypeSize
(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType) void
printFieldTypeSize
(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause) protected void
printFieldUnique
(Writer writer) void
printFieldUnique
(Writer writer, boolean shouldPrintFieldIdentityClause) void
printSQLSelectStatement
(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement) INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.void
INTERNAL: Prints return keyword for StoredFunctionDefinition: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURN BIGINT The method was introduced because MySQL requires "RETURNS" instead: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURNS BIGINTint
printValuelist
(int[] theObjects, DatabaseCall call, Writer writer) Print the int array on the writer.int
printValuelist
(Collection<?> theObjects, DatabaseCall call, Writer writer) void
registerOutputParameter
(CallableStatement statement, int parameterIndex, int sqlType) This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.void
registerOutputParameter
(CallableStatement statement, int parameterIndex, int sqlType, String typeName) This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.void
registerOutputParameter
(CallableStatement statement, String parameterName, int sqlType) This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.void
registerOutputParameter
(CallableStatement statement, String parameterName, int sqlType, String typeName) This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.boolean
This is used as some databases create the primary key constraint differently, i.e.boolean
Used for stored procedure creation: Some platforms need brackets around arguments declaration even if no arguments exist.boolean
USed for sp calls.boolean
Used for sp calls.boolean
INTERNAL: Return if this database requires the table name when dropping an index.boolean
INTERNAL: Indicates whether the version of CallableStatement.registerOutputParameter method that takes type name should be used.boolean
Used for table creation.void
retrieveFirstPrimaryKeyOrOne
(ReportQuery subselect) INTERNAL: Used by Exists queries because they just need to select a single row.void
rollbackTransaction
(DatabaseAccessor accessor) Used for jdbc drivers which do not support autocommit to explicitly rollback a transaction This method is a no-op for databases which implement autocommit as expected.void
setBatchWritingMechanism
(BatchWritingMechanism batchWritingMechanism) Set the custom batch writing mechanism.void
setCastSizeForVarcharParameter
(int maxLength) ADVANCED: Set the maximum length allowed by the database for a Varchar Parameter This is used by subclasses when writing SQL for parametersprotected void
setClassTypes
(Map<String, Class<?>> classTypes) void
setCursorCode
(int cursorCode) ADVANCED: Set the code for preparing cursored output parameters in a stored procedurevoid
setDriverName
(String driverName) During auto-detect, the driver name is set on the platform.void
setDriverSupportsNVarChar
(boolean b) protected void
setFieldTypes
(Map<Class<?>, FieldTypeDefinition> theFieldTypes) void
setIsCastRequired
(boolean isCastRequired) Set if casting is enabled for platforms that support it.void
setMaxBatchWritingSize
(int maxBatchWritingSize) PUBLIC: Allow for the max batch writing size to be set.protected void
setNullFromDatabaseField
(DatabaseField databaseField, CallableStatement statement, String name) protected void
setNullFromDatabaseField
(DatabaseField databaseField, PreparedStatement statement, int index) void
setParameterValueInDatabaseCall
(Object parameter, CallableStatement statement, String name, AbstractSession session) INTERNAL Set the parameter in the JDBC statement with the given name.void
setParameterValueInDatabaseCall
(Object parameter, PreparedStatement statement, int index, AbstractSession session) INTERNAL Set the parameter in the JDBC statement at the given index.void
setPartitioningCallback
(DataPartitioningCallback partitioningCallback) Set callback.void
setPingSQL
(String pingSQL) Used for determining if an SQL exception was communication based.void
setPrintInnerJoinInWhereClause
(boolean printInnerJoinInWhereClause) PUBLIC: Changes the way that inner joins are printed in generated SQL for the database.void
setPrintOuterJoinInWhereClause
(boolean printOuterJoinInWhereClause) PUBLIC: Changes the way that OuterJoins are done on the database.void
void
void
setSequenceTableName
(String name) void
setShouldBindAllParameters
(boolean shouldBindAllParameters) Bind all arguments to any SQL statement.void
setShouldBindLiterals
(boolean shouldBindLiterals) PUBLIC: Allows user to choose whether to bind literals in DatabaseCalls or not.void
setShouldBindPartialParameters
(boolean shouldBindPartialParameters) Used to enable parameter binding and override the platform defaultvoid
setShouldCacheAllStatements
(boolean shouldCacheAllStatements) Cache all prepared statements, this requires full parameter binding as well.void
setShouldCreateIndicesOnForeignKeys
(boolean shouldCreateIndicesOnForeignKeys) Used for table creation.void
setShouldForceBindAllParameters
(boolean shouldForceBindAllParameters) Used to enable parameter binding and override the platform defaultvoid
setShouldForceFieldNamesToUpperCase
(boolean shouldForceFieldNamesToUpperCase) Can be used if the app expects upper case but the database is not return consistent case, i.e.static void
setShouldIgnoreCaseOnFieldComparisons
(boolean newShouldIgnoreCaseOnFieldComparisons) Allow for case in field names to be ignored as some databases are not case sensitive and when using custom this can be an issue.void
setShouldOptimizeDataConversion
(boolean value) PUBLIC: Set if our driver level data conversion optimization is enabled.void
setShouldTrimStrings
(boolean aBoolean) void
setShouldUseRownumFiltering
(boolean useRownumFiltering) PUBLIC: Set if SQL-Level pagination should be used for FirstResult and MaxRows settings.void
setStatementCacheSize
(int statementCacheSize) The statement cache size for prepare parameterized statements.void
setStoredProcedureTerminationToken
(String storedProcedureTerminationToken) void
setStringBindingSize
(int aSize) void
setSupportsAutoCommit
(boolean supportsAutoCommit) supportsAutoCommit can be set to false for JDBC drivers which do not support autocommit.void
setTableCreationSuffix
(String tableCreationSuffix) PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).void
setTransactionIsolation
(int isolationLevel) Set the transaction isolation setting for a connection.void
setUseJDBCStoredProcedureSyntax
(Boolean useJDBCStoredProcedureSyntax) Return true if JDBC syntax should be used for stored procedure calls.void
setUseNationalCharacterVaryingTypeForString
(boolean b) void
setUsesBatchWriting
(boolean usesBatchWriting) void
setUsesByteArrayBinding
(boolean usesByteArrayBinding) void
setUsesJDBCBatchWriting
(boolean usesJDBCBatchWriting) Some JDBC 2 drivers to not support batching, so this lets are own batching be used.void
setUsesNativeBatchWriting
(boolean usesNativeBatchWriting) Advanced: This is used to enable native batch writing on drivers that support it.void
setUsesNativeSQL
(boolean usesNativeSQL) void
setUsesStreamsForBinding
(boolean usesStreamsForBinding) void
setUsesStringBinding
(boolean aBool) boolean
INTERNAL: That method affects UpdateAllQuery and DeleteAllQuery execution.boolean
Bind all arguments to any SQL statement.boolean
PUBLIC: Allows platform to choose whether to bind literals in DatabaseCalls or not.boolean
Used to determine if the platform should perform partial parameter binding or notboolean
Cache all prepared statements, this requires full parameter binding as well.boolean
Used for table creation.boolean
Used for table creation.boolean
Used for table creation.boolean
Used to enable parameter binding and override platform defaultboolean
Can be used if the app expects upper case but the database is not return consistent case, i.e.static boolean
Allow for case in field names to be ignored as some databases are not case sensitive and when using custom this can be an issue.boolean
shouldIgnoreException
(SQLException exception) Allow for the platform to ignore exceptions.boolean
Return if our driver level data conversion optimization is enabled.boolean
INTERNAL: Indicates whether locking OF clause should print alias for field.boolean
Some Platforms want the constraint name after the constraint definition.boolean
shouldPrintFieldIdentityClause
(AbstractSession session, String qualifiedFieldName) boolean
boolean
This allows which clause inner joins are printed into in SQL generation.boolean
This is required in the construction of the stored procedures with output parametersboolean
Used for stored procedure creation: Some platforms want to print prefix for INPUT arguments BEFORE NAME.boolean
INTERNAL: Indicates whether locking clause should be printed after where clause by SQLSelectStatement.boolean
Some database require outer joins to be given in the where clause, others require it in the from clause.boolean
This is required in the construction of the stored procedures with output parametersboolean
This is required in the construction of the stored procedures with output parametersboolean
INTERNAL: Should the variable name of a stored procedure call be printed as part of the procedure call e.g.boolean
Used for stored procedure creation: Some platforms declare variables AFTER the procedure body's BEGIN string.protected boolean
INTERNAL: Indicates whether temporary table can specify primary keys (some platforms don't allow that).boolean
boolean
Used by SQLCall.appendModify(..) If the field should be passed to customModifyInDatabaseCall, retun true, otherwise false.boolean
Returns true iff: tThe current driver supports calling get/setNString Strings are globally mapped to a national character varying type (useNationalCharacterVarying()).boolean
JDBC defines and outer join syntax, many drivers do not support this.boolean
PUBLIC: Return if Oracle ROWNUM pagination should be used for FirstResult and MaxRows settings.boolean
Indicates whether the ANSI syntax for inner joins (e.g.boolean
supportsAutoCommit must sometimes be set to false for JDBC drivers which do not support autocommit.boolean
Some db allow VARCHAR db field to be used in arithmetic operations automatically converting them to numeric: UPDATE OL_PHONE SET PHONE_ORDER_VARCHAR = (PHONE_ORDER_VARCHAR + 1) WHERE ...boolean
INTERNAL: Override this method if the platform supports storing JDBC connection user name duringinitializeConnectionData(Connection)
.boolean
INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields.boolean
boolean
boolean
INTERNAL: Indicates whether the platform supports global temporary tables.boolean
INTERNAL: Return if this database support index creation.boolean
INTERNAL: Indicates whether locking clause could be selectively applied only to some tables in a ReadQuery.boolean
INTERNAL: Indicates whether the platform supports local temporary tables.boolean
INTERNAL: Indicates whether locking clause could be applied to the query that has more than one tableboolean
INTERNAL: Return if nesting outer joins is supported, i.e.boolean
Used to determine if the platform supports untyped parameters, as ordinal variables, within the Order By clauseboolean
INTERNAL: Return if brackets can be used in the ON clause for outer joins.boolean
boolean
boolean
INTERNAL: Indicates whether the platform supports temporary tables.boolean
Allows unique columns to be defined as constraint if the UNIQUE keyword is not support on a column defintion.boolean
boolean
By default, platforms do not support VPD.boolean
INTERNAL: Indicates whether the platform supports timeouts on For Updateboolean
boolean
boolean
Some JDBC 2 drivers to not support batching, so this lets are own batching be used.boolean
boolean
boolean
boolean
boolean
boolean
wasFailureCommunicationBased
(SQLException exception, Connection connection, AbstractSession sessionForProfile) void
writeAddColumnClause
(Writer writer, AbstractSession session, TableDefinition table, FieldDefinition field) INTERNAL: May need to override this method if the platform supports ALTER TABLE ADD <column> and the generated sql doesn't work.protected static void
writeAutoAssignmentSetClause
(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields, DatasourcePlatform platform) INTERNAL: helper method, don't override.protected static void
writeAutoJoinWhereClause
(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> pkFields, DatasourcePlatform platform) INTERNAL: helper method, don't override.void
writeCleanUpTempTableSql
(Writer writer, DatabaseTable table) INTERNAL: Don't override this method.void
writeCreateTempTableSql
(Writer writer, DatabaseTable table, AbstractSession session, Collection<DatabaseField> pkFields, Collection<DatabaseField> usedFields, Collection<DatabaseField> allFields) INTERNAL: Don't override this method.void
writeDeleteFromTargetTableUsingTempTableSql
(Writer writer, DatabaseTable table, DatabaseTable targetTable, Collection<DatabaseField> pkFields, Collection<DatabaseField> targetPkFields, DatasourcePlatform platform) INTERNAL: Write an sql string for deletion from target table using temporary table.protected static void
writeFields
(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields1, Collection<DatabaseField> fields2, String separator, DatasourcePlatform platform) INTERNAL: helper method, don't override.protected static void
writeFieldsAutoClause
(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields, String separator, DatasourcePlatform platform) INTERNAL: helper method, don't override.protected static void
writeFieldsList
(Writer writer, Collection<DatabaseField> fields, DatasourcePlatform platform) INTERNAL: helper method, don't override.void
writeInsertIntoTableSql
(Writer writer, DatabaseTable table, Collection<DatabaseField> usedFields) INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work.protected static void
writeJoinWhereClause
(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> pkFields1, Collection<DatabaseField> pkFields2, DatasourcePlatform platform) INTERNAL: helper method, don't override.void
writeLOB
(DatabaseField field, Object value, ResultSet resultSet, AbstractSession session) INTERNAL: Write LOB value - only on Oracle8 and upvoid
writeParameterMarker
(Writer writer, ParameterExpression expression, AbstractRecord record, DatabaseCall call) void
writeTableCreationSuffix
(Writer writer, String tableCreationSuffix) INTERNAL: Write used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).void
writeUpdateOriginalFromTempTableSql
(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.DatasourcePlatform
addOperator, addSequence, addSequence, buildNativeCall, buildSelectQueryForIdentity, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, buildSelectQueryForSequenceObject, clone, convertObject, createConnectionCustomizer, createExpressionFor, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultNativeSequenceToTable, getDefaultSeqenceAtNextValue, getDefaultSequence, getDefaultSequenceToWrite, getDriverVersion, getEndDelimiter, getINClauseLimit, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getTimestampQuery, getUpdateSequenceQuery, getUUIDQuery, hasDefaultSequence, initializeDefaultQueries, initializePlatformOperators, initIdentitySequences, isAccess, isAttunity, isCloudscape, isDB2, isDB2Z, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMariaDB, isMaxDB, isMySQL, isODBC, isOracle, isOracle12, isOracle23, isOracle9, isPervasive, isPointBase, isPostgreSQL, 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, supportsIdentity, supportsNativeSequenceNumbers, supportsReturnGeneratedKeys, supportsSequenceObjects, 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
-
Field Details
-
fieldTypes
Holds a map of values used to map JAVA types to database types for table creation -
usesNativeSQL
protected boolean usesNativeSQLIndicates that native SQL should be used for literal values instead of ODBC escape format Only used with Oracle, Sybase & DB2 -
usesByteArrayBinding
protected boolean usesByteArrayBindingIndicates that binding will be used for BLOB data. NOTE: does not work well with ODBC. -
usesBatchWriting
protected boolean usesBatchWritingBatch all write statements -
shouldBindAllParameters
Bind all arguments to any SQL statement. -
shouldForceBindAllParameters
protected boolean shouldForceBindAllParametersBind all arguments to any SQL statement. -
shouldBindPartialParameters
protected boolean shouldBindPartialParametersBind some arguments to any SQL statement. -
shouldCacheAllStatements
protected boolean shouldCacheAllStatementsCache all prepared statements, this requires full parameter binding as well. -
statementCacheSize
protected int statementCacheSizeThe statement cache size for prepare parameterized statements. -
shouldForceFieldNamesToUpperCase
protected boolean shouldForceFieldNamesToUpperCaseCan be used if the app expects upper case but the database is not return consistent case, i.e. different databases. -
shouldTrimStrings
protected boolean shouldTrimStringsIndicates (if true) to remove blanks characters from the right of CHAR strings. -
usesStreamsForBinding
protected boolean usesStreamsForBindingIndicates that streams will be used to store BLOB data. NOTE: does not work with ODBC -
stringBindingSize
protected int stringBindingSizeIndicates the size above which strings will be bound NOTE: does not work with ODBC -
usesStringBinding
protected boolean usesStringBindingIndicates that strings will above the stringBindingSize will be bound NOTE: does not work with ODBC -
maxBatchWritingSize
protected int maxBatchWritingSizeAllow for the batch size to be set as many database have strict limits. -
castSizeForVarcharParameter
protected int castSizeForVarcharParameterused for casting of input parameters in certain DBs -
usesJDBCBatchWriting
protected boolean usesJDBCBatchWritingAllow for our batch writing support to be used in JDK 1.2. -
usesNativeBatchWriting
protected boolean usesNativeBatchWritingbug 4241441: Allow custom batch writing to enable batching with optimistic locking. -
batchWritingMechanism
Allow for a custom batch writing mechanism. -
printOuterJoinInWhereClause
Allow configuration option to use Where clause outer joining or From clause joining. -
printInnerJoinInWhereClause
Allow configuration option to use Where clause joining or From clause joining. -
cursorCode
protected int cursorCodeAllow for the code that is used for preparing cursored outs for a storedprocedure to be settable. -
transactionIsolation
protected int transactionIsolationThe transaction isolation level to be set on the connection (optional). -
supportsAutoCommit
protected boolean supportsAutoCommitSome JDBC drivers do not support AutoCommit in the way EclipseLink expects. (e.g. Attunity Connect, JConnect) -
shouldOptimizeDataConversion
protected boolean shouldOptimizeDataConversionAllow for driver level data conversion optimization to be disabled, required because some drivers can loose precision. -
classTypes
Stores mapping of class types to database types for schema creation. -
shouldIgnoreCaseOnFieldComparisons
public static boolean shouldIgnoreCaseOnFieldComparisonsAllow for case in field names to be ignored as some databases are not case sensitive and when using custom this can be an issue. -
DEFAULT_MAX_BATCH_WRITING_SIZE
public static final int DEFAULT_MAX_BATCH_WRITING_SIZEBug#3214927 The default is 32000 for DynamicSQLBatchWritingMechanism. It would become 100 when switched to ParameterizedSQLBatchWritingMechanism.- See Also:
-
DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE
public static final int DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE- See Also:
-
IS_VALID_TIMEOUT
public static final int IS_VALID_TIMEOUTTimeout used is isValid() check for dead connections.- See Also:
-
pingSQL
This attribute will store the SQL query that will be used to 'ping' the database connection in order to check the health of a connection. -
structConverters
The following two maps, provide two ways of looking up StructConverters. They can be looked up by java Class or by Struct type -
typeConverters
-
useRownumFiltering
protected boolean useRownumFilteringSome platforms allow a query's maxRows and FirstResult settings to be specified in SQL. This setting allows it to be enabled/disabled -
isCastRequired
protected boolean isCastRequiredAllow platform specific cast to be enabled. -
shouldBindLiterals
protected boolean shouldBindLiteralsAllow user to require literals to be bound. -
tableCreationSuffix
String used on all table creation statements generated from the DefaultTableGenerator with a session using this project. This value will be appended to CreationSuffix strings stored within the DatabaseTable creationSuffix. -
storedProcedureTerminationToken
The delimiter between stored procedures in multiple stored procedure calls. -
partitioningCallback
Used to integrate with data partitioning in an external DataSource such as UCP. -
shouldCreateIndicesOnForeignKeys
protected boolean shouldCreateIndicesOnForeignKeysAllows auto-indexing for foreign keys to be set. -
useJDBCStoredProcedureSyntax
-
driverName
-
driverSupportsNationalCharacterVarying
protected boolean driverSupportsNationalCharacterVaryingTrue if the current jdbc driver supports get/setNString methods -
useNationalCharacterVarying
protected boolean useNationalCharacterVaryingIf true, the platform should map String columns to a type that supports national characters.
-
-
Constructor Details
-
DatabasePlatform
public DatabasePlatform()Creates an instance of default database platform.
-
-
Method Details
-
initialize
public void initialize()Initialize operators to avoid concurrency issues.- Specified by:
initialize
in interfacePlatform
- Overrides:
initialize
in classDatasourcePlatform
-
hasPartitioningCallback
public boolean hasPartitioningCallback()Check if has callback. Used to integrate with data partitioning in an external DataSource such as UCP. -
getPartitioningCallback
Return callback. Used to integrate with data partitioning in an external DataSource such as UCP. -
setPartitioningCallback
Set callback. Used to integrate with data partitioning in an external DataSource such as UCP. -
isCastRequired
public boolean isCastRequired()Return if casting is enabled for platforms that support it. Allow platform specific cast to be disabled. -
setIsCastRequired
public void setIsCastRequired(boolean isCastRequired) Set if casting is enabled for platforms that support it. Allow platform specific cast to be disabled. -
getStructConverters
INTERNAL: Get the map of StructConverters that will be used to preprocess STRUCT data as it is read -
getTableCreationSuffix
PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation). This value will be appended to CreationSuffix strings stored on the DatabaseTable or TableDefinition. -
getTypeConverters
INTERNAL: Get the map of TypeConverters This map indexes StructConverters by the Java Class they are meant to convert -
addStructConverter
PUBLIC: Add a StructConverter to this DatabasePlatform This StructConverter will be invoked for all writes to the database for the class returned by its getJavaType() method and for all reads from the database for the Structs described by its getStructName() method -
addBatch
INTERNAL: This gets called on each iteration to add parameters to the batch Needs to be implemented so that it returns the number of rows successfully modified by this statement for optimistic locking purposes (if useNativeBatchWriting is enabled, and the call uses optimistic locking). Is used with parameterized SQL- Returns:
- - number of rows modified/deleted by this statement if it was executed (0 if it wasn't)
- Throws:
SQLException
-
allowsSizeInProcedureArguments
public boolean allowsSizeInProcedureArguments()Used for stored procedure definitions. -
autoCommit
Used by JDBC drivers that do not support autocommit so simulate an autocommit.- Throws:
SQLException
-
beginTransaction
Used for jdbc drivers which do not support autocommit to explicitly begin a transaction This method is a no-op for databases which implement autocommit as expected.- Throws:
SQLException
-
buildBatchCriteria
INTERNAL: Return the selection criteria used to IN batch fetching. -
buildBatchCriteriaForComplexId
public Expression buildBatchCriteriaForComplexId(ExpressionBuilder builder, List<Expression> fields) INTERNAL: Return the selection criteria used to IN batch fetching. -
buildCallWithReturning
INTERNAL Returns null unless the platform supports call with returning -
buildClassTypes
Return the mapping of class types to database types for the schema framework. -
buildFieldTypes
Return the mapping of class types to database types for the schema framework. -
shouldUseGetSetNString
public boolean shouldUseGetSetNString()Returns true iff:- tThe current driver supports calling get/setNString
- Strings are globally mapped to a national character varying type (useNationalCharacterVarying()).
-
getDriverSupportsNVarChar
public boolean getDriverSupportsNVarChar() -
setDriverSupportsNVarChar
public void setDriverSupportsNVarChar(boolean b) -
getUseNationalCharacterVaryingTypeForString
public boolean getUseNationalCharacterVaryingTypeForString() -
setUseNationalCharacterVaryingTypeForString
public void setUseNationalCharacterVaryingTypeForString(boolean b) -
buildProcedureCallString
public String buildProcedureCallString(StoredProcedureCall call, AbstractSession session, AbstractRecord row) Return the proc syntax for this platform. -
canBuildCallWithReturning
public boolean canBuildCallWithReturning()INTERNAL Indicates whether the platform can build call with returning. In case this method returns true, buildCallWithReturning method may be called. -
canBatchWriteWithOptimisticLocking
INTERNAL: Supports Batch Writing with Optimistic Locking. -
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 By default, we assume case 1 and simply return the value of maxResults. Subclasses may provide an override- See Also:
-
commitTransaction
Used for jdbc drivers which do not support autocommit to explicitly commit a transaction This method is a no-op for databases which implement autocommit as expected.- Throws:
SQLException
-
getVPDClearIdentifierQuery
Any platform that supports VPD should implement this method. -
getVPDCreationFunctionString
Any platform that supports VPD should implement this method. Used for DDL generation. -
getVPDCreationPolicyString
Any platform that supports VPD should implement this method. Used for DDL generation. -
getVPDDeletionString
Any platform that supports VPD should implement this method. Used for DDL generation. -
getVPDSetIdentifierQuery
Any platform that supports VPD should implement this method. -
convertToDatabaseType
INTERNAL We support more primitive than JDBC does so we must do conversion before printing or binding. -
copyInto
Copy the state into the new platform.- Specified by:
copyInto
in interfacePlatform
- Overrides:
copyInto
in classDatasourcePlatform
-
getBatchBeginString
Used for batch writing and sp defs. -
isRowCountOutputParameterRequired
public boolean isRowCountOutputParameterRequired()Return if the platform does not maintain the row count on batch executes and requires an output parameter to maintain the row count. -
getBatchRowCountDeclareString
Used for batch writing for row count return. -
getBatchRowCountAssignString
Used for batch writing for row count return. -
getBatchRowCountReturnString
Used for batch writing for row count return. -
getBatchDelimiterString
Used for batch writing and sp defs. -
getBatchEndString
Used for batch writing and sp defs. -
getConnection
INTERNAL: This method is used to unwrap the oracle connection wrapped by the application server. EclipseLink needs this unwrapped connection for certain Oracle Specific support. (ie TIMESTAMPTZ) This is added as a workaround for bug 4565190 -
getConstraintDeletionString
Used for constraint deletion. -
getUniqueConstraintDeletionString
Used for constraint deletion. -
getCreateViewString
/** Used for view creation. -
getDropCascadeString
Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option. -
getCustomModifyValueForCall
public Object getCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind) This method determines if any special processing needs to occur prior to writing a field. It does things such as determining if a field must be bound and flagging the parameter as one that must be bound.- Specified by:
getCustomModifyValueForCall
in interfacePlatform
- Overrides:
getCustomModifyValueForCall
in classDatasourcePlatform
-
getProcedureEndString
Used for stored procedure defs. -
getProcedureBeginString
Used for stored procedure defs. -
getProcedureAsString
Used for stored procedure defs. -
getProcedureOptionList
Some platforms have an option list Only to be used for stored procedure creation.- See Also:
-
getClassTypes
Return the class type to database type mapping for the schema framework. -
getAssignmentString
Used for stored function calls. -
getCastSizeForVarcharParameter
public int getCastSizeForVarcharParameter()ADVANCED: Get the maximum length allowed by the database for a Varchar Parameter This is used by subclasses when writing SQL for parameters- See Also:
-
getCreationInOutputProcedureToken
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created. -
getCreationOutputProcedureToken
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created. -
getCursorCode
public int getCursorCode()ADVANCED: Return the code for preparing cursored output parameters in a stored procedure -
getDefaultSequenceTableName
Returns the table name used by TableSequence by default. -
getCreateDatabaseSchemaString
Return the create schema SQL syntax. Subclasses should override as needed. -
getDropDatabaseSchemaString
Return the drop schema SQL syntax. Subclasses should override as needed. -
getFieldTypeDefinition
Return the field type object describing this databases platform specific representation of the Java primitive class name. -
getFieldTypes
Return the class type to database type mappings for the schema framework. -
getFunctionCallHeader
Used for stored function calls. -
getInOutputProcedureToken
This method is used to print the output parameter token when stored procedures are called -
getJDBCOuterJoinString
Returns the JDBC outer join operator for SELECT statements. -
getJDBCTypeForSetNull
Return the JDBC type for the given database field to be passed to Statement.setNull -
getJDBCType
Return the JDBC type for the given database field. -
getJDBCType
Return the JDBC type for the Java type. -
getJdbcTypeName
INTERNAL: Returns the type name corresponding to the jdbc type -
minimumTimeIncrement
public long minimumTimeIncrement()INTERNAL: Returns the minimum time increment supported by the platform. -
getMaxBatchWritingSize
public int getMaxBatchWritingSize()PUBLIC: Allow for the max batch writing size to be set. This allows for the batch size to be limited as most database have strict limits. The size is in characters, the default is 32000 but the real value depends on the database configuration. -
getMaxFieldNameSize
public int getMaxFieldNameSize()INTERNAL: returns the maximum number of characters that can be used in a field name on this platform. -
getMaxForeignKeyNameSize
public int getMaxForeignKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform. -
getMaxIndexNameSize
public int getMaxIndexNameSize()INTERNAL: returns the maximum number of characters that can be used in an index name on this platform. -
getMaxUniqueKeyNameSize
public int getMaxUniqueKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform. -
getObjectFromResultSet
public Object getObjectFromResultSet(ResultSet resultSet, int columnNumber, int type, AbstractSession session) throws SQLException INTERNAL: Get the object from the JDBC Result set. Added to allow other platforms to override.- Throws:
SQLException
- See Also:
-
getInputProcedureToken
Used for stored procedure creation: Prefix for INPUT parameters. Not required on most platforms. -
getIndexNamePrefix
Used to allow platforms to define their own index prefixes -
getOutputProcedureToken
This method is used to print the output parameter token when stored procedures are called -
getPingSQL
Used for determining if an SQL exception was communication based. This SQL should be as efficient as possible and ensure a round trip to the database. -
getProcedureArgumentString
Used for sp defs. -
getProcedureArgument
public String getProcedureArgument(String name, Object parameter, DatasourceCall.ParameterType parameterType, StoredProcedureCall call, AbstractSession session) Obtain the platform specific argument string -
getProcedureCallHeader
Used for sp calls. -
getProcedureCallTail
Used for sp calls. -
getQualifiedSequenceTableName
-
getQualifiedName
-
getNoWaitString
This syntax does no wait on the lock. (i.e. In Oracle adding NOWAIT to the end will accomplish this) -
getSelectForUpdateNoWaitString
This syntax does no wait on the lock. (i.e. In Oracle adding FOR UPDATE NOWAIT to the end will accomplish this) -
getSelectForUpdateOfString
For fine-grained pessimistic locking the column names can be specified individually. -
getSelectForUpdateString
Most database support a syntax. although don't actually lock the row. Some require the OF some don't like it. -
getSelectForUpdateWaitString
Platforms that support the WAIT option should override this method. By default the wait timeout is ignored.- See Also:
-
getSequenceCounterFieldName
-
getSequenceNameFieldName
-
getSequencePreallocationSize
public int getSequencePreallocationSize()- Overrides:
getSequencePreallocationSize
in classDatasourcePlatform
-
getSequenceTableName
-
getStatementCacheSize
public int getStatementCacheSize()The statement cache size for prepare parameterized statements. -
getStoredProcedureParameterPrefix
-
getStoredProcedureTerminationToken
Returns the delimiter between stored procedures in multiple stored procedure calls. -
setStoredProcedureTerminationToken
-
getStringBindingSize
public int getStringBindingSize() -
getTransactionIsolation
public int getTransactionIsolation()Returns the transaction isolation setting for a connection. Return -1 if it has not been set. -
isInformixOuterJoin
public boolean isInformixOuterJoin()Some database require outer joins to be given in the where clause, others require it in the from clause. Informix requires it in the from clause with no ON expression. -
isJDBCExecuteCompliant
public boolean isJDBCExecuteCompliant()Returns true if this platform complies with the expected behavior from a jdbc execute call. Most platforms do, some have issues:- See Also:
-
isLockTimeoutException
Return true is the given exception occurred as a result of a lock time out exception (WAIT clause). If sub-platform supports this clause, this method should be necessary checks should be made. By default though, this method return false.- See Also:
-
isForUpdateCompatibleWithDistinct
public boolean isForUpdateCompatibleWithDistinct()INTERNAL: Indicates whether SELECT DISTINCT ... FOR UPDATE is allowed by the platform (Oracle doesn't allow this). -
isLobCompatibleWithDistinct
public boolean isLobCompatibleWithDistinct()INTERNAL: Indicates whether SELECT DISTINCT lob FROM ... (where lob is BLOB or CLOB) is allowed by the platform (Oracle doesn't allow this). -
maximumNumericValues
Builds a table of maximum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.NOTE: BigInteger & BigDecimal maximums are dependent upon their precision & Scale
-
minimumNumericValues
Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale
-
prepareBatchStatement
public Statement prepareBatchStatement(Statement statement, int maxBatchWritingSize) throws SQLException Internal: Allows setting the batch size on the statement Is used with parameterized SQL, and should only be passed in prepared statements- Returns:
- statement to be used for batch writing
- Throws:
SQLException
-
printFieldIdentityClause
Append the receiver's field 'identity' constraint clause to a writer.- Throws:
ValidationException
-
printFieldNotNullClause
Append the receiver's field 'NOT NULL' constraint clause to a writer.- Throws:
ValidationException
-
printFieldNullClause
Append the receiver's field 'NULL' constraint clause to a writer.- Throws:
ValidationException
-
printValuelist
Print the int array on the writer. Added to handle int[] passed as parameters to named queries Returns the number of objects using binding.- Throws:
IOException
-
printValuelist
public int printValuelist(Collection<?> theObjects, DatabaseCall call, Writer writer) throws IOException - Throws:
IOException
-
registerOutputParameter
public void registerOutputParameter(CallableStatement statement, int parameterIndex, int sqlType) throws SQLException This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
SQLException
- See Also:
-
registerOutputParameter
public void registerOutputParameter(CallableStatement statement, int parameterIndex, int sqlType, String typeName) throws SQLException This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
SQLException
- See Also:
-
registerOutputParameter
public void registerOutputParameter(CallableStatement statement, String parameterName, int sqlType) throws SQLException This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
SQLException
- See Also:
-
registerOutputParameter
public void registerOutputParameter(CallableStatement statement, String parameterName, int sqlType, String typeName) throws SQLException This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
SQLException
- See Also:
-
requiresNamedPrimaryKeyConstraints
public boolean requiresNamedPrimaryKeyConstraints()This is used as some databases create the primary key constraint differently, i.e. Access. -
requiresProcedureBrackets
public boolean requiresProcedureBrackets()Used for stored procedure creation: Some platforms need brackets around arguments declaration even if no arguments exist. Those platform will override this and return true. All other platforms will omit the brackets in this case. -
requiresProcedureCallBrackets
public boolean requiresProcedureCallBrackets()USed for sp calls. -
requiresProcedureCallOuputToken
public boolean requiresProcedureCallOuputToken()Used for sp calls. Sybase must print output after output params. -
requiresTypeNameToRegisterOutputParameter
public boolean requiresTypeNameToRegisterOutputParameter()INTERNAL: Indicates whether the version of CallableStatement.registerOutputParameter method that takes type name should be used. -
requiresUniqueConstraintCreationOnTableCreate
public boolean requiresUniqueConstraintCreationOnTableCreate()Used for table creation. If a database platform does not support ALTER TABLE syntax to add/drop unique constraints (like Symfoware), overriding this method will allow the constraint to be specified in the CREATE TABLE statement.This only affects unique constraints specified using the UniqueConstraint annotation or equivalent method. Columns for which the 'unique' attribute is set to true will be declared 'UNIQUE' in the CREATE TABLE statement regardless of the return value of this method.
- Returns:
- whether unique constraints should be declared as part of the CREATE TABLE statement instead of in separate ALTER TABLE ADD/DROP statements.
-
retrieveFirstPrimaryKeyOrOne
INTERNAL: Used by Exists queries because they just need to select a single row. In most databases, we will select one of the primary key fields. On databases where, for some reason we cannot select one of the key fields this method can be overridden- See Also:
-
rollbackTransaction
Used for jdbc drivers which do not support autocommit to explicitly rollback a transaction This method is a no-op for databases which implement autocommit as expected.- Throws:
SQLException
-
setCastSizeForVarcharParameter
public void setCastSizeForVarcharParameter(int maxLength) ADVANCED: Set the maximum length allowed by the database for a Varchar Parameter This is used by subclasses when writing SQL for parameters- See Also:
-
setClassTypes
-
setCursorCode
public void setCursorCode(int cursorCode) ADVANCED: Set the code for preparing cursored output parameters in a stored procedure -
setDriverName
During auto-detect, the driver name is set on the platform. -
setFieldTypes
-
setMaxBatchWritingSize
public void setMaxBatchWritingSize(int maxBatchWritingSize) PUBLIC: Allow for the max batch writing size to be set. This allows for the batch size to be limited as most database have strict limits. The size is in characters, the default is 32000 but the real value depends on the database configuration. -
setSequenceCounterFieldName
-
setSequenceNameFieldName
-
setSequenceTableName
-
setShouldBindAllParameters
public void setShouldBindAllParameters(boolean shouldBindAllParameters) Bind all arguments to any SQL statement. -
setShouldCacheAllStatements
public void setShouldCacheAllStatements(boolean shouldCacheAllStatements) Cache all prepared statements, this requires full parameter binding as well. -
setShouldForceBindAllParameters
public void setShouldForceBindAllParameters(boolean shouldForceBindAllParameters) Used to enable parameter binding and override the platform default -
setShouldBindPartialParameters
public void setShouldBindPartialParameters(boolean shouldBindPartialParameters) Used to enable parameter binding and override the platform default -
setShouldForceFieldNamesToUpperCase
public void setShouldForceFieldNamesToUpperCase(boolean shouldForceFieldNamesToUpperCase) Can be used if the app expects upper case but the database is not return consistent case, i.e. different databases. -
setShouldIgnoreCaseOnFieldComparisons
public static void setShouldIgnoreCaseOnFieldComparisons(boolean newShouldIgnoreCaseOnFieldComparisons) Allow for case in field names to be ignored as some databases are not case sensitive and when using custom this can be an issue. -
setShouldOptimizeDataConversion
public void setShouldOptimizeDataConversion(boolean value) PUBLIC: Set if our driver level data conversion optimization is enabled. This can be disabled as some drivers perform data conversion themselves incorrectly. -
setShouldTrimStrings
public void setShouldTrimStrings(boolean aBoolean) -
setStatementCacheSize
public void setStatementCacheSize(int statementCacheSize) The statement cache size for prepare parameterized statements. -
setStringBindingSize
public void setStringBindingSize(int aSize) -
setSupportsAutoCommit
public void setSupportsAutoCommit(boolean supportsAutoCommit) supportsAutoCommit can be set to false for JDBC drivers which do not support autocommit. -
setTableCreationSuffix
PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation). This value will be appended to CreationSuffix strings stored on the DatabaseTable or TableDefinition. ie setTableCreationSuffix("engine=InnoDB"); -
setTransactionIsolation
public void setTransactionIsolation(int isolationLevel) Set the transaction isolation setting for a connection. -
setUseJDBCStoredProcedureSyntax
Return true if JDBC syntax should be used for stored procedure calls. -
setUsesBatchWriting
public void setUsesBatchWriting(boolean usesBatchWriting) -
setUsesByteArrayBinding
public void setUsesByteArrayBinding(boolean usesByteArrayBinding) -
setUsesJDBCBatchWriting
public void setUsesJDBCBatchWriting(boolean usesJDBCBatchWriting) Some JDBC 2 drivers to not support batching, so this lets are own batching be used. -
setUsesNativeBatchWriting
public void setUsesNativeBatchWriting(boolean usesNativeBatchWriting) Advanced: This is used to enable native batch writing on drivers that support it. Enabling Native batchwriting will result in the batch writing mechanisms to be used on objects that have optimistic locking, and so execution of statements on these objects will be delayed until the batch statement is executed. Only use this method with platforms that have overridden the prepareBatchStatement, addBatch and executeBatch as required Current support is limited to the Oracle9Platform class.- Parameters:
usesNativeBatchWriting
- - flag to turn on/off native batch writing
-
setUsesNativeSQL
public void setUsesNativeSQL(boolean usesNativeSQL) -
getBatchWritingMechanism
Return the custom batch writing mechanism. -
setBatchWritingMechanism
Set the custom batch writing mechanism. -
setShouldUseRownumFiltering
public void setShouldUseRownumFiltering(boolean useRownumFiltering) PUBLIC: Set if SQL-Level pagination should be used for FirstResult and MaxRows settings. Default is true. Note: This setting is used to disable SQL-level pagination on platforms for which it is implemented. On platforms where we use JDBC for pagination, it will be ignored -
setUsesStreamsForBinding
public void setUsesStreamsForBinding(boolean usesStreamsForBinding) -
setPrintOuterJoinInWhereClause
public void setPrintOuterJoinInWhereClause(boolean printOuterJoinInWhereClause) PUBLIC: Changes the way that OuterJoins are done on the database. With a value of true, outerjoins are performed in the where clause using the outer join token for that database. With the value of false, outerjoins are performed in the from clause. -
setPrintInnerJoinInWhereClause
public void setPrintInnerJoinInWhereClause(boolean printInnerJoinInWhereClause) PUBLIC: Changes the way that inner joins are printed in generated SQL for the database. With a value of true, inner joins are printed in the WHERE clause, if false, inner joins are printed in the FROM clause. -
setUsesStringBinding
public void setUsesStringBinding(boolean aBool) -
shouldBindAllParameters
public boolean shouldBindAllParameters()Bind all arguments to any SQL statement. -
shouldBindPartialParameters
public boolean shouldBindPartialParameters()Used to determine if the platform should perform partial parameter binding or notOff by default. Only platforms with the support added should enable this configuration.
-
shouldCacheAllStatements
public boolean shouldCacheAllStatements()Cache all prepared statements, this requires full parameter binding as well. -
shouldCreateIndicesForPrimaryKeys
public boolean shouldCreateIndicesForPrimaryKeys()Used for table creation. Most databases create an index automatically when a primary key is created. Symfoware does not.- Returns:
- whether an index should be created explicitly for primary keys
-
shouldCreateIndicesOnUniqueKeys
public boolean shouldCreateIndicesOnUniqueKeys()Used for table creation. Most databases create an index automatically for columns with a unique constraint. Symfoware does not.- Returns:
- whether an index should be created explicitly for unique constraints
-
shouldCreateIndicesOnForeignKeys
public boolean shouldCreateIndicesOnForeignKeys()Used for table creation. Most databases do not create an index automatically for foreign key columns. Normally it is recommended to index foreign key columns. This allows for foreign key indexes to be configured, by default foreign keys are not indexed.- Returns:
- whether an index should be created explicitly for foreign key constraints
-
setShouldCreateIndicesOnForeignKeys
public void setShouldCreateIndicesOnForeignKeys(boolean shouldCreateIndicesOnForeignKeys) Used for table creation. Most databases do not create an index automatically for foreign key columns. Normally it is recommended to index foreign key columns. This allows for foreign key indexes to be configured, by default foreign keys are not indexed. -
shouldForceBindAllParameters
public boolean shouldForceBindAllParameters()Used to enable parameter binding and override platform default -
shouldForceFieldNamesToUpperCase
public boolean shouldForceFieldNamesToUpperCase()Can be used if the app expects upper case but the database is not return consistent case, i.e. different databases. -
shouldIgnoreCaseOnFieldComparisons
public static boolean shouldIgnoreCaseOnFieldComparisons()Allow for case in field names to be ignored as some databases are not case sensitive and when using custom this can be an issue. -
shouldIgnoreException
Allow for the platform to ignore exceptions. This is required for DB2 which throws no-data modified as an exception. -
shouldOptimizeDataConversion
public boolean shouldOptimizeDataConversion()Return if our driver level data conversion optimization is enabled. This can be disabled as some drivers perform data conversion themselves incorrectly. -
shouldPrintStoredProcedureVariablesAfterBeginString
public boolean shouldPrintStoredProcedureVariablesAfterBeginString()Used for stored procedure creation: Some platforms declare variables AFTER the procedure body's BEGIN string. These need to override and return true. All others will print the variable declaration BEFORE the body's BEGIN string. -
shouldPrintConstraintNameAfter
public boolean shouldPrintConstraintNameAfter()Some Platforms want the constraint name after the constraint definition. -
shouldPrintInOutputTokenBeforeType
public boolean shouldPrintInOutputTokenBeforeType()This is required in the construction of the stored procedures with output parameters -
shouldPrintOuterJoinInWhereClause
public boolean shouldPrintOuterJoinInWhereClause()Some database require outer joins to be given in the where clause, others require it in the from clause. -
shouldPrintInnerJoinInWhereClause
This allows which clause inner joins are printed into in SQL generation. By default most platforms put inner joins in the WHERE clause. If set to false, inner joins will be printed in the FROM clause. -
shouldPrintInputTokenAtStart
public boolean shouldPrintInputTokenAtStart()Used for stored procedure creation: Some platforms want to print prefix for INPUT arguments BEFORE NAME. If wanted, override and return true. -
shouldPrintOutputTokenBeforeType
public boolean shouldPrintOutputTokenBeforeType()This is required in the construction of the stored procedures with output parameters -
shouldPrintOutputTokenAtStart
public boolean shouldPrintOutputTokenAtStart()This is required in the construction of the stored procedures with output parameters -
shouldPrintStoredProcedureArgumentNameInCall
public boolean shouldPrintStoredProcedureArgumentNameInCall()INTERNAL: Should the variable name of a stored procedure call be printed as part of the procedure call e.g. EXECUTE PROCEDURE MyStoredProc(myvariable = ?) -
shouldPrintForUpdateClause
public boolean shouldPrintForUpdateClause() -
shouldTrimStrings
public boolean shouldTrimStrings() -
shouldUseCustomModifyForCall
Description copied from class:DatasourcePlatform
Used by SQLCall.appendModify(..) If the field should be passed to customModifyInDatabaseCall, retun true, otherwise false. Methods shouldCustomModifyInDatabaseCall and customModifyInDatabaseCall should be kept in sync: shouldCustomModifyInDatabaseCall should return true if and only if the field is handled by customModifyInDatabaseCall.- Specified by:
shouldUseCustomModifyForCall
in interfacePlatform
- Overrides:
shouldUseCustomModifyForCall
in classDatasourcePlatform
-
shouldUseJDBCOuterJoinSyntax
public boolean shouldUseJDBCOuterJoinSyntax()JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it. -
shouldUseRownumFiltering
public boolean shouldUseRownumFiltering()PUBLIC: Return if Oracle ROWNUM pagination should be used for FirstResult and MaxRows settings. Default is true. Note: This setting is used to disable SQL-level pagination on platforms for which it is implemented. On platforms where we use JDBC for pagination, it will be ignored -
supportsANSIInnerJoinSyntax
public boolean supportsANSIInnerJoinSyntax()Indicates whether the ANSI syntax for inner joins (e.g. SELECT FROM t1 JOIN t2 ON t1.pk = t2.fk) is supported by this platform. -
supportsAutoCommit
public boolean supportsAutoCommit()supportsAutoCommit must sometimes be set to false for JDBC drivers which do not support autocommit. Used to determine how to handle transactions properly. -
supportsAutoConversionToNumericForArithmeticOperations
public boolean supportsAutoConversionToNumericForArithmeticOperations()Some db allow VARCHAR db field to be used in arithmetic operations automatically converting them to numeric: UPDATE OL_PHONE SET PHONE_ORDER_VARCHAR = (PHONE_ORDER_VARCHAR + 1) WHERE ... SELECT ... WHERE ... t0.MANAGED_ORDER_VARCHAR BETWEEN 1 AND 4 ... -
supportsForeignKeyConstraints
public boolean supportsForeignKeyConstraints() -
supportsUniqueKeyConstraints
public boolean supportsUniqueKeyConstraints() -
supportsVPD
public boolean supportsVPD()By default, platforms do not support VPD. Those that do need to override this method. -
supportsWaitForUpdate
public boolean supportsWaitForUpdate()INTERNAL: Indicates whether the platform supports timeouts on For Update- See Also:
-
supportsPrimaryKeyConstraint
public boolean supportsPrimaryKeyConstraint() -
supportsStoredFunctions
public boolean supportsStoredFunctions() -
supportsOrderByParameters
public boolean supportsOrderByParameters()Used to determine if the platform supports untyped parameters, as ordinal variables, within the Order By clauseOn by default. Only platforms without support added should disable this configuration.
-
supportsDeleteOnCascade
public boolean supportsDeleteOnCascade() -
executeBatch
Internal: This gets called on each batch statement execution Needs to be implemented so that it returns the number of rows successfully modified by this statement for optimistic locking purposes.- Parameters:
isStatementPrepared
- - flag is set to true if this statement is prepared- Returns:
- - number of rows modified/deleted by this statement
- Throws:
SQLException
-
executeStoredProcedure
public Object executeStoredProcedure(DatabaseCall dbCall, PreparedStatement statement, DatabaseAccessor accessor, AbstractSession session) throws SQLException because each platform has different requirements for accessing stored procedures and the way that we can combine resultsets and output params, the stored procedure call is being executed on the platform.- Throws:
SQLException
-
setPingSQL
Used for determining if an SQL exception was communication based. This SQL should be as efficient as possible and ensure a round trip to the database. -
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. This support a wide range of different parameter types, and is heavily optimized for common types.- Throws:
SQLException
-
setParameterValueInDatabaseCall
public void setParameterValueInDatabaseCall(Object parameter, CallableStatement statement, String name, AbstractSession session) throws SQLException INTERNAL Set the parameter in the JDBC statement with the given name. This support a wide range of different parameter types, and is heavily optimized for common types.- Throws:
SQLException
-
setNullFromDatabaseField
protected void setNullFromDatabaseField(DatabaseField databaseField, PreparedStatement statement, int index) throws SQLException - Throws:
SQLException
-
setNullFromDatabaseField
protected void setNullFromDatabaseField(DatabaseField databaseField, CallableStatement statement, String name) throws SQLException - Throws:
SQLException
-
getParameterValueFromDatabaseCall
public Object getParameterValueFromDatabaseCall(CallableStatement statement, int index, AbstractSession session) throws SQLException INTERNAL Get the parameter from the JDBC statement with the given index.- Parameters:
index
- - 1-based index in the argument list- Throws:
SQLException
-
getParameterValueFromDatabaseCall
public Object getParameterValueFromDatabaseCall(CallableStatement statement, String name, AbstractSession session) throws SQLException INTERNAL Get the parameter from the JDBC statement with the given name.- Throws:
SQLException
-
appendParameterInternal
Returns the number of parameters that used binding. Should only be called in case binding is not used. -
appendBoolean
Appends a Boolean value as a number- Throws:
IOException
-
appendByteArray
Append the ByteArray in ODBC literal format ({b hexString}). This limits the amount of Binary data by the length of the SQL. Binding should increase this limit.- Throws:
IOException
-
appendDate
Answer a platform correct string representation of a Date, suitable for SQL generation. The date is printed in the ODBC platform independent format {d 'yyyy-mm-dd'}.- Throws:
IOException
-
appendNumber
Write number to SQL string. This is provided so that database which do not support Exponential format can customize their printing.- Throws:
IOException
-
appendLiteralToCall
INTERNAL: In case shouldBindLiterals is true, instead of null value a DatabaseField value may be passed (so that it's type could be used for binding null).- Parameters:
canBind
- - allows higher up the stack (where more context exists) to tell if this literal can be bound
-
appendLiteralToCallWithBinding
INTERNAL: Override this method in case the platform needs to do something special for binding literals. Note that instead of null value a DatabaseField value may be passed (so that it's type could be used for binding null). -
appendParameter
Write a database-friendly representation of the given parameter to the writer. Determine the class of the object to be written, and invoke the appropriate print method for that object. The default is "toString". The platform may decide to bind some types, such as byte arrays and large strings. Should only be called in case binding is not used.- Specified by:
appendParameter
in interfacePlatform
- Overrides:
appendParameter
in classDatasourcePlatform
-
appendString
Write the string. Quotes must be double quoted.- Throws:
IOException
-
appendTime
Answer a platform correct string representation of a Time, suitable for SQL generation. The time is printed in the ODBC platform independent format {t'hh:mm:ss'}.- Throws:
IOException
-
appendTimestamp
Answer a platform correct string representation of a Timestamp, suitable for SQL generation. The timestamp is printed in the ODBC platform independent timestamp format {ts'YYYY-MM-DD HH:MM:SS.NNNNNNNNN'}.- Throws:
IOException
-
appendCalendar
Answer a platform correct string representation of a Calendar as a Timestamp, suitable for SQL generation. The calendar is printed in the ODBC platform independent timestamp format {ts'YYYY-MM-DD HH:MM:SS.NNNNNNNNN'}.- Throws:
IOException
-
usesBatchWriting
public boolean usesBatchWriting() -
usesByteArrayBinding
public boolean usesByteArrayBinding() -
usesSequenceTable
public boolean usesSequenceTable() -
usesJDBCBatchWriting
public boolean usesJDBCBatchWriting()Some JDBC 2 drivers to not support batching, so this lets are own batching be used. -
usesNativeBatchWriting
public boolean usesNativeBatchWriting() -
usesNativeSQL
public boolean usesNativeSQL() -
usesStreamsForBinding
public boolean usesStreamsForBinding() -
usesStringBinding
public boolean usesStringBinding() -
writeLOB
public void writeLOB(DatabaseField field, Object value, ResultSet resultSet, AbstractSession session) throws SQLException INTERNAL: Write LOB value - only on Oracle8 and up- Throws:
SQLException
-
supportsCountDistinctWithMultipleFields
public boolean supportsCountDistinctWithMultipleFields()INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields. -
supportsIndexes
public boolean supportsIndexes()INTERNAL: Return if this database support index creation. -
requiresTableInIndexDropDDL
public boolean requiresTableInIndexDropDDL()INTERNAL: Return if this database requires the table name when dropping an index. -
createPlatformDefaultSequence
INTERNAL: Create platform-default Sequence- Overrides:
createPlatformDefaultSequence
in classDatasourcePlatform
-
supportsTempTables
public boolean supportsTempTables()INTERNAL: Indicates whether the platform supports temporary tables. Temporary tables may be used by UpdateAllQueries: though attempt is always made to perform UpdateAll without using temporary storage there are some scenarios that can't be fulfilled without it. Don't override this method. If the platform support temporary tables then override either supportsLocalTempTables() or supportsGlobalTempTables() method. -
supportsLocalTempTables
public boolean supportsLocalTempTables()INTERNAL: Indicates whether the platform supports local temporary tables. "Local" means that several threads may create temporary tables with the same name. Local temporary table is created in the beginning of UpdateAllQuery execution and dropped in the end of it. Override this method if the platform supports local temporary tables. -
supportsGlobalTempTables
public boolean supportsGlobalTempTables()INTERNAL: Indicates whether the platform supports global temporary tables. "Global" means that an attempt to create temporary table with the same name for the second time results in exception. EclipseLink attempts to create global temporary table in the beginning of UpdateAllQuery, execution and assumes that it already exists in case SQLException results. In the end of UpdateAllQuery execution all rows are removed from the temporary table - it is necessary in case the same temporary table will be used by another UpdateAllQuery in the same transaction. Override this method if the platform supports global temporary tables. Note that this method is ignored in case supportsLocalTempTables() returns true. -
getCreateTempTableSqlPrefix
INTERNAL: Override this method if the platform supports temporary tables. This should contain the beginning of sql string for creating temporary table - the sql statement name, for instance: "CREATE GLOBAL TEMPORARY TABLE ". Don't forget to end it with a space. -
getTempTableForTable
INTERNAL: May override this method if the platform support temporary tables.- Parameters:
table
- is original table for which temp table is created.- Returns:
- temporary table
-
getCreateTempTableSqlSuffix
INTERNAL: May override this method if the platform support temporary tables. This should contain the ending of sql string for creating temporary table, for instance: " ON COMMIT DELETE ROWS" Don't forget to begin it with a space. -
getCreateTempTableSqlBodyForTable
INTERNAL: May override this method if the platform supports temporary tables. With this method not overridden the sql string for temporary table creation will include a list of database fields extracted from descriptor: getCreateTempTableSqlPrefix() + getTempTableForTable(table).getQualifiedName() + (list of database fields) + getCreateTempTableSqlSuffix(). If this method is overridden its output will be used instead of fields' list: getCreateTempTableSqlPrefix() + getTempTableForTable(table).getQualifiedName() + getCreateTempTableSqlBodyForTable(table) + getCreateTempTableSqlSuffix(). Don't forget to begin it with a space. Example: " LIKE " + table.getQualifiedName();- Parameters:
table
- is original table for which temp table is created.- Returns:
- String
-
shouldTempTableSpecifyPrimaryKeys
protected boolean shouldTempTableSpecifyPrimaryKeys()INTERNAL: Indicates whether temporary table can specify primary keys (some platforms don't allow that). Used by writeCreateTempTableSql method. -
writeCreateTempTableSql
public void writeCreateTempTableSql(Writer writer, DatabaseTable table, AbstractSession session, Collection<DatabaseField> pkFields, Collection<DatabaseField> usedFields, Collection<DatabaseField> allFields) throws IOException INTERNAL: Don't override this method. Write an sql string for creation of the temporary table. Note that in case of local temp table support it's possible to limit the fields in the temp table to those needed for the operation it supports (usedFields) - the temp table will be dropped in the end of query execution. Alternatively, in global temp table case the table with a given name is created just once and will be potentially used by various operations with various sets of used fields, therefore global temp table should contain all mapped fields (allFields). Precondition: supportsTempTables() == true. Precondition: pkFields contained in usedFields contained in allFields- Parameters:
writer
- for writing the sqltable
- is original table for which temp table is created.pkFields
- primary key fields for the original table.usedFields
- fields that will be used by operation for which temp table is created.allFields
- all mapped fields for the original table.- Throws:
IOException
-
writeInsertIntoTableSql
public void writeInsertIntoTableSql(Writer writer, DatabaseTable table, Collection<DatabaseField> usedFields) 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 insertion into the temporary table. Precondition: supportsTempTables() == true.- Parameters:
writer
- for writing the sqltable
- is original table for which temp table is created.usedFields
- fields that will be used by operation for which temp table is created.- Throws:
IOException
-
isNullAllowedInSelectClause
public boolean isNullAllowedInSelectClause()INTERNAL: Override this if the platform cannot handle NULL in select clause. -
isOutputAllowWithResultSet
public boolean isOutputAllowWithResultSet()INTERNAL: Return true if output parameters can be built with result sets. -
writeTableCreationSuffix
INTERNAL: Write used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation). This writes the passed in string argument as well as the value returned from the DatabasePlatform's getTableCreationSuffix()- Throws:
IOException
-
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.- 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
-
writeDeleteFromTargetTableUsingTempTableSql
public void writeDeleteFromTargetTableUsingTempTableSql(Writer writer, DatabaseTable table, DatabaseTable targetTable, Collection<DatabaseField> pkFields, Collection<DatabaseField> targetPkFields, DatasourcePlatform platform) throws IOException INTERNAL: Write an sql string for deletion from target table using temporary table. At this point temporary table should contains pks for the rows that should be deleted from target table. Temporary tables are not required for DeleteAllQuery, however will be used if shouldAlwaysUseTempStorageForModifyAll()==true May need to override this method in case it generates sql that doesn't work on the platform. Precondition: supportsTempTables() == true.- Parameters:
writer
- for writing the sqltable
- is original table for which temp table is created.targetTable
- is a table from which to delete.pkFields
- primary key fields for the original table.targetPkFields
- primary key fields for the target table.- Throws:
IOException
-
wasFailureCommunicationBased
public boolean wasFailureCommunicationBased(SQLException exception, Connection connection, AbstractSession sessionForProfile) -
writeCleanUpTempTableSql
INTERNAL: Don't override this method. Write an sql string for clean up of the temporary table. Drop a local temp table or delete all from a global temp table (so that it's ready to be used again in the same transaction). Precondition: supportsTempTables() == true.- Parameters:
writer
- for writing the sqltable
- is original table for which temp table is created.- Throws:
IOException
-
shouldAlwaysUseTempStorageForModifyAll
public boolean shouldAlwaysUseTempStorageForModifyAll()INTERNAL: That method affects UpdateAllQuery and DeleteAllQuery execution. In case it returns false modify all queries would attempt to proceed without using temporary storage if it is possible. In case it returns true modify all queries would use temporary storage unless each modify statement doesn't reference any other tables. May need to override this method if the platform can't handle the sql generated for modify all queries without using temporary storage. -
dontBindUpdateAllQueryUsingTempTables
public boolean dontBindUpdateAllQueryUsingTempTables()INTERNAL: May need to override this method if the sql generated for UpdateAllQuery using temp tables fails in case parameter binding is used. -
writeFieldsList
protected static void writeFieldsList(Writer writer, Collection<DatabaseField> fields, DatasourcePlatform platform) throws IOException INTERNAL: helper method, don't override.- Throws:
IOException
-
writeAutoAssignmentSetClause
protected static void writeAutoAssignmentSetClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields, DatasourcePlatform platform) throws IOException INTERNAL: helper method, don't override.- Throws:
IOException
-
writeAutoJoinWhereClause
protected static void writeAutoJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> pkFields, DatasourcePlatform platform) throws IOException INTERNAL: helper method, don't override.- Throws:
IOException
-
writeFieldsAutoClause
protected static void writeFieldsAutoClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields, String separator, DatasourcePlatform platform) throws IOException INTERNAL: helper method, don't override.- Throws:
IOException
-
writeJoinWhereClause
protected static void writeJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> pkFields1, Collection<DatabaseField> pkFields2, DatasourcePlatform platform) throws IOException INTERNAL: helper method, don't override.- Throws:
IOException
-
writeFields
protected static void writeFields(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields1, Collection<DatabaseField> fields2, String separator, DatasourcePlatform platform) throws IOException INTERNAL: helper method, don't override.- Throws:
IOException
-
shouldPrintFieldIdentityClause
-
printFieldTypeSize
public void printFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause) throws IOException - Throws:
IOException
-
printFieldTypeSize
protected void printFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType) throws IOException - Throws:
IOException
-
supportsUniqueColumns
public boolean supportsUniqueColumns()Allows unique columns to be defined as constraint if the UNIQUE keyword is not support on a column defintion. -
printFieldUnique
public void printFieldUnique(Writer writer, boolean shouldPrintFieldIdentityClause) throws IOException - Throws:
IOException
-
printFieldUnique
- Throws:
IOException
-
writeParameterMarker
public void writeParameterMarker(Writer writer, ParameterExpression expression, AbstractRecord record, DatabaseCall call) throws IOException - Throws:
IOException
-
createArray
public Array createArray(String elementDataTypeName, Object[] elements, AbstractSession session, Connection connection) throws SQLException INTERNAL: This method builds an Array using the unwrapped connection within the session- Returns:
- Array
- Throws:
SQLException
-
createStruct
public Struct createStruct(String structTypeName, Object[] attributes, AbstractSession session, Connection connection) throws SQLException INTERNAL: This method builds a Struct using the unwrapped connection within the session- Returns:
- Struct
- Throws:
SQLException
-
createStruct
public Struct createStruct(String structTypeName, Object[] attributes, AbstractRecord row, Vector<DatabaseField> orderedFields, AbstractSession session, Connection connection) throws SQLException INTERNAL: This method builds a Struct using the unwrapped connection within the session- Returns:
- Struct
- Throws:
SQLException
-
createArray
public Array createArray(String elementDataTypeName, Object[] elements, Connection connection) throws SQLException INTERNAL: Platforms that support java.sql.Array may override this method.- Returns:
- Array
- Throws:
SQLException
-
createStruct
public Struct createStruct(String structTypeName, Object[] attributes, Connection connection) throws SQLException INTERNAL: Platforms that support java.sql.Struct may override this method.- Returns:
- Struct
- Throws:
SQLException
-
isXDBDocument
INTERNAL: Indicates whether the passed object is an instance of XDBDocument. To avoid dependency on oracle.xdb the method returns false. Overridden in Oracle9Platform- Returns:
- String
-
shouldBindLiterals
public boolean shouldBindLiterals()PUBLIC: Allows platform to choose whether to bind literals in DatabaseCalls or not. -
setShouldBindLiterals
public void setShouldBindLiterals(boolean shouldBindLiterals) PUBLIC: Allows user to choose whether to bind literals in DatabaseCalls or not. -
isDynamicSQLRequiredForFunctions
public boolean isDynamicSQLRequiredForFunctions()INTERNAL: Some databases have issues with using parameters on certain functions and relations. This allows statements to disable binding only in these cases.Alternatively, DatabasePlatforms can override specific ExpressionOperators and add them to the platform specific operators. See
DatasourcePlatform.initializePlatformOperators()
-
allowBindingForSelectClause
public boolean allowBindingForSelectClause() -
getRefValue
INTERNAL: Platforms that support java.sql.Ref may override this method.- Returns:
- Object
- Throws:
SQLException
-
getRefValue
public Object getRefValue(Ref ref, AbstractSession executionSession, Connection connection) throws SQLException INTERNAL: This method builds a REF using the unwrapped connection within the session- Returns:
- Object
- Throws:
SQLException
-
printStoredFunctionReturnKeyWord
INTERNAL: Prints return keyword for StoredFunctionDefinition: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURN BIGINT The method was introduced because MySQL requires "RETURNS" instead: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURNS BIGINT- Throws:
IOException
-
printSQLSelectStatement
public void printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement) INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall. -
shouldPrintLockingClauseAfterWhereClause
public boolean shouldPrintLockingClauseAfterWhereClause()INTERNAL: Indicates whether locking clause should be printed after where clause by SQLSelectStatement. Example: on Oracle platform (method returns true): SELECT ADDRESS_ID, ... FROM ADDRESS WHERE (ADDRESS_ID = ?) FOR UPDATE on SQLServer platform (method returns false): SELECT ADDRESS_ID, ... FROM ADDRESS WITH (UPDLOCK) WHERE (ADDRESS_ID = ?) -
supportsIndividualTableLocking
public boolean supportsIndividualTableLocking()INTERNAL: Indicates whether locking clause could be selectively applied only to some tables in a ReadQuery. Example: the following locks the rows in SALARY table, doesn't lock the rows in EMPLOYEE table: on Oracle platform (method returns true): SELECT t0.EMP_ID..., t1.SALARY FROM EMPLOYEE t0, SALARY t1 WHERE ... FOR UPDATE t1.SALARY on SQLServer platform (method returns true): SELECT t0.EMP_ID..., t1.SALARY FROM EMPLOYEE t0, SALARY t1 WITH (UPDLOCK) WHERE ... -
supportsLockingQueriesWithMultipleTables
public boolean supportsLockingQueriesWithMultipleTables()INTERNAL: Indicates whether locking clause could be applied to the query that has more than one table -
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 -
buildCreateIndex
INTERNAL: Don't override this method.- Parameters:
fullTableName
- qualified name of the table the index is to be created onindexName
- name of the indexcolumnNames
- one or more columns the index is created for
-
buildCreateIndex
public String buildCreateIndex(String fullTableName, String indexName, String qualifier, boolean isUnique, String... columnNames) INTERNAL: Override this method with the platform's CREATE INDEX statement.- Parameters:
fullTableName
- qualified name of the table the index is to be created onindexName
- name of the indexqualifier
- qualifier to construct qualified name of index if neededisUnique
- Indicates whether unique index is createdcolumnNames
- one or more columns the index is created for
-
buildDropIndex
INTERNAL: Don't override this method.- Parameters:
fullTableName
- qualified name of the table the index is to be removed fromindexName
- name of the index
-
buildDropIndex
INTERNAL: Override this method with the platform's DROP INDEX statement.- Parameters:
fullTableName
- qualified name of the table the index is to be removed fromindexName
- name of the indexqualifier
- qualifier to construct qualified name of index if needed
-
buildSequenceObjectCreationWriter
public Writer buildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start) throws IOException INTERNAL: Returns sql used to create sequence object in the database.- Throws:
IOException
-
buildSequenceObjectDeletionWriter
public Writer buildSequenceObjectDeletionWriter(Writer writer, String fullSeqName) throws IOException INTERNAL: Returns sql used to delete sequence object from the database.- Throws:
IOException
-
buildSequenceObjectAlterIncrementWriter
public Writer buildSequenceObjectAlterIncrementWriter(Writer writer, String fullSeqName, int increment) throws IOException INTERNAL: Returns sql used to alter sequence object's increment in the database.- Throws:
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. -
supportsNestingOuterJoins
public boolean supportsNestingOuterJoins()INTERNAL: Return if nesting outer joins is supported, i.e. each join must be followed by the ON clause. -
supportsOuterJoinsWithBrackets
public boolean supportsOuterJoinsWithBrackets()INTERNAL: Return if brackets can be used in the ON clause for outer joins. -
freeTemporaryObject
INTERNAL: Used by some platforms during reading of ResultSet to free temporary objects.- Throws:
SQLException
-
initializeConnectionData
INTERNAL: Allow initialization from the connection.- Throws:
SQLException
-
writeAddColumnClause
public void writeAddColumnClause(Writer writer, AbstractSession session, TableDefinition table, FieldDefinition field) throws IOException INTERNAL: May need to override this method if the platform supports ALTER TABLE ADD <column> and the generated sql doesn't work. Write the string that follows ALTER TABLE to create a sql statement for the platform in order to append a new column to an existing table.- Throws:
IOException
-
supportsConnectionUserName
public boolean supportsConnectionUserName()INTERNAL: Override this method if the platform supports storing JDBC connection user name duringinitializeConnectionData(Connection)
.- Returns:
- Always returns
false
-
getConnectionUserName
INTERNAL: Returns user name retrieved from JDBC connection.- Throws:
UnsupportedOperationException
- on every single call until overridden.
-
getTableExistsQuery
INTERNAL: Returns query to check whether given table exists. Query execution throws an exception when no such table exists.- Parameters:
table
- database table meta-data- Returns:
- query to check whether given table exists
-
checkTableExists
public boolean checkTableExists(DatabaseSessionImpl session, TableDefinition table, boolean suppressLogging) INTERNAL: Executes and evaluates query to check whether given table exists. Returned value is alwaystrue
, because an exception is thrown when given table does not exists.- Parameters:
session
- current database sessiontable
- database table meta-datasuppressLogging
- whether to suppress logging during query execution- Returns:
- value of
true
if given table exists orfalse
otherwise
-
getJsonPlatform
Get JSON support extension instance. This instance is initialized lazily with 1st JSON support request.- Returns:
- JSON support extension instance
-