Class DatabasePlatform
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
- org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.lang.StringdriverNameprotected booleandriverSupportsNationalCharacterVaryingTrue if the current jdbc driver supports get/setNString methodsprotected java.util.Map<java.lang.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 java.lang.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 java.lang.BooleanprintInnerJoinInWhereClauseAllow configuration option to use Where clause joining or From clause joining.protected java.lang.BooleanprintOuterJoinInWhereClauseAllow configuration option to use Where clause outer joining or From clause joining.protected java.lang.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 java.lang.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 java.util.Map<java.lang.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 java.lang.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 java.util.Map<java.lang.Class,StructConverter>typeConvertersstatic intTypes_NCLOBstatic intTypes_SQLXMLprotected java.lang.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
-
-
Constructor Summary
Constructors Constructor Description DatabasePlatform()Creates an instance of default database platform.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intaddBatch(java.sql.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(java.lang.Boolean bool, java.io.Writer writer)Appends a Boolean value as a numberprotected voidappendByteArray(byte[] bytes, java.io.Writer writer)Append the ByteArray in ODBC literal format ({b hexString}).protected voidappendCalendar(java.util.Calendar calendar, java.io.Writer writer)Answer a platform correct string representation of a Calendar as a Timestamp, suitable for SQL generation.protected voidappendDate(java.sql.Date date, java.io.Writer writer)Answer a platform correct string representation of a Date, suitable for SQL generation.voidappendLiteralToCall(Call call, java.io.Writer writer, java.lang.Object literal, java.lang.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, java.io.Writer writer, java.lang.Object literal)INTERNAL: Override this method in case the platform needs to do something special for binding literals.protected voidappendNumber(java.lang.Number number, java.io.Writer writer)Write number to SQL string.voidappendParameter(Call call, java.io.Writer writer, java.lang.Object parameter)Write a database-friendly representation of the given parameter to the writer.intappendParameterInternal(Call call, java.io.Writer writer, java.lang.Object parameter)Returns the number of parameters that used binding.protected voidappendString(java.lang.String string, java.io.Writer writer)Write the string.protected voidappendTime(java.sql.Time time, java.io.Writer writer)Answer a platform correct string representation of a Time, suitable for SQL generation.protected voidappendTimestamp(java.sql.Timestamp timestamp, java.io.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, java.util.List<Expression> fields)INTERNAL: Return the selection criteria used to IN batch fetching.DatabaseCallbuildCallWithReturning(SQLCall sqlCall, java.util.Vector returnFields)INTERNAL Returns null unless the platform supports call with returningprotected java.util.Map<java.lang.String,java.lang.Class>buildClassTypes()Return the mapping of class types to database types for the schema framework.java.lang.StringbuildCreateIndex(java.lang.String fullTableName, java.lang.String indexName, java.lang.String... columnNames)INTERNAL: Don't override this method.java.lang.StringbuildCreateIndex(java.lang.String fullTableName, java.lang.String indexName, java.lang.String qualifier, boolean isUnique, java.lang.String... columnNames)INTERNAL: Override this method with the platform's CREATE INDEX statement.java.lang.StringbuildDropIndex(java.lang.String fullTableName, java.lang.String indexName)INTERNAL: Don't override this method.java.lang.StringbuildDropIndex(java.lang.String fullTableName, java.lang.String indexName, java.lang.String qualifier)INTERNAL: Override this method with the platform's DROP INDEX statement.protected java.util.HashtablebuildFieldTypes()Return the mapping of class types to database types for the schema framework.java.lang.StringbuildProcedureCallString(StoredProcedureCall call, AbstractSession session, AbstractRecord row)Return the proc syntax for this platform.java.io.WriterbuildSequenceObjectAlterIncrementWriter(java.io.Writer writer, java.lang.String fullSeqName, int increment)INTERNAL: Returns sql used to alter sequence object's increment in the database.java.io.WriterbuildSequenceObjectCreationWriter(java.io.Writer writer, java.lang.String fullSeqName, int increment, int start)INTERNAL: Returns sql used to create sequence object in the database.java.io.WriterbuildSequenceObjectDeletionWriter(java.io.Writer writer, java.lang.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.java.lang.ObjectconvertToDatabaseType(java.lang.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.java.sql.ArraycreateArray(java.lang.String elementDataTypeName, java.lang.Object[] elements, java.sql.Connection connection)INTERNAL: Platforms that support java.sql.Array may override this method.java.sql.ArraycreateArray(java.lang.String elementDataTypeName, java.lang.Object[] elements, AbstractSession session, java.sql.Connection connection)INTERNAL: This method builds an Array using the unwrapped connection within the sessionprotected SequencecreatePlatformDefaultSequence()INTERNAL: Create platform-default Sequencejava.sql.StructcreateStruct(java.lang.String structTypeName, java.lang.Object[] attributes, java.sql.Connection connection)INTERNAL: Platforms that support java.sql.Struct may override this method.java.sql.StructcreateStruct(java.lang.String structTypeName, java.lang.Object[] attributes, AbstractRecord row, java.util.Vector orderedFields, AbstractSession session, java.sql.Connection connection)INTERNAL: This method builds a Struct using the unwrapped connection within the sessionjava.sql.StructcreateStruct(java.lang.String structTypeName, java.lang.Object[] attributes, AbstractSession session, java.sql.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(java.sql.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.java.lang.ObjectexecuteStoredProcedure(DatabaseCall dbCall, java.sql.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(java.lang.Object value)INTERNAL: Used by some platforms during reading of ResultSet to free temporary objects.java.lang.StringgetAssignmentString()Used for stored function calls.java.lang.StringgetBatchBeginString()Used for batch writing and sp defs.java.lang.StringgetBatchDelimiterString()Used for batch writing and sp defs.java.lang.StringgetBatchEndString()Used for batch writing and sp defs.java.lang.StringgetBatchRowCountAssignString()Used for batch writing for row count return.java.lang.StringgetBatchRowCountDeclareString()Used for batch writing for row count return.java.lang.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 parametersjava.util.Map<java.lang.String,java.lang.Class>getClassTypes()Return the class type to database type mapping for the schema framework.java.sql.ConnectiongetConnection(AbstractSession session, java.sql.Connection connection)INTERNAL: This method is used to unwrap the oracle connection wrapped by the application server.java.lang.StringgetConnectionUserName()INTERNAL: Returns user name retrieved from JDBC connection.java.lang.StringgetConstraintDeletionString()Used for constraint deletion.java.lang.StringgetCreateDatabaseSchemaString(java.lang.String schema)Return the create schema SQL syntax.protected java.lang.StringgetCreateTempTableSqlBodyForTable(DatabaseTable table)INTERNAL: May override this method if the platform supports temporary tables.protected java.lang.StringgetCreateTempTableSqlPrefix()INTERNAL: Override this method if the platform supports temporary tables.protected java.lang.StringgetCreateTempTableSqlSuffix()INTERNAL: May override this method if the platform support temporary tables.java.lang.StringgetCreateViewString()/** Used for view creation.java.lang.StringgetCreationInOutputProcedureToken()This method is used to print the required output parameter token for the specific platform.java.lang.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 procedurejava.lang.ObjectgetCustomModifyValueForCall(Call call, java.lang.Object value, DatabaseField field, boolean shouldBind)This method determines if any special processing needs to occur prior to writing a field.java.lang.StringgetDefaultSequenceTableName()Returns the table name used by TableSequence by default.booleangetDriverSupportsNVarChar()java.lang.StringgetDropCascadeString()Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.java.lang.StringgetDropDatabaseSchemaString(java.lang.String schema)Return the drop schema SQL syntax.FieldTypeDefinitiongetFieldTypeDefinition(java.lang.Class javaClass)Return the field type object describing this databases platform specific representation of the Java primitive class name.java.util.Map<java.lang.Class,FieldTypeDefinition>getFieldTypes()Return the class type to database type mappings for the schema framework.java.lang.StringgetFunctionCallHeader()Used for stored function calls.java.lang.StringgetIdentifierQuoteCharacter()Deprecated.java.lang.StringgetIndexNamePrefix(boolean isUniqueSetOnField)Used to allow platforms to define their own index prefixesjava.lang.StringgetInOutputProcedureToken()This method is used to print the output parameter token when stored procedures are calledjava.lang.StringgetInputProcedureToken()Used for stored procedure creation: Prefix for INPUT parameters.java.lang.StringgetJDBCOuterJoinString()Returns the JDBC outer join operator for SELECT statements.intgetJDBCType(java.lang.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.setNulljava.lang.StringgetJdbcTypeName(int jdbcType)INTERNAL: Returns the type name corresponding to the jdbc typeintgetMaxBatchWritingSize()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.java.lang.StringgetNoWaitString()This syntax does no wait on the lock.java.lang.ObjectgetObjectFromResultSet(java.sql.ResultSet resultSet, int columnNumber, int type, AbstractSession session)INTERNAL: Get the object from the JDBC Result set.java.lang.StringgetOutputProcedureToken()This method is used to print the output parameter token when stored procedures are calledjava.lang.ObjectgetParameterValueFromDatabaseCall(java.sql.CallableStatement statement, int index, AbstractSession session)INTERNAL Get the parameter from the JDBC statement with the given index.java.lang.ObjectgetParameterValueFromDatabaseCall(java.sql.CallableStatement statement, java.lang.String name, AbstractSession session)INTERNAL Get the parameter from the JDBC statement with the given name.DataPartitioningCallbackgetPartitioningCallback()Return callback.java.lang.StringgetPingSQL()Used for determining if an SQL exception was communication based.java.lang.StringgetProcedureArgument(java.lang.String name, java.lang.Object parameter, java.lang.Integer parameterType, StoredProcedureCall call, AbstractSession session)Deprecated.java.lang.StringgetProcedureArgument(java.lang.String name, java.lang.Object parameter, DatasourceCall.ParameterType parameterType, StoredProcedureCall call, AbstractSession session)Obtain the platform specific argument stringjava.lang.StringgetProcedureArgumentString()Used for sp defs.java.lang.StringgetProcedureAsString()Used for stored procedure defs.java.lang.StringgetProcedureBeginString()Used for stored procedure defs.java.lang.StringgetProcedureCallHeader()Used for sp calls.java.lang.StringgetProcedureCallTail()Used for sp calls.java.lang.StringgetProcedureEndString()Used for stored procedure defs.java.lang.StringgetProcedureOptionList()Some platforms have an option list Only to be used for stored procedure creation.java.lang.StringgetQualifiedName(java.lang.String name)java.lang.StringgetQualifiedSequenceTableName()java.lang.ObjectgetRefValue(java.sql.Ref ref, java.sql.Connection connection)INTERNAL: Platforms that support java.sql.Ref may override this method.java.lang.ObjectgetRefValue(java.sql.Ref ref, AbstractSession executionSession, java.sql.Connection connection)INTERNAL: This method builds a REF using the unwrapped connection within the sessionjava.lang.StringgetSelectForUpdateNoWaitString()This syntax does no wait on the lock.java.lang.StringgetSelectForUpdateOfString()For fine-grained pessimistic locking the column names can be specified individually.java.lang.StringgetSelectForUpdateString()Most database support a syntax.java.lang.StringgetSelectForUpdateWaitString(java.lang.Integer waitTimeout)Platforms that support the WAIT option should override this method.java.lang.StringgetSequenceCounterFieldName()java.lang.StringgetSequenceNameFieldName()intgetSequencePreallocationSize()java.lang.StringgetSequenceTableName()intgetStatementCacheSize()The statement cache size for prepare parameterized statements.java.lang.StringgetStoredProcedureParameterPrefix()java.lang.StringgetStoredProcedureTerminationToken()Returns the delimiter between stored procedures in multiple stored procedure calls.intgetStringBindingSize()java.util.Map<java.lang.String,StructConverter>getStructConverters()INTERNAL: Get the map of StructConverters that will be used to preprocess STRUCT data as it is readjava.lang.StringgetTableCreationSuffix()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.java.util.Map<java.lang.Class,StructConverter>getTypeConverters()INTERNAL: Get the map of TypeConverters This map indexes StructConverters by the Java Class they are meant to convertjava.lang.StringgetUniqueConstraintDeletionString()Used for constraint deletion.booleangetUseNationalCharacterVaryingTypeForString()DatabaseQuerygetVPDClearIdentifierQuery(java.lang.String vpdIdentifier)Any platform that supports VPD should implement this method.java.lang.StringgetVPDCreationFunctionString(java.lang.String tableName, java.lang.String tenantFieldName)Any platform that supports VPD should implement this method.java.lang.StringgetVPDCreationPolicyString(java.lang.String tableName, AbstractSession session)Any platform that supports VPD should implement this method.java.lang.StringgetVPDDeletionString(java.lang.String tableName, AbstractSession session)Any platform that supports VPD should implement this method.DatabaseQuerygetVPDSetIdentifierQuery(java.lang.String vpdIdentifier)Any platform that supports VPD should implement this method.booleanhasPartitioningCallback()Check if has callback.voidinitialize()Initialize operators to avoid concurrency issues.voidinitializeConnectionData(java.sql.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(java.lang.Object obj)INTERNAL: Indicates whether the passed object is an instance of XDBDocument.java.util.HashtablemaximumNumericValues()Builds a table of maximum numeric values keyed on java class.java.util.HashtableminimumNumericValues()Builds a table of minimum numeric values keyed on java class.longminimumTimeIncrement()INTERNAL: Returns the minimum time increment supported by the platform.java.sql.StatementprepareBatchStatement(java.sql.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(java.io.Writer writer)Append the receiver's field 'identity' constraint clause to a writer.voidprintFieldNotNullClause(java.io.Writer writer)Append the receiver's field 'NOT NULL' constraint clause to a writer.voidprintFieldNullClause(java.io.Writer writer)Append the receiver's field 'NULL' constraint clause to a writer.protected voidprintFieldTypeSize(java.io.Writer writer, FieldDefinition field, FieldTypeDefinition fieldType)voidprintFieldTypeSize(java.io.Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause)protected voidprintFieldUnique(java.io.Writer writer)voidprintFieldUnique(java.io.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(java.io.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, java.io.Writer writer)Print the int array on the writer.intprintValuelist(java.util.Collection theObjects, DatabaseCall call, java.io.Writer writer)voidregisterOutputParameter(java.sql.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(java.sql.CallableStatement statement, int parameterIndex, int sqlType, java.lang.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(java.sql.CallableStatement statement, java.lang.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(java.sql.CallableStatement statement, java.lang.String parameterName, int sqlType, java.lang.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(java.util.Hashtable classTypes)voidsetCursorCode(int cursorCode)ADVANCED: Set the code for preparing cursored output parameters in a stored procedurevoidsetDriverName(java.lang.String driverName)During auto-detect, the driver name is set on the platform.voidsetDriverSupportsNVarChar(boolean b)protected voidsetFieldTypes(java.util.Hashtable 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, java.sql.CallableStatement statement, java.lang.String name)protected voidsetNullFromDatabaseField(DatabaseField databaseField, java.sql.PreparedStatement statement, int index)voidsetParameterValueInDatabaseCall(java.lang.Object parameter, java.sql.CallableStatement statement, java.lang.String name, AbstractSession session)INTERNAL Set the parameter in the JDBC statement with the given name.voidsetParameterValueInDatabaseCall(java.lang.Object parameter, java.sql.PreparedStatement statement, int index, AbstractSession session)INTERNAL Set the parameter in the JDBC statement at the given index.voidsetPartitioningCallback(DataPartitioningCallback partitioningCallback)Set callback.voidsetPingSQL(java.lang.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(java.lang.String name)voidsetSequenceNameFieldName(java.lang.String name)voidsetSequenceTableName(java.lang.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(java.lang.String storedProcedureTerminationToken)voidsetStringBindingSize(int aSize)voidsetSupportsAutoCommit(boolean supportsAutoCommit)supportsAutoCommit can be set to false for JDBC drivers which do not support autocommit.voidsetTableCreationSuffix(java.lang.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(java.lang.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(java.sql.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, java.lang.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(java.sql.SQLException exception, java.sql.Connection connection, AbstractSession sessionForProfile)voidwriteAddColumnClause(java.io.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(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection fields, DatasourcePlatform platform)INTERNAL: helper method, don't override.protected static voidwriteAutoJoinWhereClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection pkFields, DatasourcePlatform platform)INTERNAL: helper method, don't override.voidwriteCleanUpTempTableSql(java.io.Writer writer, DatabaseTable table)INTERNAL: Don't override this method.voidwriteCreateTempTableSql(java.io.Writer writer, DatabaseTable table, AbstractSession session, java.util.Collection pkFields, java.util.Collection usedFields, java.util.Collection allFields)INTERNAL: Don't override this method.voidwriteDeleteFromTargetTableUsingTempTableSql(java.io.Writer writer, DatabaseTable table, DatabaseTable targetTable, java.util.Collection pkFields, java.util.Collection targetPkFields, DatasourcePlatform platform)INTERNAL: Write an sql string for deletion from target table using temporary table.protected static voidwriteFields(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection fields1, java.util.Collection fields2, java.lang.String separator, DatasourcePlatform platform)INTERNAL: helper method, don't override.protected static voidwriteFieldsAutoClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection fields, java.lang.String separator, DatasourcePlatform platform)INTERNAL: helper method, don't override.protected static voidwriteFieldsList(java.io.Writer writer, java.util.Collection fields, DatasourcePlatform platform)INTERNAL: helper method, don't override.voidwriteInsertIntoTableSql(java.io.Writer writer, DatabaseTable table, java.util.Collection usedFields)INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work.protected static voidwriteJoinWhereClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection pkFields1, java.util.Collection pkFields2, DatasourcePlatform platform)INTERNAL: helper method, don't override.voidwriteLOB(DatabaseField field, java.lang.Object value, java.sql.ResultSet resultSet, AbstractSession session)INTERNAL: Write LOB value - only on Oracle8 and upvoidwriteParameterMarker(java.io.Writer writer, ParameterExpression expression, AbstractRecord record, DatabaseCall call)voidwriteTableCreationSuffix(java.io.Writer writer, java.lang.String tableCreationSuffix)INTERNAL: Write used on all table creation statements generated from the DefaultTableGenerator with a session using this project (DDL generation).voidwriteUpdateOriginalFromTempTableSql(java.io.Writer writer, DatabaseTable table, java.util.Collection pkFields, java.util.Collection assignedFields)INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work.-
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, getEndDelimiter, getINClauseLimit, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getTimestampQuery, getUpdateSequenceQuery, hasDefaultSequence, initializeDefaultQueries, initializePlatformOperators, isAccess, isAttunity, isCloudscape, isDB2, isDB2Z, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMaxDB, isMySQL, isODBC, isOracle, isOracle9, isPervasive, isPointBase, isPostgreSQL, isSQLAnywhere, isSQLServer, isSybase, isSymfoware, isTimesTen, isTimesTen7, removeAllSequences, removeSequence, sequencesAfterCloneCleanup, setConversionManager, setDefaultNativeSequenceToTable, setDefaultSeqenceAtNextValue, setDefaultSequence, setEndDelimiter, setSelectSequenceNumberQuery, setSequencePreallocationSize, setSequences, setStartDelimiter, setSupportsReturnGeneratedKeys, setTableQualifier, setTimestampQuery, setUpdateSequenceQuery, shouldNativeSequenceUseTransaction, shouldPrepare, shouldSelectDistinctIncludeOrderBy, shouldSelectIncludeOrderBy, supportsIdentity, supportsNativeSequenceNumbers, supportsReturnGeneratedKeys, supportsSequenceObjects, toString, usesPlatformDefaultSequence
-
-
-
-
Field Detail
-
fieldTypes
protected transient java.util.Map<java.lang.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 java.lang.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 java.lang.Boolean printOuterJoinInWhereClause
Allow configuration option to use Where clause outer joining or From clause joining.
-
printInnerJoinInWhereClause
protected java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.lang.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 java.util.Map<java.lang.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 java.util.Map<java.lang.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.
-
Types_NCLOB
public static final int Types_NCLOB
- See Also:
- Constant Field Values
-
Types_SQLXML
public static final int Types_SQLXML
- See Also:
- Constant Field Values
-
tableCreationSuffix
protected java.lang.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 java.lang.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 java.lang.Boolean useJDBCStoredProcedureSyntax
-
driverName
protected java.lang.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 java.util.Map<java.lang.String,StructConverter> getStructConverters()
INTERNAL: Get the map of StructConverters that will be used to preprocess STRUCT data as it is read
-
getTableCreationSuffix
public java.lang.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 java.util.Map<java.lang.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- Parameters:
converter-
-
addBatch
public int addBatch(java.sql.PreparedStatement statement) throws java.sql.SQLExceptionINTERNAL: 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:
java.sql.SQLException
-
allowsSizeInProcedureArguments
public boolean allowsSizeInProcedureArguments()
Used for stored procedure definitions.
-
appendBoolean
protected void appendBoolean(java.lang.Boolean bool, java.io.Writer writer) throws java.io.IOExceptionAppends a Boolean value as a number- Throws:
java.io.IOException
-
appendByteArray
protected void appendByteArray(byte[] bytes, java.io.Writer writer) throws java.io.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:
java.io.IOException
-
appendDate
protected void appendDate(java.sql.Date date, java.io.Writer writer) throws java.io.IOExceptionAnswer 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:
java.io.IOException
-
appendNumber
protected void appendNumber(java.lang.Number number, java.io.Writer writer) throws java.io.IOExceptionWrite number to SQL string. This is provided so that database which do not support Exponential format can customize their printing.- Throws:
java.io.IOException
-
appendLiteralToCall
public void appendLiteralToCall(Call call, java.io.Writer writer, java.lang.Object literal, java.lang.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).
-
appendLiteralToCallWithBinding
protected void appendLiteralToCallWithBinding(Call call, java.io.Writer writer, java.lang.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, java.io.Writer writer, java.lang.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
-
appendParameterInternal
public int appendParameterInternal(Call call, java.io.Writer writer, java.lang.Object parameter)
Returns the number of parameters that used binding. Should only be called in case binding is not used.
-
appendString
protected void appendString(java.lang.String string, java.io.Writer writer) throws java.io.IOExceptionWrite the string. Quotes must be double quoted.- Throws:
java.io.IOException
-
appendTime
protected void appendTime(java.sql.Time time, java.io.Writer writer) throws java.io.IOExceptionAnswer 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:
java.io.IOException
-
appendTimestamp
protected void appendTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer) throws java.io.IOExceptionAnswer 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:
java.io.IOException
-
appendCalendar
protected void appendCalendar(java.util.Calendar calendar, java.io.Writer writer) throws java.io.IOExceptionAnswer 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:
java.io.IOException
-
autoCommit
public void autoCommit(DatabaseAccessor accessor) throws java.sql.SQLException
Used by JDBC drivers that do not support autocommit so simulate an autocommit.- Throws:
java.sql.SQLException
-
beginTransaction
public void beginTransaction(DatabaseAccessor accessor) throws java.sql.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:
java.sql.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, java.util.List<Expression> fields)
INTERNAL: Return the selection criteria used to IN batch fetching.
-
buildCallWithReturning
public DatabaseCall buildCallWithReturning(SQLCall sqlCall, java.util.Vector returnFields)
INTERNAL Returns null unless the platform supports call with returning
-
buildClassTypes
protected java.util.Map<java.lang.String,java.lang.Class> buildClassTypes()
Return the mapping of class types to database types for the schema framework.
-
buildFieldTypes
protected java.util.Hashtable 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 java.lang.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- Parameters:
readQuery-firstResultIndex-maxResults-- See Also:
MySQLPlatform
-
commitTransaction
public void commitTransaction(DatabaseAccessor accessor) throws java.sql.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:
java.sql.SQLException
-
getVPDClearIdentifierQuery
public DatabaseQuery getVPDClearIdentifierQuery(java.lang.String vpdIdentifier)
Any platform that supports VPD should implement this method.
-
getVPDCreationFunctionString
public java.lang.String getVPDCreationFunctionString(java.lang.String tableName, java.lang.String tenantFieldName)Any platform that supports VPD should implement this method. Used for DDL generation.
-
getVPDCreationPolicyString
public java.lang.String getVPDCreationPolicyString(java.lang.String tableName, AbstractSession session)Any platform that supports VPD should implement this method. Used for DDL generation.
-
getVPDDeletionString
public java.lang.String getVPDDeletionString(java.lang.String tableName, AbstractSession session)Any platform that supports VPD should implement this method. Used for DDL generation.
-
getVPDSetIdentifierQuery
public DatabaseQuery getVPDSetIdentifierQuery(java.lang.String vpdIdentifier)
Any platform that supports VPD should implement this method.
-
convertToDatabaseType
public java.lang.Object convertToDatabaseType(java.lang.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 java.lang.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 java.lang.String getBatchRowCountDeclareString()
Used for batch writing for row count return.
-
getBatchRowCountAssignString
public java.lang.String getBatchRowCountAssignString()
Used for batch writing for row count return.
-
getBatchRowCountReturnString
public java.lang.String getBatchRowCountReturnString()
Used for batch writing for row count return.
-
getBatchDelimiterString
public java.lang.String getBatchDelimiterString()
Used for batch writing and sp defs.
-
getBatchEndString
public java.lang.String getBatchEndString()
Used for batch writing and sp defs.
-
getConnection
public java.sql.Connection getConnection(AbstractSession session, java.sql.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 java.lang.String getConstraintDeletionString()
Used for constraint deletion.
-
getUniqueConstraintDeletionString
public java.lang.String getUniqueConstraintDeletionString()
Used for constraint deletion.
-
getCreateViewString
public java.lang.String getCreateViewString()
/** Used for view creation.
-
getDropCascadeString
public java.lang.String getDropCascadeString()
Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.
-
getCustomModifyValueForCall
public java.lang.Object getCustomModifyValueForCall(Call call, java.lang.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 java.lang.String getProcedureEndString()
Used for stored procedure defs.
-
getProcedureBeginString
public java.lang.String getProcedureBeginString()
Used for stored procedure defs.
-
getProcedureAsString
public java.lang.String getProcedureAsString()
Used for stored procedure defs.
-
getProcedureOptionList
public java.lang.String getProcedureOptionList()
Some platforms have an option list Only to be used for stored procedure creation.- See Also:
StoredProcedureDefinition
-
getClassTypes
public java.util.Map<java.lang.String,java.lang.Class> getClassTypes()
Return the class type to database type mapping for the schema framework.
-
getAssignmentString
public java.lang.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 java.lang.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 java.lang.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 java.lang.String getDefaultSequenceTableName()
Returns the table name used by TableSequence by default.
-
getCreateDatabaseSchemaString
public java.lang.String getCreateDatabaseSchemaString(java.lang.String schema)
Return the create schema SQL syntax. Subclasses should override as needed.
-
getDropDatabaseSchemaString
public java.lang.String getDropDatabaseSchemaString(java.lang.String schema)
Return the drop schema SQL syntax. Subclasses should override as needed.
-
getFieldTypeDefinition
public FieldTypeDefinition getFieldTypeDefinition(java.lang.Class javaClass)
Return the field type object describing this databases platform specific representation of the Java primitive class name.
-
getFieldTypes
public java.util.Map<java.lang.Class,FieldTypeDefinition> getFieldTypes()
Return the class type to database type mappings for the schema framework.
-
getFunctionCallHeader
public java.lang.String getFunctionCallHeader()
Used for stored function calls.
-
getIdentifierQuoteCharacter
@Deprecated public java.lang.String getIdentifierQuoteCharacter()
Deprecated.INTERNAL: Returns the correct quote character to use around SQL Identifiers that contain Space characters- Overrides:
getIdentifierQuoteCharacterin classDatasourcePlatform- Returns:
- The quote character for this platform
- See Also:
DatasourcePlatform.getStartDelimiter(),DatasourcePlatform.getEndDelimiter()
-
getInOutputProcedureToken
public java.lang.String getInOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called
-
getJDBCOuterJoinString
public java.lang.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(java.lang.Class javaType)
Return the JDBC type for the Java type.
-
getJdbcTypeName
public java.lang.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 java.lang.Object getObjectFromResultSet(java.sql.ResultSet resultSet, int columnNumber, int type, AbstractSession session) throws java.sql.SQLExceptionINTERNAL: Get the object from the JDBC Result set. Added to allow other platforms to override.- Throws:
java.sql.SQLException- See Also:
org.eclipse.persistence.oraclespecific.Oracle9Platform
-
getInputProcedureToken
public java.lang.String getInputProcedureToken()
Used for stored procedure creation: Prefix for INPUT parameters. Not required on most platforms.
-
getIndexNamePrefix
public java.lang.String getIndexNamePrefix(boolean isUniqueSetOnField)
Used to allow platforms to define their own index prefixes- Parameters:
isUniqueField-- Returns:
-
getOutputProcedureToken
public java.lang.String getOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called
-
getPingSQL
public java.lang.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 java.lang.String getProcedureArgumentString()
Used for sp defs.
-
getProcedureArgument
@Deprecated public java.lang.String getProcedureArgument(java.lang.String name, java.lang.Object parameter, java.lang.Integer parameterType, StoredProcedureCall call, AbstractSession session)Deprecated.Obtain the platform specific argument string
-
getProcedureArgument
public java.lang.String getProcedureArgument(java.lang.String name, java.lang.Object parameter, DatasourceCall.ParameterType parameterType, StoredProcedureCall call, AbstractSession session)Obtain the platform specific argument string
-
getProcedureCallHeader
public java.lang.String getProcedureCallHeader()
Used for sp calls.
-
getProcedureCallTail
public java.lang.String getProcedureCallTail()
Used for sp calls.
-
getQualifiedSequenceTableName
public java.lang.String getQualifiedSequenceTableName()
-
getQualifiedName
public java.lang.String getQualifiedName(java.lang.String name)
-
getNoWaitString
public java.lang.String getNoWaitString()
This syntax does no wait on the lock. (i.e. In Oracle adding NOWAIT to the end will accomplish this)
-
getSelectForUpdateNoWaitString
public java.lang.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 java.lang.String getSelectForUpdateOfString()
For fine-grained pessimistic locking the column names can be specified individually.
-
getSelectForUpdateString
public java.lang.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 java.lang.String getSelectForUpdateWaitString(java.lang.Integer waitTimeout)
Platforms that support the WAIT option should override this method. By default the wait timeout is ignored.- See Also:
supportsWaitForUpdate()
-
getSequenceCounterFieldName
public java.lang.String getSequenceCounterFieldName()
-
getSequenceNameFieldName
public java.lang.String getSequenceNameFieldName()
-
getSequencePreallocationSize
public int getSequencePreallocationSize()
- Overrides:
getSequencePreallocationSizein classDatasourcePlatform
-
getSequenceTableName
public java.lang.String getSequenceTableName()
-
getStatementCacheSize
public int getStatementCacheSize()
The statement cache size for prepare parameterized statements.
-
getStoredProcedureParameterPrefix
public java.lang.String getStoredProcedureParameterPrefix()
-
getStoredProcedureTerminationToken
public java.lang.String getStoredProcedureTerminationToken()
Returns the delimiter between stored procedures in multiple stored procedure calls.
-
setStoredProcedureTerminationToken
public void setStoredProcedureTerminationToken(java.lang.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.
-
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 java.util.Hashtable 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 java.util.Hashtable 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 java.sql.Statement prepareBatchStatement(java.sql.Statement statement, int maxBatchWritingSize) throws java.sql.SQLExceptionInternal: 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:
java.sql.SQLException
-
printFieldIdentityClause
public void printFieldIdentityClause(java.io.Writer writer) throws ValidationExceptionAppend the receiver's field 'identity' constraint clause to a writer.- Throws:
ValidationException
-
printFieldNotNullClause
public void printFieldNotNullClause(java.io.Writer writer) throws ValidationExceptionAppend the receiver's field 'NOT NULL' constraint clause to a writer.- Throws:
ValidationException
-
printFieldNullClause
public void printFieldNullClause(java.io.Writer writer) throws ValidationExceptionAppend the receiver's field 'NULL' constraint clause to a writer.- Throws:
ValidationException
-
printValuelist
public int printValuelist(int[] theObjects, DatabaseCall call, java.io.Writer writer) throws java.io.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:
java.io.IOException
-
printValuelist
public int printValuelist(java.util.Collection theObjects, DatabaseCall call, java.io.Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
registerOutputParameter
public void registerOutputParameter(java.sql.CallableStatement statement, int parameterIndex, int sqlType) throws java.sql.SQLExceptionThis method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
java.sql.SQLException- See Also:
CallableStatement.registerOutParameter(int parameterIndex, int sqlType)
-
registerOutputParameter
public void registerOutputParameter(java.sql.CallableStatement statement, int parameterIndex, int sqlType, java.lang.String typeName) throws java.sql.SQLExceptionThis method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
java.sql.SQLException- See Also:
CallableStatement.registerOutParameter(int parameterIndex, int sqlType, String typeName)
-
registerOutputParameter
public void registerOutputParameter(java.sql.CallableStatement statement, java.lang.String parameterName, int sqlType) throws java.sql.SQLExceptionThis method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
java.sql.SQLException- See Also:
CallableStatement.registerOutParameter(String parameterName, int sqlType)
-
registerOutputParameter
public void registerOutputParameter(java.sql.CallableStatement statement, java.lang.String parameterName, int sqlType, java.lang.String typeName) throws java.sql.SQLExceptionThis method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.- Throws:
java.sql.SQLException- See Also:
CallableStatement.registerOutParameter(String parameterName, int sqlType, String typeName)
-
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- Parameters:
subselect-- See Also:
SymfowarePlatform
-
rollbackTransaction
public void rollbackTransaction(DatabaseAccessor accessor) throws java.sql.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:
java.sql.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
-
setClassTypes
protected void setClassTypes(java.util.Hashtable classTypes)
-
setCursorCode
public void setCursorCode(int cursorCode)
ADVANCED: Set the code for preparing cursored output parameters in a stored procedure
-
setDriverName
public void setDriverName(java.lang.String driverName)
During auto-detect, the driver name is set on the platform.
-
setFieldTypes
protected void setFieldTypes(java.util.Hashtable 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(java.lang.String name)
-
setSequenceNameFieldName
public void setSequenceNameFieldName(java.lang.String name)
-
setSequenceTableName
public void setSequenceTableName(java.lang.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(java.lang.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(java.lang.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(java.sql.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(java.sql.Statement statement, boolean isStatementPrepared) throws java.sql.SQLExceptionInternal: 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:
java.sql.SQLException
-
executeStoredProcedure
public java.lang.Object executeStoredProcedure(DatabaseCall dbCall, java.sql.PreparedStatement statement, DatabaseAccessor accessor, AbstractSession session) throws java.sql.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:
java.sql.SQLException
-
setPingSQL
public void setPingSQL(java.lang.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(java.lang.Object parameter, java.sql.PreparedStatement statement, int index, AbstractSession session) throws java.sql.SQLExceptionINTERNAL 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:
java.sql.SQLException
-
setParameterValueInDatabaseCall
public void setParameterValueInDatabaseCall(java.lang.Object parameter, java.sql.CallableStatement statement, java.lang.String name, AbstractSession session) throws java.sql.SQLExceptionINTERNAL 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:
java.sql.SQLException
-
setNullFromDatabaseField
protected void setNullFromDatabaseField(DatabaseField databaseField, java.sql.PreparedStatement statement, int index) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setNullFromDatabaseField
protected void setNullFromDatabaseField(DatabaseField databaseField, java.sql.CallableStatement statement, java.lang.String name) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getParameterValueFromDatabaseCall
public java.lang.Object getParameterValueFromDatabaseCall(java.sql.CallableStatement statement, int index, AbstractSession session) throws java.sql.SQLExceptionINTERNAL Get the parameter from the JDBC statement with the given index.- Parameters:
index- - 1-based index in the argument list- Throws:
java.sql.SQLException
-
getParameterValueFromDatabaseCall
public java.lang.Object getParameterValueFromDatabaseCall(java.sql.CallableStatement statement, java.lang.String name, AbstractSession session) throws java.sql.SQLExceptionINTERNAL Get the parameter from the JDBC statement with the given name.- Throws:
java.sql.SQLException
-
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, java.lang.Object value, java.sql.ResultSet resultSet, AbstractSession session) throws java.sql.SQLException
INTERNAL: Write LOB value - only on Oracle8 and up- Throws:
java.sql.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 java.lang.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.- Returns:
- DatabaseTable temorary table
-
getCreateTempTableSqlSuffix
protected java.lang.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 java.lang.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();
-
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(java.io.Writer writer, DatabaseTable table, AbstractSession session, java.util.Collection pkFields, java.util.Collection usedFields, java.util.Collection allFields) throws java.io.IOExceptionINTERNAL: 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- Throws:
java.io.IOException
-
writeInsertIntoTableSql
public void writeInsertIntoTableSql(java.io.Writer writer, DatabaseTable table, java.util.Collection usedFields) throws java.io.IOExceptionINTERNAL: 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.- Throws:
java.io.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(java.io.Writer writer, java.lang.String tableCreationSuffix) throws java.io.IOExceptionINTERNAL: 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:
java.io.IOException
-
writeUpdateOriginalFromTempTableSql
public void writeUpdateOriginalFromTempTableSql(java.io.Writer writer, DatabaseTable table, java.util.Collection pkFields, java.util.Collection assignedFields) throws java.io.IOExceptionINTERNAL: 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.- Throws:
java.io.IOException
-
writeDeleteFromTargetTableUsingTempTableSql
public void writeDeleteFromTargetTableUsingTempTableSql(java.io.Writer writer, DatabaseTable table, DatabaseTable targetTable, java.util.Collection pkFields, java.util.Collection targetPkFields, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: 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.- Throws:
java.io.IOException
-
wasFailureCommunicationBased
public boolean wasFailureCommunicationBased(java.sql.SQLException exception, java.sql.Connection connection, AbstractSession sessionForProfile)
-
writeCleanUpTempTableSql
public void writeCleanUpTempTableSql(java.io.Writer writer, DatabaseTable table) throws java.io.IOExceptionINTERNAL: 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.- Throws:
java.io.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(java.io.Writer writer, java.util.Collection fields, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: helper method, don't override.- Throws:
java.io.IOException
-
writeAutoAssignmentSetClause
protected static void writeAutoAssignmentSetClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection fields, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: helper method, don't override.- Throws:
java.io.IOException
-
writeAutoJoinWhereClause
protected static void writeAutoJoinWhereClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection pkFields, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: helper method, don't override.- Throws:
java.io.IOException
-
writeFieldsAutoClause
protected static void writeFieldsAutoClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection fields, java.lang.String separator, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: helper method, don't override.- Throws:
java.io.IOException
-
writeJoinWhereClause
protected static void writeJoinWhereClause(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection pkFields1, java.util.Collection pkFields2, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: helper method, don't override.- Throws:
java.io.IOException
-
writeFields
protected static void writeFields(java.io.Writer writer, java.lang.String tableName1, java.lang.String tableName2, java.util.Collection fields1, java.util.Collection fields2, java.lang.String separator, DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: helper method, don't override.- Throws:
java.io.IOException
-
shouldPrintFieldIdentityClause
public boolean shouldPrintFieldIdentityClause(AbstractSession session, java.lang.String qualifiedFieldName)
-
printFieldTypeSize
public void printFieldTypeSize(java.io.Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause) throws java.io.IOException- Throws:
java.io.IOException
-
printFieldTypeSize
protected void printFieldTypeSize(java.io.Writer writer, FieldDefinition field, FieldTypeDefinition fieldType) throws java.io.IOException- Throws:
java.io.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(java.io.Writer writer, boolean shouldPrintFieldIdentityClause) throws java.io.IOException- Throws:
java.io.IOException
-
printFieldUnique
protected void printFieldUnique(java.io.Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeParameterMarker
public void writeParameterMarker(java.io.Writer writer, ParameterExpression expression, AbstractRecord record, DatabaseCall call) throws java.io.IOException- Throws:
java.io.IOException
-
createArray
public java.sql.Array createArray(java.lang.String elementDataTypeName, java.lang.Object[] elements, AbstractSession session, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: This method builds an Array using the unwrapped connection within the session- Returns:
- Array
- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String structTypeName, java.lang.Object[] attributes, AbstractSession session, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: This method builds a Struct using the unwrapped connection within the session- Returns:
- Struct
- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String structTypeName, java.lang.Object[] attributes, AbstractRecord row, java.util.Vector orderedFields, AbstractSession session, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: This method builds a Struct using the unwrapped connection within the session- Returns:
- Struct
- Throws:
java.sql.SQLException
-
createArray
public java.sql.Array createArray(java.lang.String elementDataTypeName, java.lang.Object[] elements, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: Platforms that support java.sql.Array may override this method.- Returns:
- Array
- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String structTypeName, java.lang.Object[] attributes, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: Platforms that support java.sql.Struct may override this method.- Returns:
- Struct
- Throws:
java.sql.SQLException
-
isXDBDocument
public boolean isXDBDocument(java.lang.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 java.lang.Object getRefValue(java.sql.Ref ref, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: Platforms that support java.sql.Ref may override this method.- Returns:
- Object
- Throws:
java.sql.SQLException
-
getRefValue
public java.lang.Object getRefValue(java.sql.Ref ref, AbstractSession executionSession, java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: This method builds a REF using the unwrapped connection within the session- Returns:
- Object
- Throws:
java.sql.SQLException
-
printStoredFunctionReturnKeyWord
public void printStoredFunctionReturnKeyWord(java.io.Writer writer) throws java.io.IOExceptionINTERNAL: 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:
java.io.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 java.lang.String buildCreateIndex(java.lang.String fullTableName, java.lang.String indexName, java.lang.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 java.lang.String buildCreateIndex(java.lang.String fullTableName, java.lang.String indexName, java.lang.String qualifier, boolean isUnique, java.lang.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 java.lang.String buildDropIndex(java.lang.String fullTableName, java.lang.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 java.lang.String buildDropIndex(java.lang.String fullTableName, java.lang.String indexName, java.lang.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 java.io.Writer buildSequenceObjectCreationWriter(java.io.Writer writer, java.lang.String fullSeqName, int increment, int start) throws java.io.IOExceptionINTERNAL: Returns sql used to create sequence object in the database.- Throws:
java.io.IOException
-
buildSequenceObjectDeletionWriter
public java.io.Writer buildSequenceObjectDeletionWriter(java.io.Writer writer, java.lang.String fullSeqName) throws java.io.IOExceptionINTERNAL: Returns sql used to delete sequence object from the database.- Throws:
java.io.IOException
-
buildSequenceObjectAlterIncrementWriter
public java.io.Writer buildSequenceObjectAlterIncrementWriter(java.io.Writer writer, java.lang.String fullSeqName, int increment) throws java.io.IOExceptionINTERNAL: Returns sql used to alter sequence object's increment in the database.- Throws:
java.io.IOException
-
isAlterSequenceObjectSupported
public boolean isAlterSequenceObjectSupported()
INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.
-
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(java.lang.Object value) throws java.sql.SQLExceptionINTERNAL: Used by some platforms during reading of ResultSet to free temporary objects.- Throws:
java.sql.SQLException
-
initializeConnectionData
public void initializeConnectionData(java.sql.Connection connection) throws java.sql.SQLExceptionINTERNAL: Allow initialization from the connection.- Throws:
java.sql.SQLException
-
writeAddColumnClause
public void writeAddColumnClause(java.io.Writer writer, AbstractSession session, TableDefinition table, FieldDefinition field) throws java.io.IOExceptionINTERNAL: 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:
java.io.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 java.lang.String getConnectionUserName()
INTERNAL: Returns user name retrieved from JDBC connection.- Throws:
java.lang.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
-
-