Class DatabasePlatform
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
- org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
- All Implemented Interfaces:
Serializable,Cloneable,CorePlatform<ConversionManager>,Platform
- Direct Known Subclasses:
DatabasePlatform
public class DatabasePlatform extends DatasourcePlatform
DatabasePlatform is private to EclipseLink. It encapsulates behavior specific to a database platform (eg. Oracle, Sybase, DBase), and provides protocol for EclipseLink to access this behavior. The behavior categories which require platform specific handling are SQL generation and sequence behavior. While database platform currently provides sequence number retrieval behavior, this will move to a sequence manager (when it is implemented).- Since:
- TOPLink/Java 1.0
- See Also:
AccessPlatform,DB2Platform,DBasePlatform,OraclePlatform,SybasePlatform, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BatchWritingMechanismbatchWritingMechanismAllow for a custom batch writing mechanism.protected intcastSizeForVarcharParameterused for casting of input parameters in certain DBsprotected Map<String,Class<?>>classTypesStores mapping of class types to database types for schema creation.protected intcursorCodeAllow for the code that is used for preparing cursored outs for a storedprocedure to be settable.static intDEFAULT_MAX_BATCH_WRITING_SIZEBug#3214927 The default is 32000 for DynamicSQLBatchWritingMechanism.static intDEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZEprotected StringdriverNameprotected booleandriverSupportsNationalCharacterVaryingTrue if the current jdbc driver supports get/setNString methodsprotected Map<Class<?>,FieldTypeDefinition>fieldTypesHolds a map of values used to map JAVA types to database types for table creationstatic intIS_VALID_TIMEOUTTimeout used is isValid() check for dead connections.protected booleanisCastRequiredAllow platform specific cast to be enabled.protected intmaxBatchWritingSizeAllow for the batch size to be set as many database have strict limits.protected DataPartitioningCallbackpartitioningCallbackUsed to integrate with data partitioning in an external DataSource such as UCP.protected StringpingSQLThis 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 BooleanprintInnerJoinInWhereClauseAllow configuration option to use Where clause joining or From clause joining.protected BooleanprintOuterJoinInWhereClauseAllow configuration option to use Where clause outer joining or From clause joining.protected BooleanshouldBindAllParametersBind all arguments to any SQL statement.protected booleanshouldBindLiteralsAllow user to require literals to be bound.protected booleanshouldBindPartialParametersBind some arguments to any SQL statement.protected booleanshouldCacheAllStatementsCache all prepared statements, this requires full parameter binding as well.protected booleanshouldCreateIndicesOnForeignKeysAllows auto-indexing for foreign keys to be set.protected booleanshouldForceBindAllParametersBind all arguments to any SQL statement.protected booleanshouldForceFieldNamesToUpperCaseCan be used if the app expects upper case but the database is not return consistent case, i.e.static booleanshouldIgnoreCaseOnFieldComparisonsAllow 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 booleanshouldOptimizeDataConversionAllow for driver level data conversion optimization to be disabled, required because some drivers can loose precision.protected booleanshouldTrimStringsIndicates (if true) to remove blanks characters from the right of CHAR strings.protected intstatementCacheSizeThe statement cache size for prepare parameterized statements.protected StringstoredProcedureTerminationTokenThe delimiter between stored procedures in multiple stored procedure calls.protected intstringBindingSizeIndicates the size above which strings will be bound NOTE: does not work with ODBCprotected Map<String,StructConverter>structConvertersThe following two maps, provide two ways of looking up StructConverters.protected booleansupportsAutoCommitSome JDBC drivers do not support AutoCommit in the way EclipseLink expects.protected StringtableCreationSuffixString used on all table creation statements generated from the DefaultTableGenerator with a session using this project.protected inttransactionIsolationThe transaction isolation level to be set on the connection (optional).protected Map<Class<?>,StructConverter>typeConvertersprotected BooleanuseJDBCStoredProcedureSyntaxprotected booleanuseNationalCharacterVaryingIf true, the platform should map String columns to a type that supports national characters.protected booleanuseRownumFilteringSome platforms allow a query's maxRows and FirstResult settings to be specified in SQL.protected booleanusesBatchWritingBatch all write statementsprotected booleanusesByteArrayBindingIndicates that binding will be used for BLOB data.protected booleanusesJDBCBatchWritingAllow for our batch writing support to be used in JDK 1.2.protected booleanusesNativeBatchWritingbug 4241441: Allow custom batch writing to enable batching with optimistic locking.protected booleanusesNativeSQLIndicates that native SQL should be used for literal values instead of ODBC escape format Only used with Oracle, Sybase & DB2protected booleanusesStreamsForBindingIndicates that streams will be used to store BLOB data.protected booleanusesStringBindingIndicates that strings will above the stringBindingSize will be bound NOTE: does not work with ODBC-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultNativeSequenceToTable, defaultSeqenceAtNextValue, defaultSequence, endDelimiter, platformOperators, sequences, sequencesLock, startDelimiter, supportsReturnGeneratedKeys, tableQualifier, timestampQuery, uuidQuery
-
-
Constructor Summary
Constructors Constructor Description DatabasePlatform()Creates an instance of default database platform.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddBatch(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).voidaddStructConverter(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() methodbooleanallowBindingForSelectClause()booleanallowsSizeInProcedureArguments()Used for stored procedure definitions.protected voidappendBoolean(Boolean bool, Writer writer)Appends a Boolean value as a numberprotected voidappendByteArray(byte[] bytes, Writer writer)Append the ByteArray in ODBC literal format ({b hexString}).protected voidappendCalendar(Calendar calendar, Writer writer)Answer a platform correct string representation of a Calendar as a Timestamp, suitable for SQL generation.protected voidappendDate(Date date, Writer writer)Answer a platform correct string representation of a Date, suitable for SQL generation.voidappendLiteralToCall(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 voidappendLiteralToCallWithBinding(Call call, Writer writer, Object literal)INTERNAL: Override this method in case the platform needs to do something special for binding literals.protected voidappendNumber(Number number, Writer writer)Write number to SQL string.voidappendParameter(Call call, Writer writer, Object parameter)Write a database-friendly representation of the given parameter to the writer.intappendParameterInternal(Call call, Writer writer, Object parameter)Returns the number of parameters that used binding.protected voidappendString(String string, Writer writer)Write the string.protected voidappendTime(Time time, Writer writer)Answer a platform correct string representation of a Time, suitable for SQL generation.protected voidappendTimestamp(Timestamp timestamp, Writer writer)Answer a platform correct string representation of a Timestamp, suitable for SQL generation.voidautoCommit(DatabaseAccessor accessor)Used by JDBC drivers that do not support autocommit so simulate an autocommit.voidbeginTransaction(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.ExpressionbuildBatchCriteria(ExpressionBuilder builder, Expression field)INTERNAL: Return the selection criteria used to IN batch fetching.ExpressionbuildBatchCriteriaForComplexId(ExpressionBuilder builder, List<Expression> fields)INTERNAL: Return the selection criteria used to IN batch fetching.DatabaseCallbuildCallWithReturning(SQLCall sqlCall, Vector<DatabaseField> returnFields)INTERNAL Returns null unless the platform supports call with returningprotected Map<String,Class<?>>buildClassTypes()Return the mapping of class types to database types for the schema framework.StringbuildCreateIndex(String fullTableName, String indexName, String... columnNames)INTERNAL: Don't override this method.StringbuildCreateIndex(String fullTableName, String indexName, String qualifier, boolean isUnique, String... columnNames)INTERNAL: Override this method with the platform's CREATE INDEX statement.StringbuildDropIndex(String fullTableName, String indexName)INTERNAL: Don't override this method.StringbuildDropIndex(String fullTableName, String indexName, String qualifier)INTERNAL: Override this method with the platform's DROP INDEX statement.protected Hashtable<Class<?>,FieldTypeDefinition>buildFieldTypes()Return the mapping of class types to database types for the schema framework.StringbuildProcedureCallString(StoredProcedureCall call, AbstractSession session, AbstractRecord row)Return the proc syntax for this platform.WriterbuildSequenceObjectAlterIncrementWriter(Writer writer, String fullSeqName, int increment)INTERNAL: Returns sql used to alter sequence object's increment in the database.WriterbuildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start)INTERNAL: Returns sql used to create sequence object in the database.WriterbuildSequenceObjectDeletionWriter(Writer writer, String fullSeqName)INTERNAL: Returns sql used to delete sequence object from the database.booleancanBatchWriteWithOptimisticLocking(DatabaseCall call)INTERNAL: Supports Batch Writing with Optimistic Locking.booleancanBuildCallWithReturning()INTERNAL Indicates whether the platform can build call with returning.booleancheckTableExists(DatabaseSessionImpl session, TableDefinition table, boolean suppressLogging)INTERNAL: Executes and evaluates query to check whether given table exists.voidcommitTransaction(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.intcomputeMaxRowsForSQL(int firstResultIndex, int maxResults)INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute a value to use when limiting the results of a query in SQL.ObjectconvertToDatabaseType(Object value)INTERNAL We support more primitive than JDBC does so we must do conversion before printing or binding.voidcopyInto(Platform platform)Copy the state into the new platform.ArraycreateArray(String elementDataTypeName, Object[] elements, Connection connection)INTERNAL: Platforms that support java.sql.Array may override this method.ArraycreateArray(String elementDataTypeName, Object[] elements, AbstractSession session, Connection connection)INTERNAL: This method builds an Array using the unwrapped connection within the sessionprotected SequencecreatePlatformDefaultSequence()INTERNAL: Create platform-default SequenceStructcreateStruct(String structTypeName, Object[] attributes, Connection connection)INTERNAL: Platforms that support java.sql.Struct may override this method.StructcreateStruct(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 sessionStructcreateStruct(String structTypeName, Object[] attributes, AbstractSession session, Connection connection)INTERNAL: This method builds a Struct using the unwrapped connection within the sessionbooleandontBindUpdateAllQueryUsingTempTables()INTERNAL: May need to override this method if the sql generated for UpdateAllQuery using temp tables fails in case parameter binding is used.intexecuteBatch(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.ObjectexecuteStoredProcedure(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.voidfreeTemporaryObject(Object value)INTERNAL: Used by some platforms during reading of ResultSet to free temporary objects.StringgetAssignmentString()Used for stored function calls.StringgetBatchBeginString()Used for batch writing and sp defs.StringgetBatchDelimiterString()Used for batch writing and sp defs.StringgetBatchEndString()Used for batch writing and sp defs.StringgetBatchRowCountAssignString()Used for batch writing for row count return.StringgetBatchRowCountDeclareString()Used for batch writing for row count return.StringgetBatchRowCountReturnString()Used for batch writing for row count return.BatchWritingMechanismgetBatchWritingMechanism()Return the custom batch writing mechanism.intgetCastSizeForVarcharParameter()ADVANCED: Get the maximum length allowed by the database for a Varchar Parameter This is used by subclasses when writing SQL for parametersMap<String,Class<?>>getClassTypes()Return the class type to database type mapping for the schema framework.ConnectiongetConnection(AbstractSession session, Connection connection)INTERNAL: This method is used to unwrap the oracle connection wrapped by the application server.StringgetConnectionUserName()INTERNAL: Returns user name retrieved from JDBC connection.StringgetConstraintDeletionString()Used for constraint deletion.StringgetCreateDatabaseSchemaString(String schema)Return the create schema SQL syntax.protected StringgetCreateTempTableSqlBodyForTable(DatabaseTable table)INTERNAL: May override this method if the platform supports temporary tables.protected StringgetCreateTempTableSqlPrefix()INTERNAL: Override this method if the platform supports temporary tables.protected StringgetCreateTempTableSqlSuffix()INTERNAL: May override this method if the platform support temporary tables.StringgetCreateViewString()/** Used for view creation.StringgetCreationInOutputProcedureToken()This method is used to print the required output parameter token for the specific platform.StringgetCreationOutputProcedureToken()This method is used to print the required output parameter token for the specific platform.intgetCursorCode()ADVANCED: Return the code for preparing cursored output parameters in a stored procedureObjectgetCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind)This method determines if any special processing needs to occur prior to writing a field.StringgetDefaultSequenceTableName()Returns the table name used by TableSequence by default.booleangetDriverSupportsNVarChar()StringgetDropCascadeString()Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.StringgetDropDatabaseSchemaString(String schema)Return the drop schema SQL syntax.FieldTypeDefinitiongetFieldTypeDefinition(Class<?> javaClass)Return the field type object describing this databases platform specific representation of the Java primitive class name.Map<Class<?>,FieldTypeDefinition>getFieldTypes()Return the class type to database type mappings for the schema framework.StringgetFunctionCallHeader()Used for stored function calls.StringgetIndexNamePrefix(boolean isUniqueSetOnField)Used to allow platforms to define their own index prefixesStringgetInOutputProcedureToken()This method is used to print the output parameter token when stored procedures are calledStringgetInputProcedureToken()Used for stored procedure creation: Prefix for INPUT parameters.StringgetJDBCOuterJoinString()Returns the JDBC outer join operator for SELECT statements.intgetJDBCType(Class<?> javaType)Return the JDBC type for the Java type.intgetJDBCType(DatabaseField field)Return the JDBC type for the given database field.intgetJDBCTypeForSetNull(DatabaseField field)Return the JDBC type for the given database field to be passed to Statement.setNullStringgetJdbcTypeName(int jdbcType)INTERNAL: Returns the type name corresponding to the jdbc typeDatabaseJsonPlatformgetJsonPlatform()Get JSON support extension instance.intgetMaxBatchWritingSize()PUBLIC: Allow for the max batch writing size to be set.intgetMaxFieldNameSize()INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.intgetMaxForeignKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a foreign key name on this platform.intgetMaxIndexNameSize()INTERNAL: returns the maximum number of characters that can be used in an index name on this platform.intgetMaxUniqueKeyNameSize()INTERNAL: returns the maximum number of characters that can be used in a unique key name on this platform.StringgetNoWaitString()This syntax does no wait on the lock.ObjectgetObjectFromResultSet(ResultSet resultSet, int columnNumber, int type, AbstractSession session)INTERNAL: Get the object from the JDBC Result set.StringgetOutputProcedureToken()This method is used to print the output parameter token when stored procedures are calledObjectgetParameterValueFromDatabaseCall(CallableStatement statement, int index, AbstractSession session)INTERNAL Get the parameter from the JDBC statement with the given index.ObjectgetParameterValueFromDatabaseCall(CallableStatement statement, String name, AbstractSession session)INTERNAL Get the parameter from the JDBC statement with the given name.DataPartitioningCallbackgetPartitioningCallback()Return callback.StringgetPingSQL()Used for determining if an SQL exception was communication based.StringgetProcedureArgument(String name, Object parameter, DatasourceCall.ParameterType parameterType, StoredProcedureCall call, AbstractSession session)Obtain the platform specific argument stringStringgetProcedureArgumentString()Used for sp defs.StringgetProcedureAsString()Used for stored procedure defs.StringgetProcedureBeginString()Used for stored procedure defs.StringgetProcedureCallHeader()Used for sp calls.StringgetProcedureCallTail()Used for sp calls.StringgetProcedureEndString()Used for stored procedure defs.StringgetProcedureOptionList()Some platforms have an option list Only to be used for stored procedure creation.StringgetQualifiedName(String name)StringgetQualifiedSequenceTableName()ObjectgetRefValue(Ref ref, Connection connection)INTERNAL: Platforms that support java.sql.Ref may override this method.ObjectgetRefValue(Ref ref, AbstractSession executionSession, Connection connection)INTERNAL: This method builds a REF using the unwrapped connection within the sessionStringgetSelectForUpdateNoWaitString()This syntax does no wait on the lock.StringgetSelectForUpdateOfString()For fine-grained pessimistic locking the column names can be specified individually.StringgetSelectForUpdateString()Most database support a syntax.StringgetSelectForUpdateWaitString(Integer waitTimeout)Platforms that support the WAIT option should override this method.StringgetSequenceCounterFieldName()StringgetSequenceNameFieldName()intgetSequencePreallocationSize()StringgetSequenceTableName()intgetStatementCacheSize()The statement cache size for prepare parameterized statements.StringgetStoredProcedureParameterPrefix()StringgetStoredProcedureTerminationToken()Returns the delimiter between stored procedures in multiple stored procedure calls.intgetStringBindingSize()Map<String,StructConverter>getStructConverters()INTERNAL: Get the map of StructConverters that will be used to preprocess STRUCT data as it is readStringgetTableCreationSuffix()PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).protected DataReadQuerygetTableExistsQuery(TableDefinition table)INTERNAL: Returns query to check whether given table exists.DatabaseTablegetTempTableForTable(DatabaseTable table)INTERNAL: May override this method if the platform support temporary tables.intgetTransactionIsolation()Returns the transaction isolation setting for a connection.Map<Class<?>,StructConverter>getTypeConverters()INTERNAL: Get the map of TypeConverters This map indexes StructConverters by the Java Class they are meant to convertStringgetUniqueConstraintDeletionString()Used for constraint deletion.booleangetUseNationalCharacterVaryingTypeForString()DatabaseQuerygetVPDClearIdentifierQuery(String vpdIdentifier)Any platform that supports VPD should implement this method.StringgetVPDCreationFunctionString(String tableName, String tenantFieldName)Any platform that supports VPD should implement this method.StringgetVPDCreationPolicyString(String tableName, AbstractSession session)Any platform that supports VPD should implement this method.StringgetVPDDeletionString(String tableName, AbstractSession session)Any platform that supports VPD should implement this method.DatabaseQuerygetVPDSetIdentifierQuery(String vpdIdentifier)Any platform that supports VPD should implement this method.booleanhasPartitioningCallback()Check if has callback.voidinitialize()Initialize operators to avoid concurrency issues.voidinitializeConnectionData(Connection connection)INTERNAL: Allow initialization from the connection.booleanisAlterSequenceObjectSupported()INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.booleanisCastRequired()Return if casting is enabled for platforms that support it.booleanisDynamicSQLRequiredForFunctions()INTERNAL: Some databases have issues with using parameters on certain functions and relations.booleanisForUpdateCompatibleWithDistinct()INTERNAL: Indicates whether SELECT DISTINCT ...booleanisInformixOuterJoin()Some database require outer joins to be given in the where clause, others require it in the from clause.booleanisJDBCExecuteCompliant()Returns true if this platform complies with the expected behavior from a jdbc execute call.booleanisLobCompatibleWithDistinct()INTERNAL: Indicates whether SELECT DISTINCT lob FROM ...booleanisLockTimeoutException(DatabaseException e)Return true is the given exception occurred as a result of a lock time out exception (WAIT clause).booleanisNullAllowedInSelectClause()INTERNAL: Override this if the platform cannot handle NULL in select clause.booleanisOutputAllowWithResultSet()INTERNAL: Return true if output parameters can be built with result sets.booleanisRowCountOutputParameterRequired()Return if the platform does not maintain the row count on batch executes and requires an output parameter to maintain the row count.booleanisXDBDocument(Object obj)INTERNAL: Indicates whether the passed object is an instance of XDBDocument.Hashtable<Class<? extends Number>,? super Number>maximumNumericValues()Builds a table of maximum numeric values keyed on java class.Hashtable<Class<? extends Number>,? super Number>minimumNumericValues()Builds a table of minimum numeric values keyed on java class.longminimumTimeIncrement()INTERNAL: Returns the minimum time increment supported by the platform.StatementprepareBatchStatement(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 statementsvoidprintFieldIdentityClause(Writer writer)Append the receiver's field 'identity' constraint clause to a writer.voidprintFieldNotNullClause(Writer writer)Append the receiver's field 'NOT NULL' constraint clause to a writer.voidprintFieldNullClause(Writer writer)Append the receiver's field 'NULL' constraint clause to a writer.protected voidprintFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType)voidprintFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause)protected voidprintFieldUnique(Writer writer)voidprintFieldUnique(Writer writer, boolean shouldPrintFieldIdentityClause)voidprintSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement)INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.voidprintStoredFunctionReturnKeyWord(Writer writer)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 BIGINTintprintValuelist(int[] theObjects, DatabaseCall call, Writer writer)Print the int array on the writer.intprintValuelist(Collection<?> theObjects, DatabaseCall call, Writer writer)voidregisterOutputParameter(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.voidregisterOutputParameter(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.voidregisterOutputParameter(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.voidregisterOutputParameter(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.booleanrequiresNamedPrimaryKeyConstraints()This is used as some databases create the primary key constraint differently, i.e.booleanrequiresProcedureBrackets()Used for stored procedure creation: Some platforms need brackets around arguments declaration even if no arguments exist.booleanrequiresProcedureCallBrackets()USed for sp calls.booleanrequiresProcedureCallOuputToken()Used for sp calls.booleanrequiresTableInIndexDropDDL()INTERNAL: Return if this database requires the table name when dropping an index.booleanrequiresTypeNameToRegisterOutputParameter()INTERNAL: Indicates whether the version of CallableStatement.registerOutputParameter method that takes type name should be used.booleanrequiresUniqueConstraintCreationOnTableCreate()Used for table creation.voidretrieveFirstPrimaryKeyOrOne(ReportQuery subselect)INTERNAL: Used by Exists queries because they just need to select a single row.voidrollbackTransaction(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.voidsetBatchWritingMechanism(BatchWritingMechanism batchWritingMechanism)Set the custom batch writing mechanism.voidsetCastSizeForVarcharParameter(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 voidsetClassTypes(Map<String,Class<?>> classTypes)voidsetCursorCode(int cursorCode)ADVANCED: Set the code for preparing cursored output parameters in a stored procedurevoidsetDriverName(String driverName)During auto-detect, the driver name is set on the platform.voidsetDriverSupportsNVarChar(boolean b)protected voidsetFieldTypes(Map<Class<?>,FieldTypeDefinition> theFieldTypes)voidsetIsCastRequired(boolean isCastRequired)Set if casting is enabled for platforms that support it.voidsetMaxBatchWritingSize(int maxBatchWritingSize)PUBLIC: Allow for the max batch writing size to be set.protected voidsetNullFromDatabaseField(DatabaseField databaseField, CallableStatement statement, String name)protected voidsetNullFromDatabaseField(DatabaseField databaseField, PreparedStatement statement, int index)voidsetParameterValueInDatabaseCall(Object parameter, CallableStatement statement, String name, AbstractSession session)INTERNAL Set the parameter in the JDBC statement with the given name.voidsetParameterValueInDatabaseCall(Object parameter, PreparedStatement statement, int index, AbstractSession session)INTERNAL Set the parameter in the JDBC statement at the given index.voidsetPartitioningCallback(DataPartitioningCallback partitioningCallback)Set callback.voidsetPingSQL(String pingSQL)Used for determining if an SQL exception was communication based.voidsetPrintInnerJoinInWhereClause(boolean printInnerJoinInWhereClause)PUBLIC: Changes the way that inner joins are printed in generated SQL for the database.voidsetPrintOuterJoinInWhereClause(boolean printOuterJoinInWhereClause)PUBLIC: Changes the way that OuterJoins are done on the database.voidsetSequenceCounterFieldName(String name)voidsetSequenceNameFieldName(String name)voidsetSequenceTableName(String name)voidsetShouldBindAllParameters(boolean shouldBindAllParameters)Bind all arguments to any SQL statement.voidsetShouldBindLiterals(boolean shouldBindLiterals)PUBLIC: Allows user to choose whether to bind literals in DatabaseCalls or not.voidsetShouldBindPartialParameters(boolean shouldBindPartialParameters)Used to enable parameter binding and override the platform defaultvoidsetShouldCacheAllStatements(boolean shouldCacheAllStatements)Cache all prepared statements, this requires full parameter binding as well.voidsetShouldCreateIndicesOnForeignKeys(boolean shouldCreateIndicesOnForeignKeys)Used for table creation.voidsetShouldForceBindAllParameters(boolean shouldForceBindAllParameters)Used to enable parameter binding and override the platform defaultvoidsetShouldForceFieldNamesToUpperCase(boolean shouldForceFieldNamesToUpperCase)Can be used if the app expects upper case but the database is not return consistent case, i.e.static voidsetShouldIgnoreCaseOnFieldComparisons(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.voidsetShouldOptimizeDataConversion(boolean value)PUBLIC: Set if our driver level data conversion optimization is enabled.voidsetShouldTrimStrings(boolean aBoolean)voidsetShouldUseRownumFiltering(boolean useRownumFiltering)PUBLIC: Set if SQL-Level pagination should be used for FirstResult and MaxRows settings.voidsetStatementCacheSize(int statementCacheSize)The statement cache size for prepare parameterized statements.voidsetStoredProcedureTerminationToken(String storedProcedureTerminationToken)voidsetStringBindingSize(int aSize)voidsetSupportsAutoCommit(boolean supportsAutoCommit)supportsAutoCommit can be set to false for JDBC drivers which do not support autocommit.voidsetTableCreationSuffix(String tableCreationSuffix)PUBLIC: Get the String used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).voidsetTransactionIsolation(int isolationLevel)Set the transaction isolation setting for a connection.voidsetUseJDBCStoredProcedureSyntax(Boolean useJDBCStoredProcedureSyntax)Return true if JDBC syntax should be used for stored procedure calls.voidsetUseNationalCharacterVaryingTypeForString(boolean b)voidsetUsesBatchWriting(boolean usesBatchWriting)voidsetUsesByteArrayBinding(boolean usesByteArrayBinding)voidsetUsesJDBCBatchWriting(boolean usesJDBCBatchWriting)Some JDBC 2 drivers to not support batching, so this lets are own batching be used.voidsetUsesNativeBatchWriting(boolean usesNativeBatchWriting)Advanced: This is used to enable native batch writing on drivers that support it.voidsetUsesNativeSQL(boolean usesNativeSQL)voidsetUsesStreamsForBinding(boolean usesStreamsForBinding)voidsetUsesStringBinding(boolean aBool)booleanshouldAlwaysUseTempStorageForModifyAll()INTERNAL: That method affects UpdateAllQuery and DeleteAllQuery execution.booleanshouldBindAllParameters()Bind all arguments to any SQL statement.booleanshouldBindLiterals()PUBLIC: Allows platform to choose whether to bind literals in DatabaseCalls or not.booleanshouldBindPartialParameters()Used to determine if the platform should perform partial parameter binding or notbooleanshouldCacheAllStatements()Cache all prepared statements, this requires full parameter binding as well.booleanshouldCreateIndicesForPrimaryKeys()Used for table creation.booleanshouldCreateIndicesOnForeignKeys()Used for table creation.booleanshouldCreateIndicesOnUniqueKeys()Used for table creation.booleanshouldForceBindAllParameters()Used to enable parameter binding and override platform defaultbooleanshouldForceFieldNamesToUpperCase()Can be used if the app expects upper case but the database is not return consistent case, i.e.static booleanshouldIgnoreCaseOnFieldComparisons()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.booleanshouldIgnoreException(SQLException exception)Allow for the platform to ignore exceptions.booleanshouldOptimizeDataConversion()Return if our driver level data conversion optimization is enabled.booleanshouldPrintAliasForUpdate()INTERNAL: Indicates whether locking OF clause should print alias for field.booleanshouldPrintConstraintNameAfter()Some Platforms want the constraint name after the constraint definition.booleanshouldPrintFieldIdentityClause(AbstractSession session, String qualifiedFieldName)booleanshouldPrintForUpdateClause()booleanshouldPrintInnerJoinInWhereClause(ReadQuery query)This allows which clause inner joins are printed into in SQL generation.booleanshouldPrintInOutputTokenBeforeType()This is required in the construction of the stored procedures with output parametersbooleanshouldPrintInputTokenAtStart()Used for stored procedure creation: Some platforms want to print prefix for INPUT arguments BEFORE NAME.booleanshouldPrintLockingClauseAfterWhereClause()INTERNAL: Indicates whether locking clause should be printed after where clause by SQLSelectStatement.booleanshouldPrintOuterJoinInWhereClause()Some database require outer joins to be given in the where clause, others require it in the from clause.booleanshouldPrintOutputTokenAtStart()This is required in the construction of the stored procedures with output parametersbooleanshouldPrintOutputTokenBeforeType()This is required in the construction of the stored procedures with output parametersbooleanshouldPrintStoredProcedureArgumentNameInCall()INTERNAL: Should the variable name of a stored procedure call be printed as part of the procedure call e.g.booleanshouldPrintStoredProcedureVariablesAfterBeginString()Used for stored procedure creation: Some platforms declare variables AFTER the procedure body's BEGIN string.protected booleanshouldTempTableSpecifyPrimaryKeys()INTERNAL: Indicates whether temporary table can specify primary keys (some platforms don't allow that).booleanshouldTrimStrings()booleanshouldUseCustomModifyForCall(DatabaseField field)Used by SQLCall.appendModify(..) If the field should be passed to customModifyInDatabaseCall, retun true, otherwise false.booleanshouldUseGetSetNString()Returns true iff: tThe current driver supports calling get/setNString Strings are globally mapped to a national character varying type (useNationalCharacterVarying()).booleanshouldUseJDBCOuterJoinSyntax()JDBC defines and outer join syntax, many drivers do not support this.booleanshouldUseRownumFiltering()PUBLIC: Return if Oracle ROWNUM pagination should be used for FirstResult and MaxRows settings.booleansupportsANSIInnerJoinSyntax()Indicates whether the ANSI syntax for inner joins (e.g.booleansupportsAutoCommit()supportsAutoCommit must sometimes be set to false for JDBC drivers which do not support autocommit.booleansupportsAutoConversionToNumericForArithmeticOperations()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 ...booleansupportsConnectionUserName()INTERNAL: Override this method if the platform supports storing JDBC connection user name duringinitializeConnectionData(Connection).booleansupportsCountDistinctWithMultipleFields()INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields.booleansupportsDeleteOnCascade()booleansupportsForeignKeyConstraints()booleansupportsGlobalTempTables()INTERNAL: Indicates whether the platform supports global temporary tables.booleansupportsIndexes()INTERNAL: Return if this database support index creation.booleansupportsIndividualTableLocking()INTERNAL: Indicates whether locking clause could be selectively applied only to some tables in a ReadQuery.booleansupportsLocalTempTables()INTERNAL: Indicates whether the platform supports local temporary tables.booleansupportsLockingQueriesWithMultipleTables()INTERNAL: Indicates whether locking clause could be applied to the query that has more than one tablebooleansupportsNestingOuterJoins()INTERNAL: Return if nesting outer joins is supported, i.e.booleansupportsOrderByParameters()Used to determine if the platform supports untyped parameters, as ordinal variables, within the Order By clausebooleansupportsOuterJoinsWithBrackets()INTERNAL: Return if brackets can be used in the ON clause for outer joins.booleansupportsPrimaryKeyConstraint()booleansupportsStoredFunctions()booleansupportsTempTables()INTERNAL: Indicates whether the platform supports temporary tables.booleansupportsUniqueColumns()Allows unique columns to be defined as constraint if the UNIQUE keyword is not support on a column defintion.booleansupportsUniqueKeyConstraints()booleansupportsVPD()By default, platforms do not support VPD.booleansupportsWaitForUpdate()INTERNAL: Indicates whether the platform supports timeouts on For UpdatebooleanusesBatchWriting()booleanusesByteArrayBinding()booleanusesJDBCBatchWriting()Some JDBC 2 drivers to not support batching, so this lets are own batching be used.booleanusesNativeBatchWriting()booleanusesNativeSQL()booleanusesSequenceTable()booleanusesStreamsForBinding()booleanusesStringBinding()booleanwasFailureCommunicationBased(SQLException exception, Connection connection, AbstractSession sessionForProfile)voidwriteAddColumnClause(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 voidwriteAutoAssignmentSetClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields, DatasourcePlatform platform)INTERNAL: helper method, don't override.protected static voidwriteAutoJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> pkFields, DatasourcePlatform platform)INTERNAL: helper method, don't override.voidwriteCleanUpTempTableSql(Writer writer, DatabaseTable table)INTERNAL: Don't override this method.voidwriteCreateTempTableSql(Writer writer, DatabaseTable table, AbstractSession session, Collection<DatabaseField> pkFields, Collection<DatabaseField> usedFields, Collection<DatabaseField> allFields)INTERNAL: Don't override this method.voidwriteDeleteFromTargetTableUsingTempTableSql(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 voidwriteFields(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields1, Collection<DatabaseField> fields2, String separator, DatasourcePlatform platform)INTERNAL: helper method, don't override.protected static voidwriteFieldsAutoClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> fields, String separator, DatasourcePlatform platform)INTERNAL: helper method, don't override.protected static voidwriteFieldsList(Writer writer, Collection<DatabaseField> fields, DatasourcePlatform platform)INTERNAL: helper method, don't override.voidwriteInsertIntoTableSql(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 voidwriteJoinWhereClause(Writer writer, String tableName1, String tableName2, Collection<DatabaseField> pkFields1, Collection<DatabaseField> pkFields2, DatasourcePlatform platform)INTERNAL: helper method, don't override.voidwriteLOB(DatabaseField field, Object value, ResultSet resultSet, AbstractSession session)INTERNAL: Write LOB value - only on Oracle8 and upvoidwriteParameterMarker(Writer writer, ParameterExpression expression, AbstractRecord record, DatabaseCall call)voidwriteTableCreationSuffix(Writer writer, String tableCreationSuffix)INTERNAL: Write used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).voidwriteUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, Collection<DatabaseField> pkFields, Collection<DatabaseField> assignedFields)INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work.-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.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 Detail
-
fieldTypes
protected transient Map<Class<?>,FieldTypeDefinition> fieldTypes
Holds a map of values used to map JAVA types to database types for table creation
-
usesNativeSQL
protected boolean usesNativeSQL
Indicates that native SQL should be used for literal values instead of ODBC escape format Only used with Oracle, Sybase & DB2
-
usesByteArrayBinding
protected boolean usesByteArrayBinding
Indicates that binding will be used for BLOB data. NOTE: does not work well with ODBC.
-
usesBatchWriting
protected boolean usesBatchWriting
Batch all write statements
-
shouldBindAllParameters
protected Boolean shouldBindAllParameters
Bind all arguments to any SQL statement.
-
shouldForceBindAllParameters
protected boolean shouldForceBindAllParameters
Bind all arguments to any SQL statement.
-
shouldBindPartialParameters
protected boolean shouldBindPartialParameters
Bind some arguments to any SQL statement.
-
shouldCacheAllStatements
protected boolean shouldCacheAllStatements
Cache all prepared statements, this requires full parameter binding as well.
-
statementCacheSize
protected int statementCacheSize
The statement cache size for prepare parameterized statements.
-
shouldForceFieldNamesToUpperCase
protected boolean shouldForceFieldNamesToUpperCase
Can be used if the app expects upper case but the database is not return consistent case, i.e. different databases.
-
shouldTrimStrings
protected boolean shouldTrimStrings
Indicates (if true) to remove blanks characters from the right of CHAR strings.
-
usesStreamsForBinding
protected boolean usesStreamsForBinding
Indicates that streams will be used to store BLOB data. NOTE: does not work with ODBC
-
stringBindingSize
protected int stringBindingSize
Indicates the size above which strings will be bound NOTE: does not work with ODBC
-
usesStringBinding
protected boolean usesStringBinding
Indicates that strings will above the stringBindingSize will be bound NOTE: does not work with ODBC
-
maxBatchWritingSize
protected int maxBatchWritingSize
Allow for the batch size to be set as many database have strict limits.
-
castSizeForVarcharParameter
protected int castSizeForVarcharParameter
used for casting of input parameters in certain DBs
-
usesJDBCBatchWriting
protected boolean usesJDBCBatchWriting
Allow for our batch writing support to be used in JDK 1.2.
-
usesNativeBatchWriting
protected boolean usesNativeBatchWriting
bug 4241441: Allow custom batch writing to enable batching with optimistic locking.
-
batchWritingMechanism
protected BatchWritingMechanism batchWritingMechanism
Allow for a custom batch writing mechanism.
-
printOuterJoinInWhereClause
protected Boolean printOuterJoinInWhereClause
Allow configuration option to use Where clause outer joining or From clause joining.
-
printInnerJoinInWhereClause
protected Boolean printInnerJoinInWhereClause
Allow configuration option to use Where clause joining or From clause joining.
-
cursorCode
protected int cursorCode
Allow for the code that is used for preparing cursored outs for a storedprocedure to be settable.
-
transactionIsolation
protected int transactionIsolation
The transaction isolation level to be set on the connection (optional).
-
supportsAutoCommit
protected boolean supportsAutoCommit
Some JDBC drivers do not support AutoCommit in the way EclipseLink expects. (e.g. Attunity Connect, JConnect)
-
shouldOptimizeDataConversion
protected boolean shouldOptimizeDataConversion
Allow for driver level data conversion optimization to be disabled, required because some drivers can loose precision.
-
classTypes
protected transient Map<String,Class<?>> classTypes
Stores mapping of class types to database types for schema creation.
-
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.
-
DEFAULT_MAX_BATCH_WRITING_SIZE
public static final int DEFAULT_MAX_BATCH_WRITING_SIZE
Bug#3214927 The default is 32000 for DynamicSQLBatchWritingMechanism. It would become 100 when switched to ParameterizedSQLBatchWritingMechanism.- See Also:
- Constant Field Values
-
DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE
public static final int DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE
- See Also:
- Constant Field Values
-
IS_VALID_TIMEOUT
public static final int IS_VALID_TIMEOUT
Timeout used is isValid() check for dead connections.- See Also:
- Constant Field Values
-
pingSQL
protected String 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
protected Map<String,StructConverter> 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
protected Map<Class<?>,StructConverter> typeConverters
-
useRownumFiltering
protected boolean useRownumFiltering
Some 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 isCastRequired
Allow platform specific cast to be enabled.
-
shouldBindLiterals
protected boolean shouldBindLiterals
Allow user to require literals to be bound.
-
tableCreationSuffix
protected String 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
protected String storedProcedureTerminationToken
The delimiter between stored procedures in multiple stored procedure calls.
-
partitioningCallback
protected DataPartitioningCallback partitioningCallback
Used to integrate with data partitioning in an external DataSource such as UCP.
-
shouldCreateIndicesOnForeignKeys
protected boolean shouldCreateIndicesOnForeignKeys
Allows auto-indexing for foreign keys to be set.
-
useJDBCStoredProcedureSyntax
protected Boolean useJDBCStoredProcedureSyntax
-
driverName
protected String driverName
-
driverSupportsNationalCharacterVarying
protected boolean driverSupportsNationalCharacterVarying
True if the current jdbc driver supports get/setNString methods
-
useNationalCharacterVarying
protected boolean useNationalCharacterVarying
If true, the platform should map String columns to a type that supports national characters.
-
-
Method Detail
-
initialize
public void initialize()
Initialize operators to avoid concurrency issues.- Specified by:
initializein interfacePlatform- Overrides:
initializein classDatasourcePlatform
-
hasPartitioningCallback
public boolean hasPartitioningCallback()
Check if has callback. Used to integrate with data partitioning in an external DataSource such as UCP.
-
getPartitioningCallback
public DataPartitioningCallback getPartitioningCallback()
Return callback. Used to integrate with data partitioning in an external DataSource such as UCP.
-
setPartitioningCallback
public void setPartitioningCallback(DataPartitioningCallback partitioningCallback)
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
public Map<String,StructConverter> getStructConverters()
INTERNAL: Get the map of StructConverters that will be used to preprocess STRUCT data as it is read
-
getTableCreationSuffix
public String 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
public Map<Class<?>,StructConverter> getTypeConverters()
INTERNAL: Get the map of TypeConverters This map indexes StructConverters by the Java Class they are meant to convert
-
addStructConverter
public 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() method
-
addBatch
public int addBatch(PreparedStatement statement) throws SQLException
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
public void autoCommit(DatabaseAccessor accessor) throws SQLException
Used by JDBC drivers that do not support autocommit so simulate an autocommit.- Throws:
SQLException
-
beginTransaction
public void beginTransaction(DatabaseAccessor accessor) throws SQLException
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
public Expression buildBatchCriteria(ExpressionBuilder builder, Expression field)
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
public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector<DatabaseField> returnFields)
INTERNAL Returns null unless the platform supports call with returning
-
buildClassTypes
protected Map<String,Class<?>> buildClassTypes()
Return the mapping of class types to database types for the schema framework.
-
buildFieldTypes
protected Hashtable<Class<?>,FieldTypeDefinition> 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
public boolean canBatchWriteWithOptimisticLocking(DatabaseCall call)
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:
MySQLPlatform
-
commitTransaction
public void commitTransaction(DatabaseAccessor accessor) throws SQLException
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
public DatabaseQuery getVPDClearIdentifierQuery(String vpdIdentifier)
Any platform that supports VPD should implement this method.
-
getVPDCreationFunctionString
public String getVPDCreationFunctionString(String tableName, String tenantFieldName)
Any platform that supports VPD should implement this method. Used for DDL generation.
-
getVPDCreationPolicyString
public String getVPDCreationPolicyString(String tableName, AbstractSession session)
Any platform that supports VPD should implement this method. Used for DDL generation.
-
getVPDDeletionString
public String getVPDDeletionString(String tableName, AbstractSession session)
Any platform that supports VPD should implement this method. Used for DDL generation.
-
getVPDSetIdentifierQuery
public DatabaseQuery getVPDSetIdentifierQuery(String vpdIdentifier)
Any platform that supports VPD should implement this method.
-
convertToDatabaseType
public Object convertToDatabaseType(Object value)
INTERNAL We support more primitive than JDBC does so we must do conversion before printing or binding.
-
copyInto
public void copyInto(Platform platform)
Copy the state into the new platform.- Specified by:
copyIntoin interfacePlatform- Overrides:
copyIntoin classDatasourcePlatform
-
getBatchBeginString
public String 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
public String getBatchRowCountDeclareString()
Used for batch writing for row count return.
-
getBatchRowCountAssignString
public String getBatchRowCountAssignString()
Used for batch writing for row count return.
-
getBatchRowCountReturnString
public String getBatchRowCountReturnString()
Used for batch writing for row count return.
-
getBatchDelimiterString
public String getBatchDelimiterString()
Used for batch writing and sp defs.
-
getBatchEndString
public String getBatchEndString()
Used for batch writing and sp defs.
-
getConnection
public Connection getConnection(AbstractSession session, Connection connection)
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
public String getConstraintDeletionString()
Used for constraint deletion.
-
getUniqueConstraintDeletionString
public String getUniqueConstraintDeletionString()
Used for constraint deletion.
-
getCreateViewString
public String getCreateViewString()
/** Used for view creation.
-
getDropCascadeString
public String 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:
getCustomModifyValueForCallin interfacePlatform- Overrides:
getCustomModifyValueForCallin classDatasourcePlatform
-
getProcedureEndString
public String getProcedureEndString()
Used for stored procedure defs.
-
getProcedureBeginString
public String getProcedureBeginString()
Used for stored procedure defs.
-
getProcedureAsString
public String getProcedureAsString()
Used for stored procedure defs.
-
getProcedureOptionList
public String getProcedureOptionList()
Some platforms have an option list Only to be used for stored procedure creation.- See Also:
StoredProcedureDefinition
-
getClassTypes
public Map<String,Class<?>> getClassTypes()
Return the class type to database type mapping for the schema framework.
-
getAssignmentString
public String 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:
DB2Platform
-
getCreationInOutputProcedureToken
public String getCreationInOutputProcedureToken()
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created.
-
getCreationOutputProcedureToken
public String 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
public String getDefaultSequenceTableName()
Returns the table name used by TableSequence by default.
-
getCreateDatabaseSchemaString
public String getCreateDatabaseSchemaString(String schema)
Return the create schema SQL syntax. Subclasses should override as needed.
-
getDropDatabaseSchemaString
public String getDropDatabaseSchemaString(String schema)
Return the drop schema SQL syntax. Subclasses should override as needed.
-
getFieldTypeDefinition
public FieldTypeDefinition getFieldTypeDefinition(Class<?> javaClass)
Return the field type object describing this databases platform specific representation of the Java primitive class name.
-
getFieldTypes
public Map<Class<?>,FieldTypeDefinition> getFieldTypes()
Return the class type to database type mappings for the schema framework.
-
getFunctionCallHeader
public String getFunctionCallHeader()
Used for stored function calls.
-
getInOutputProcedureToken
public String getInOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called
-
getJDBCOuterJoinString
public String getJDBCOuterJoinString()
Returns the JDBC outer join operator for SELECT statements.
-
getJDBCTypeForSetNull
public int getJDBCTypeForSetNull(DatabaseField field)
Return the JDBC type for the given database field to be passed to Statement.setNull
-
getJDBCType
public int getJDBCType(DatabaseField field)
Return the JDBC type for the given database field.
-
getJDBCType
public int getJDBCType(Class<?> javaType)
Return the JDBC type for the Java type.
-
getJdbcTypeName
public String getJdbcTypeName(int jdbcType)
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:
- "org.eclipse.persistence.platform.database.oracle.Oracle9Plaform"
-
getInputProcedureToken
public String getInputProcedureToken()
Used for stored procedure creation: Prefix for INPUT parameters. Not required on most platforms.
-
getIndexNamePrefix
public String getIndexNamePrefix(boolean isUniqueSetOnField)
Used to allow platforms to define their own index prefixes
-
getOutputProcedureToken
public String getOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called
-
getPingSQL
public String 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
public String 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
public String getProcedureCallHeader()
Used for sp calls.
-
getProcedureCallTail
public String getProcedureCallTail()
Used for sp calls.
-
getQualifiedSequenceTableName
public String getQualifiedSequenceTableName()
-
getNoWaitString
public String getNoWaitString()
This syntax does no wait on the lock. (i.e. In Oracle adding NOWAIT to the end will accomplish this)
-
getSelectForUpdateNoWaitString
public String getSelectForUpdateNoWaitString()
This syntax does no wait on the lock. (i.e. In Oracle adding FOR UPDATE NOWAIT to the end will accomplish this)
-
getSelectForUpdateOfString
public String getSelectForUpdateOfString()
For fine-grained pessimistic locking the column names can be specified individually.
-
getSelectForUpdateString
public String getSelectForUpdateString()
Most database support a syntax. although don't actually lock the row. Some require the OF some don't like it.
-
getSelectForUpdateWaitString
public String getSelectForUpdateWaitString(Integer waitTimeout)
Platforms that support the WAIT option should override this method. By default the wait timeout is ignored.- See Also:
supportsWaitForUpdate()
-
getSequenceCounterFieldName
public String getSequenceCounterFieldName()
-
getSequenceNameFieldName
public String getSequenceNameFieldName()
-
getSequencePreallocationSize
public int getSequencePreallocationSize()
- Overrides:
getSequencePreallocationSizein classDatasourcePlatform
-
getSequenceTableName
public String getSequenceTableName()
-
getStatementCacheSize
public int getStatementCacheSize()
The statement cache size for prepare parameterized statements.
-
getStoredProcedureParameterPrefix
public String getStoredProcedureParameterPrefix()
-
getStoredProcedureTerminationToken
public String getStoredProcedureTerminationToken()
Returns the delimiter between stored procedures in multiple stored procedure calls.
-
setStoredProcedureTerminationToken
public void setStoredProcedureTerminationToken(String storedProcedureTerminationToken)
-
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:
PostgreSQLPlatform
-
isLockTimeoutException
public boolean isLockTimeoutException(DatabaseException e)
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:
OraclePlatform
-
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
public Hashtable<Class<? extends Number>,? super Number> 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
public Hashtable<Class<? extends Number>,? super Number> 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
public void printFieldIdentityClause(Writer writer) throws ValidationException
Append the receiver's field 'identity' constraint clause to a writer.- Throws:
ValidationException
-
printFieldNotNullClause
public void printFieldNotNullClause(Writer writer) throws ValidationException
Append the receiver's field 'NOT NULL' constraint clause to a writer.- Throws:
ValidationException
-
printFieldNullClause
public void printFieldNullClause(Writer writer) throws ValidationException
Append the receiver's field 'NULL' constraint clause to a writer.- Throws:
ValidationException
-
printValuelist
public int printValuelist(int[] theObjects, DatabaseCall call, Writer writer) throws IOExceptionPrint 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.
-
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.
-
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.
-
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.
-
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
public void retrieveFirstPrimaryKeyOrOne(ReportQuery subselect)
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:
SymfowarePlatform
-
rollbackTransaction
public void rollbackTransaction(DatabaseAccessor accessor) throws SQLException
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:
DB2Platform
-
setCursorCode
public void setCursorCode(int cursorCode)
ADVANCED: Set the code for preparing cursored output parameters in a stored procedure
-
setDriverName
public void setDriverName(String driverName)
During auto-detect, the driver name is set on the platform.
-
setFieldTypes
protected void setFieldTypes(Map<Class<?>,FieldTypeDefinition> theFieldTypes)
-
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
public void setSequenceCounterFieldName(String name)
-
setSequenceNameFieldName
public void setSequenceNameFieldName(String name)
-
setSequenceTableName
public void setSequenceTableName(String name)
-
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 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). 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
public void setUseJDBCStoredProcedureSyntax(Boolean useJDBCStoredProcedureSyntax)
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
public BatchWritingMechanism getBatchWritingMechanism()
Return the custom batch writing mechanism.
-
setBatchWritingMechanism
public void setBatchWritingMechanism(BatchWritingMechanism batchWritingMechanism)
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
public boolean shouldIgnoreException(SQLException exception)
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
public boolean shouldPrintInnerJoinInWhereClause(ReadQuery query)
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
public boolean shouldUseCustomModifyForCall(DatabaseField field)
Description copied from class:DatasourcePlatformUsed 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:
shouldUseCustomModifyForCallin interfacePlatform- Overrides:
shouldUseCustomModifyForCallin 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
-
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
public int executeBatch(Statement statement, boolean isStatementPrepared) throws SQLException
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
public void setPingSQL(String pingSQL)
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
public int appendParameterInternal(Call call, Writer writer, Object parameter)
Returns the number of parameters that used binding. Should only be called in case binding is not used.
-
appendBoolean
protected void appendBoolean(Boolean bool, Writer writer) throws IOException
Appends a Boolean value as a number- Throws:
IOException
-
appendByteArray
protected void appendByteArray(byte[] bytes, Writer writer) throws IOExceptionAppend 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
protected void appendDate(Date date, Writer writer) throws IOException
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
protected void appendNumber(Number number, Writer writer) throws IOException
Write number to SQL string. This is provided so that database which do not support Exponential format can customize their printing.- Throws:
IOException
-
appendLiteralToCall
public 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).- Parameters:
canBind- - allows higher up the stack (where more context exists) to tell if this literal can be bound
-
appendLiteralToCallWithBinding
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. Note that instead of null value a DatabaseField value may be passed (so that it's type could be used for binding null).
-
appendParameter
public void appendParameter(Call call, Writer writer, Object parameter)
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:
appendParameterin interfacePlatform- Overrides:
appendParameterin classDatasourcePlatform
-
appendString
protected void appendString(String string, Writer writer) throws IOException
Write the string. Quotes must be double quoted.- Throws:
IOException
-
appendTime
protected void appendTime(Time time, Writer writer) throws IOException
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
protected void appendTimestamp(Timestamp timestamp, Writer writer) throws IOException
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
protected void appendCalendar(Calendar calendar, Writer writer) throws IOException
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
protected Sequence createPlatformDefaultSequence()
INTERNAL: Create platform-default Sequence- Overrides:
createPlatformDefaultSequencein 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
protected String 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
public DatabaseTable getTempTableForTable(DatabaseTable table)
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
protected String 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
protected String getCreateTempTableSqlBodyForTable(DatabaseTable table)
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
public void writeTableCreationSuffix(Writer writer, String tableCreationSuffix) throws IOException
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
public void writeCleanUpTempTableSql(Writer writer, DatabaseTable table) throws IOException
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
public boolean shouldPrintFieldIdentityClause(AbstractSession session, String qualifiedFieldName)
-
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
protected void printFieldUnique(Writer writer) throws IOException
- 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
public boolean isXDBDocument(Object obj)
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
public Object getRefValue(Ref ref, Connection connection) throws SQLException
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
public void printStoredFunctionReturnKeyWord(Writer writer) throws IOException
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
public String buildCreateIndex(String fullTableName, String indexName, String... columnNames)
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
public String buildDropIndex(String fullTableName, String indexName)
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
public String buildDropIndex(String fullTableName, String indexName, String qualifier)
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
public void freeTemporaryObject(Object value) throws SQLException
INTERNAL: Used by some platforms during reading of ResultSet to free temporary objects.- Throws:
SQLException
-
initializeConnectionData
public void initializeConnectionData(Connection connection) throws SQLException
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
public String getConnectionUserName()
INTERNAL: Returns user name retrieved from JDBC connection.- Throws:
UnsupportedOperationException- on every single call until overridden.
-
getTableExistsQuery
protected DataReadQuery getTableExistsQuery(TableDefinition table)
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
trueif given table exists orfalseotherwise
-
getJsonPlatform
public DatabaseJsonPlatform getJsonPlatform()
Get JSON support extension instance. This instance is initialized lazily with 1st JSON support request.- Returns:
- JSON support extension instance
-
-