Class MySQLPlatform
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
- org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
- org.eclipse.persistence.platform.database.DatabasePlatform
-
- org.eclipse.persistence.platform.database.MySQLPlatform
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.eclipse.persistence.internal.core.databaseaccess.CorePlatform<org.eclipse.persistence.internal.helper.ConversionManager>,org.eclipse.persistence.internal.databaseaccess.Platform
public class MySQLPlatform extends DatabasePlatform
Purpose: Provides MySQL specific behavior.
Responsibilities:
- Native SQL for Date, Time, & Timestamp.
- Native sequencing.
- Mapping of class types to database types for the schema framework.
- Pessimistic locking.
- Platform specific operators.
- See Also:
- Serialized Form
- Since:
- OracleAS TopLink 10g (10.1.3)
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.platform.database.DatabasePlatform
DEFAULT_VARCHAR_SIZE
-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
batchWritingMechanism, castSizeForVarcharParameter, classTypes, cursorCode, DEFAULT_MAX_BATCH_WRITING_SIZE, DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE, driverName, driverSupportsNationalCharacterVarying, fieldTypes, IS_VALID_TIMEOUT, isCastRequired, maxBatchWritingSize, partitioningCallback, pingSQL, printInnerJoinInWhereClause, printOuterJoinInWhereClause, shouldBindAllParameters, shouldBindLiterals, shouldBindPartialParameters, shouldCacheAllStatements, shouldCreateIndicesOnForeignKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, storedProcedureTerminationToken, stringBindingSize, structConverters, supportsAutoCommit, tableCreationSuffix, transactionIsolation, typeConverters, Types_NCLOB, Types_SQLXML, useJDBCStoredProcedureSyntax, useNationalCharacterVarying, useRownumFiltering, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesStreamsForBinding, usesStringBinding
-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultNativeSequenceToTable, defaultSeqenceAtNextValue, defaultSequence, endDelimiter, platformOperators, sequences, sequencesLock, startDelimiter, supportsReturnGeneratedKeys, tableQualifier, timestampQuery
-
-
Constructor Summary
Constructors Constructor Description MySQLPlatform()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidappendCalendar(java.util.Calendar calendar, java.io.Writer writer)Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.protected voidappendDate(java.sql.Date date, java.io.Writer writer)Appends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format.protected voidappendTime(java.sql.Time time, java.io.Writer writer)Appends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format.protected voidappendTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer)Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.protected java.util.HashtablebuildFieldTypes()Return the mapping of class types to database types for the schema framework.java.lang.StringbuildProcedureCallString(StoredProcedureCall call, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord row)Return the stored procedure syntax for this platform.ValueReadQuerybuildSelectQueryForIdentity()INTERNAL: Build the identity query for native sequencing.booleancanBatchWriteWithOptimisticLocking(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call)INTERNAL: Supports Batch Writing with Optimistic Locking.booleancheckTableExists(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session, TableDefinition table, boolean suppressLogging)INTERNAL: Executes and evaluates query to check whether given table exists.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.protected ExpressionOperatorcurrentDateOperator()INTERNAL: Create the current date operator for this platform.protected ExpressionOperatordateToStringOperator()INTERNAL: Build MySQL equivalent to TO_CHAR.java.lang.StringgetConstraintDeletionString()INTERNAL: Used for constraint deletion.protected java.lang.StringgetCreateTempTableSqlPrefix()INTERNAL: MySQL temp table syntax, used for update-all, delete-all queries.java.lang.StringgetDropDatabaseSchemaString(java.lang.String schema)Return the drop schema definition.java.lang.StringgetFunctionCallHeader()Used for stored function calls.java.lang.StringgetIdentifierQuoteCharacter()Deprecated.java.lang.StringgetInOutputProcedureToken()INTERNAL: MySQL uses the INOUT keyword for this.intgetJDBCType(java.lang.Class javaType)java.lang.StringgetProcedureAsString()MySQL does not use the AS token.java.lang.StringgetProcedureBeginString()INTERNAL: MySQL requires BEGIN.java.lang.StringgetProcedureCallHeader()INTERNAL: Used for stored procedure calls.java.lang.StringgetProcedureCallTail()Used for sp calls.java.lang.StringgetProcedureEndString()INTERNAL: MySQL requires END.java.lang.StringgetSelectForUpdateString()INTERNAL: Used for pessimistic locking.protected DataReadQuerygetTableExistsQuery(TableDefinition table)INTERNAL: Returns query to check whether given table exists.ValueReadQuerygetTimestampQuery()INTERNAL: This method returns the query to select the timestamp from the server for MySQL.java.lang.StringgetUniqueConstraintDeletionString()INTERNAL: Used for unique constraint deletion.voidinitializeConnectionData(java.sql.Connection connection)protected voidinitializePlatformOperators()Initialize any platform-specific operators.booleanisForUpdateCompatibleWithDistinct()booleanisFractionalTimeSupported()booleanisMySQL()Answers whether platform is MySQL.protected ExpressionOperatorleftTrim2()INTERNAL: Build MySQL equivalent to LTRIM(string_exp, character).protected ExpressionOperatorlogOperator()INTERNAL: Create the 10 based log operator for this platform.voidprintFieldIdentityClause(java.io.Writer writer)INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.voidprintSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)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 BIGINTbooleanrequiresProcedureBrackets()Used for stored procedure creation: MySQL platforms need brackets around arguments declaration even if no arguments exist.booleanrequiresTableInIndexDropDDL()INTERNAL: Return if this database requires the table name when dropping an index.protected ExpressionOperatorrightTrim2()INTERNAL: Build MySQL equivalent to RTRIM(string_exp, character).booleanshouldAlwaysUseTempStorageForModifyAll()INTERNAL: MySQL supports temp tables for update-all, delete-all queries.booleanshouldPrintForUpdateClause()INTERNAL: MySQL FOR UPDATE clause has to be the lastbooleanshouldPrintOutputTokenAtStart()INTERNAL: MySQL requires the direction at the start of the argument.booleanshouldPrintStoredProcedureArgumentNameInCall()INTERNAL: MySQL stored procedure calls do not require the argument name be printed in the call string e.g. call MyStoredProc(?)booleanshouldUseJDBCOuterJoinSyntax()INTERNAL: JDBC defines an outer join syntax which many drivers do not support.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 ...booleansupportsCountDistinctWithMultipleFields()INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields.booleansupportsGlobalTempTables()INTERNAL: MySQL supports temp tables for update-all, delete-all queries.booleansupportsIdentity()INTERNAL: Indicates whether the platform supports identity.booleansupportsIndividualTableLocking()INTERNAL: Indicates whether locking clause could be selectively applied only to some tables in a ReadQuery.booleansupportsStoredFunctions()protected ExpressionOperatortoCharOperator()INTERNAL: Build MySQL equivalent to TO_CHAR.protected ExpressionOperatortoDateOperator()INTERNAL: Build MySQL equivalent to TO_DATE.protected ExpressionOperatortoNumberOperator()INTERNAL: Build MySQL equivalent to TO_NUMBER.voidwriteDeleteFromTargetTableUsingTempTableSql(java.io.Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, org.eclipse.persistence.internal.helper.DatabaseTable targetTable, java.util.Collection pkFields, java.util.Collection targetPkFields, org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform platform)INTERNAL: Writes MySQL specific SQL for accessing temp tables for delete-all queries.voidwriteUpdateOriginalFromTempTableSql(java.io.Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, java.util.Collection pkFields, java.util.Collection assignedFields)INTERNAL: Writes MySQL specific SQL for accessing temp tables for update-all queries.-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
addBatch, addStructConverter, allowBindingForSelectClause, allowsSizeInProcedureArguments, appendBoolean, appendByteArray, appendLiteralToCall, appendLiteralToCallWithBinding, appendNumber, appendParameter, appendParameterInternal, appendString, autoCommit, beginTransaction, buildBatchCriteria, buildBatchCriteriaForComplexId, buildCallWithReturning, buildClassTypes, buildCreateIndex, buildCreateIndex, buildDropIndex, buildDropIndex, buildSequenceObjectAlterIncrementWriter, buildSequenceObjectCreationWriter, buildSequenceObjectDeletionWriter, canBuildCallWithReturning, commitTransaction, convertToDatabaseType, copyInto, createArray, createArray, createPlatformDefaultSequence, createStruct, createStruct, createStruct, dontBindUpdateAllQueryUsingTempTables, executeBatch, executeStoredProcedure, freeTemporaryObject, getAssignmentString, getBatchBeginString, getBatchDelimiterString, getBatchEndString, getBatchRowCountAssignString, getBatchRowCountDeclareString, getBatchRowCountReturnString, getBatchWritingMechanism, getCastSizeForVarcharParameter, getClassTypes, getConnection, getConnectionUserName, getCreateDatabaseSchemaString, getCreateTempTableSqlBodyForTable, getCreateTempTableSqlSuffix, getCreateViewString, getCreationInOutputProcedureToken, getCreationOutputProcedureToken, getCursorCode, getCustomModifyValueForCall, getDefaultSequenceTableName, getDriverSupportsNVarChar, getDropCascadeString, getFieldTypeDefinition, getFieldTypes, getIndexNamePrefix, getInputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCTypeForSetNull, getJdbcTypeName, getMaxBatchWritingSize, getMaxFieldNameSize, getMaxForeignKeyNameSize, getMaxIndexNameSize, getMaxUniqueKeyNameSize, getNoWaitString, getObjectFromResultSet, getOutputProcedureToken, getParameterValueFromDatabaseCall, getParameterValueFromDatabaseCall, getPartitioningCallback, getPingSQL, getProcedureArgument, getProcedureArgument, getProcedureArgumentString, getProcedureOptionList, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTableCreationSuffix, getTempTableForTable, getTransactionIsolation, getTypeConverters, getUseNationalCharacterVaryingTypeForString, getVPDClearIdentifierQuery, getVPDCreationFunctionString, getVPDCreationPolicyString, getVPDDeletionString, getVPDSetIdentifierQuery, hasPartitioningCallback, initialize, isAlterSequenceObjectSupported, isCastRequired, isDynamicSQLRequiredForFunctions, isInformixOuterJoin, isJDBCExecuteCompliant, isLobCompatibleWithDistinct, isLockTimeoutException, isNullAllowedInSelectClause, isOutputAllowWithResultSet, isRowCountOutputParameterRequired, isXDBDocument, maximumNumericValues, minimumNumericValues, minimumTimeIncrement, prepareBatchStatement, printFieldNotNullClause, printFieldNullClause, printFieldTypeSize, printFieldTypeSize, printFieldUnique, printFieldUnique, printValuelist, printValuelist, registerOutputParameter, registerOutputParameter, registerOutputParameter, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTypeNameToRegisterOutputParameter, requiresUniqueConstraintCreationOnTableCreate, retrieveFirstPrimaryKeyOrOne, rollbackTransaction, setBatchWritingMechanism, setCastSizeForVarcharParameter, setClassTypes, setCursorCode, setDriverName, setDriverSupportsNVarChar, setFieldTypes, setIsCastRequired, setMaxBatchWritingSize, setNullFromDatabaseField, setNullFromDatabaseField, setParameterValueInDatabaseCall, setParameterValueInDatabaseCall, setPartitioningCallback, setPingSQL, setPrintInnerJoinInWhereClause, setPrintOuterJoinInWhereClause, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldBindLiterals, setShouldBindPartialParameters, setShouldCacheAllStatements, setShouldCreateIndicesOnForeignKeys, setShouldForceBindAllParameters, setShouldForceFieldNamesToUpperCase, setShouldIgnoreCaseOnFieldComparisons, setShouldOptimizeDataConversion, setShouldTrimStrings, setShouldUseRownumFiltering, setStatementCacheSize, setStoredProcedureTerminationToken, setStringBindingSize, setSupportsAutoCommit, setTableCreationSuffix, setTransactionIsolation, setUseJDBCStoredProcedureSyntax, setUseNationalCharacterVaryingTypeForString, setUsesBatchWriting, setUsesByteArrayBinding, setUsesJDBCBatchWriting, setUsesNativeBatchWriting, setUsesNativeSQL, setUsesStreamsForBinding, setUsesStringBinding, shouldBindAllParameters, shouldBindLiterals, shouldBindPartialParameters, shouldCacheAllStatements, shouldCreateIndicesForPrimaryKeys, shouldCreateIndicesOnForeignKeys, shouldCreateIndicesOnUniqueKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldIgnoreException, shouldOptimizeDataConversion, shouldPrintAliasForUpdate, shouldPrintConstraintNameAfter, shouldPrintFieldIdentityClause, shouldPrintInnerJoinInWhereClause, shouldPrintInOutputTokenBeforeType, shouldPrintInputTokenAtStart, shouldPrintLockingClauseAfterWhereClause, shouldPrintOuterJoinInWhereClause, shouldPrintOutputTokenBeforeType, shouldPrintStoredProcedureVariablesAfterBeginString, shouldTempTableSpecifyPrimaryKeys, shouldTrimStrings, shouldUseCustomModifyForCall, shouldUseGetSetNString, shouldUseRownumFiltering, supportsANSIInnerJoinSyntax, supportsAutoCommit, supportsConnectionUserName, supportsDeleteOnCascade, supportsForeignKeyConstraints, supportsIndexes, supportsLocalTempTables, supportsLockingQueriesWithMultipleTables, supportsNestingOuterJoins, supportsOrderByParameters, supportsOuterJoinsWithBrackets, supportsPrimaryKeyConstraint, supportsTempTables, supportsUniqueColumns, supportsUniqueKeyConstraints, supportsVPD, supportsWaitForUpdate, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAddColumnClause, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeParameterMarker, writeTableCreationSuffix
-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
addOperator, addSequence, addSequence, buildNativeCall, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, buildSelectQueryForSequenceObject, clone, convertObject, convertObject, createConnectionCustomizer, createExpressionFor, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultNativeSequenceToTable, getDefaultSeqenceAtNextValue, getDefaultSequence, getDefaultSequenceToWrite, getDriverVersion, getEndDelimiter, getINClauseLimit, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, hasDefaultSequence, initializeDefaultQueries, isAccess, isAttunity, isCloudscape, isDB2, isDB2Z, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMaxDB, isODBC, isOracle, isOracle23, 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, supportsNativeSequenceNumbers, supportsReturnGeneratedKeys, supportsSequenceObjects, toString, usesPlatformDefaultSequence
-
-
-
-
Method Detail
-
initializeConnectionData
public void initializeConnectionData(java.sql.Connection connection) throws java.sql.SQLException- Overrides:
initializeConnectionDatain classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.sql.SQLException
-
isFractionalTimeSupported
public boolean isFractionalTimeSupported()
-
appendDate
protected void appendDate(java.sql.Date date, java.io.Writer writer) throws java.io.IOExceptionAppends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'YYYY-MM-DD'- Overrides:
appendDatein classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
appendTime
protected void appendTime(java.sql.Time time, java.io.Writer writer) throws java.io.IOExceptionAppends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'HH:MM:SS'.- Overrides:
appendTimein classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
appendTimestamp
protected void appendTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer) throws java.io.IOExceptionAppends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'- Overrides:
appendTimestampin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
appendCalendar
protected void appendCalendar(java.util.Calendar calendar, java.io.Writer writer) throws java.io.IOExceptionAppends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'- Overrides:
appendCalendarin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
buildFieldTypes
protected java.util.Hashtable buildFieldTypes()
Return the mapping of class types to database types for the schema framework.- Overrides:
buildFieldTypesin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getJDBCType
public int getJDBCType(java.lang.Class javaType)
- Overrides:
getJDBCTypein classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
buildSelectQueryForIdentity
public ValueReadQuery buildSelectQueryForIdentity()
INTERNAL: Build the identity query for native sequencing.- Overrides:
buildSelectQueryForIdentityin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
buildProcedureCallString
public java.lang.String buildProcedureCallString(StoredProcedureCall call, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord row)
Return the stored procedure syntax for this platform.- Overrides:
buildProcedureCallStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
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 MySQL uses case #2 and therefore the maxResults has to be altered based on the firstResultIndex- Overrides:
computeMaxRowsForSQLin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Parameters:
firstResultIndex-maxResults-- See Also:
MySQLPlatform
-
canBatchWriteWithOptimisticLocking
public boolean canBatchWriteWithOptimisticLocking(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call)
INTERNAL: Supports Batch Writing with Optimistic Locking.- Overrides:
canBatchWriteWithOptimisticLockingin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getConstraintDeletionString
public java.lang.String getConstraintDeletionString()
INTERNAL: Used for constraint deletion.- Overrides:
getConstraintDeletionStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getUniqueConstraintDeletionString
public java.lang.String getUniqueConstraintDeletionString()
INTERNAL: Used for unique constraint deletion.- Overrides:
getUniqueConstraintDeletionStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getFunctionCallHeader
public java.lang.String getFunctionCallHeader()
Used for stored function calls.- Overrides:
getFunctionCallHeaderin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureCallTail
public java.lang.String getProcedureCallTail()
Used for sp calls.- Overrides:
getProcedureCallTailin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getSelectForUpdateString
public java.lang.String getSelectForUpdateString()
INTERNAL: Used for pessimistic locking.- Overrides:
getSelectForUpdateStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
isForUpdateCompatibleWithDistinct
public boolean isForUpdateCompatibleWithDistinct()
- Overrides:
isForUpdateCompatibleWithDistinctin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getTimestampQuery
public ValueReadQuery getTimestampQuery()
INTERNAL: This method returns the query to select the timestamp from the server for MySQL.- Specified by:
getTimestampQueryin interfaceorg.eclipse.persistence.internal.databaseaccess.Platform- Overrides:
getTimestampQueryin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
isMySQL
public boolean isMySQL()
Answers whether platform is MySQL.- Specified by:
isMySQLin interfaceorg.eclipse.persistence.internal.databaseaccess.Platform- Overrides:
isMySQLin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
initializePlatformOperators
protected void initializePlatformOperators()
Initialize any platform-specific operators.- Overrides:
initializePlatformOperatorsin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
logOperator
protected ExpressionOperator logOperator()
INTERNAL: Create the 10 based log operator for this platform.
-
toNumberOperator
protected ExpressionOperator toNumberOperator()
INTERNAL: Build MySQL equivalent to TO_NUMBER.
-
toDateOperator
protected ExpressionOperator toDateOperator()
INTERNAL: Build MySQL equivalent to TO_DATE.
-
toCharOperator
protected ExpressionOperator toCharOperator()
INTERNAL: Build MySQL equivalent to TO_CHAR.
-
dateToStringOperator
protected ExpressionOperator dateToStringOperator()
INTERNAL: Build MySQL equivalent to TO_CHAR.
-
leftTrim2
protected ExpressionOperator leftTrim2()
INTERNAL: Build MySQL equivalent to LTRIM(string_exp, character). MySQL: TRIM(LEADING character FROM string_exp)
-
rightTrim2
protected ExpressionOperator rightTrim2()
INTERNAL: Build MySQL equivalent to RTRIM(string_exp, character). MySQL: TRIM(TRAILING character FROM string_exp)
-
currentDateOperator
protected ExpressionOperator currentDateOperator()
INTERNAL: Create the current date operator for this platform.
-
printFieldIdentityClause
public void printFieldIdentityClause(java.io.Writer writer) throws ValidationExceptionINTERNAL: Append the receiver's field 'identity' constraint clause to a writer.- Overrides:
printFieldIdentityClausein classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
ValidationException
-
shouldUseJDBCOuterJoinSyntax
public boolean shouldUseJDBCOuterJoinSyntax()
INTERNAL: JDBC defines an outer join syntax which many drivers do not support. So we normally avoid it.- Overrides:
shouldUseJDBCOuterJoinSyntaxin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
supportsIdentity
public boolean supportsIdentity()
INTERNAL: Indicates whether the platform supports identity. MySQL supports native sequencing through AUTO_INCREMENT field types.- Overrides:
supportsIdentityin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
supportsCountDistinctWithMultipleFields
public boolean supportsCountDistinctWithMultipleFields()
INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields.- Overrides:
supportsCountDistinctWithMultipleFieldsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
requiresTableInIndexDropDDL
public boolean requiresTableInIndexDropDDL()
INTERNAL: Return if this database requires the table name when dropping an index.- Overrides:
requiresTableInIndexDropDDLin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
supportsGlobalTempTables
public boolean supportsGlobalTempTables()
INTERNAL: MySQL supports temp tables for update-all, delete-all queries.- Overrides:
supportsGlobalTempTablesin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
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 ...- Overrides:
supportsIndividualTableLockingin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
supportsStoredFunctions
public boolean supportsStoredFunctions()
- Overrides:
supportsStoredFunctionsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
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 ...- Overrides:
supportsAutoConversionToNumericForArithmeticOperationsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getCreateTempTableSqlPrefix
protected java.lang.String getCreateTempTableSqlPrefix()
INTERNAL: MySQL temp table syntax, used for update-all, delete-all queries.- Overrides:
getCreateTempTableSqlPrefixin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getDropDatabaseSchemaString
public java.lang.String getDropDatabaseSchemaString(java.lang.String schema)
Return the drop schema definition. Subclasses should override as needed.- Overrides:
getDropDatabaseSchemaStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldAlwaysUseTempStorageForModifyAll
public boolean shouldAlwaysUseTempStorageForModifyAll()
INTERNAL: MySQL supports temp tables for update-all, delete-all queries.- Overrides:
shouldAlwaysUseTempStorageForModifyAllin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldPrintStoredProcedureArgumentNameInCall
public boolean shouldPrintStoredProcedureArgumentNameInCall()
INTERNAL: MySQL stored procedure calls do not require the argument name be printed in the call string e.g. call MyStoredProc(?) instead of call MyStoredProc(myvariable = ?)- Overrides:
shouldPrintStoredProcedureArgumentNameInCallin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldPrintForUpdateClause
public boolean shouldPrintForUpdateClause()
INTERNAL: MySQL FOR UPDATE clause has to be the last- Overrides:
shouldPrintForUpdateClausein classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getIdentifierQuoteCharacter
@Deprecated public java.lang.String getIdentifierQuoteCharacter()
Deprecated.INTERNAL: MySQL uses ' to allow identifier to have spaces.- Overrides:
getIdentifierQuoteCharacterin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- See Also:
DatasourcePlatform.getStartDelimiter(),DatasourcePlatform.getEndDelimiter()
-
getInOutputProcedureToken
public java.lang.String getInOutputProcedureToken()
INTERNAL: MySQL uses the INOUT keyword for this.- Overrides:
getInOutputProcedureTokenin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureAsString
public java.lang.String getProcedureAsString()
MySQL does not use the AS token.- Overrides:
getProcedureAsStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldPrintOutputTokenAtStart
public boolean shouldPrintOutputTokenAtStart()
INTERNAL: MySQL requires the direction at the start of the argument.- Overrides:
shouldPrintOutputTokenAtStartin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureCallHeader
public java.lang.String getProcedureCallHeader()
INTERNAL: Used for stored procedure calls.- Overrides:
getProcedureCallHeaderin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureBeginString
public java.lang.String getProcedureBeginString()
INTERNAL: MySQL requires BEGIN.- Overrides:
getProcedureBeginStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getProcedureEndString
public java.lang.String getProcedureEndString()
INTERNAL: MySQL requires END.- Overrides:
getProcedureEndStringin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
writeUpdateOriginalFromTempTableSql
public void writeUpdateOriginalFromTempTableSql(java.io.Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, java.util.Collection pkFields, java.util.Collection assignedFields) throws java.io.IOExceptionINTERNAL: Writes MySQL specific SQL for accessing temp tables for update-all queries.- Overrides:
writeUpdateOriginalFromTempTableSqlin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
writeDeleteFromTargetTableUsingTempTableSql
public void writeDeleteFromTargetTableUsingTempTableSql(java.io.Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, org.eclipse.persistence.internal.helper.DatabaseTable targetTable, java.util.Collection pkFields, java.util.Collection targetPkFields, org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform platform) throws java.io.IOExceptionINTERNAL: Writes MySQL specific SQL for accessing temp tables for delete-all queries.- Overrides:
writeDeleteFromTargetTableUsingTempTableSqlin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
printSQLSelectStatement
public void printSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)- Overrides:
printSQLSelectStatementin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
requiresProcedureBrackets
public boolean requiresProcedureBrackets()
Used for stored procedure creation: MySQL platforms need brackets around arguments declaration even if no arguments exist.- Overrides:
requiresProcedureBracketsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
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- Overrides:
printStoredFunctionReturnKeyWordin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
java.io.IOException
-
getTableExistsQuery
protected DataReadQuery getTableExistsQuery(TableDefinition table)
INTERNAL: Returns query to check whether given table exists. Query execution returns a row when table exists or empty result otherwise.- Overrides:
getTableExistsQueryin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Parameters:
table- database table meta-data- Returns:
- query to check whether given table exists
-
checkTableExists
public boolean checkTableExists(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session, TableDefinition table, boolean suppressLogging)INTERNAL: Executes and evaluates query to check whether given table exists. Returned value depends on returned result set being empty or not.- Overrides:
checkTableExistsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Parameters:
session- current database sessiontable- database table meta-datasuppressLogging- whether to suppress logging during query execution- Returns:
- value of
trueif given table exists orfalseotherwise
-
-