Module eclipselink

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:
Serializable, Cloneable, org.eclipse.persistence.internal.core.databaseaccess.CorePlatform<org.eclipse.persistence.internal.helper.ConversionManager>, org.eclipse.persistence.internal.databaseaccess.Platform, DDLPlatform
Direct Known Subclasses:
MariaDBPlatform

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:
  • 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, cursorCode, DEFAULT_MAX_BATCH_WRITING_SIZE, DEFAULT_PARAMETERIZED_MAX_BATCH_WRITING_SIZE, driverName, driverSupportsNationalCharacterVarying, IS_VALID_TIMEOUT, isCastRequired, maxBatchWritingSize, partitioningCallback, pingSQL, printInnerJoinInWhereClause, printOuterJoinInWhereClause, shouldBindAllParameters, shouldBindLiterals, shouldBindPartialParameters, shouldCacheAllStatements, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldOptimizeDataConversion, shouldTrimStrings, statementCacheSize, stringBindingSize, structConverters, supportsAutoCommit, transactionIsolation, typeConverters, useJDBCStoredProcedureSyntax, useNationalCharacterVarying, useRownumFiltering, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesStreamsForBinding, usesStringBinding

    Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform

    conversionManager, dataTypesConvertedFromAClass, dataTypesConvertedToAClass, defaultNativeSequenceToTable, defaultSeqenceAtNextValue, defaultSequence, endDelimiter, platformOperators, sequences, sequencesLock, startDelimiter, supportsReturnGeneratedKeys, tableQualifier, timestampQuery, uuidQuery
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    appendCalendar(Calendar calendar, Writer writer)
    Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
    protected void
    appendDate(Date date, Writer writer)
    Appends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format.
    protected void
    appendTime(Time time, Writer writer)
    Appends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format.
    protected void
    appendTimestamp(Timestamp timestamp, Writer writer)
    Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
    Return the mapping of class types to database types for the schema framework.
    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.
    INTERNAL: Build the identity query for native sequencing.
    boolean
    canBatchWriteWithOptimisticLocking(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call)
    INTERNAL: Supports Batch Writing with Optimistic Locking.
    boolean
    checkTableExists(org.eclipse.persistence.internal.sessions.AbstractSession session, TableDefinition table, boolean suppressLogging)
    INTERNAL: Executes and evaluates query to check whether given table exists.
    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.
    INTERNAL: Create the current date operator for this platform.
    INTERNAL: MySQL specific currentTime operator.
    INTERNAL: MySQL specific currentTimeStamp operator.
    INTERNAL: Build MySQL equivalent to TO_CHAR.
    Used for constraint deletion.
    protected String
    INTERNAL: MySQL temp table syntax, used for update-all, delete-all queries.
    Return the drop schema SQL syntax.
    Used for stored function calls.
    This method is used to print the output parameter token when stored procedures are called
    int
    getJDBCType(Class<?> javaType)
    Return the JDBC type for the Java type.
    Used for stored procedure defs.
    Used for stored procedure defs.
    INTERNAL: Used for stored procedure calls.
    Used for sp calls.
    Used for stored procedure defs.
    INTERNAL: Used for pessimistic locking.
    protected DataReadQuery
    INTERNAL: Returns query to check whether given table exists.
    INTERNAL: This method returns the query to select the timestamp from the server for MySQL.
    Used for constraint deletion.
    INTERNAL: This method returns the query to select the UUID from the server for MySQL.
    void
    INTERNAL: Allow initialization from the connection.
    protected void
    Initialize any platform-specific operators.
    boolean
    INTERNAL: Indicates whether SELECT DISTINCT ...
    boolean
    Answers whether platform is MySQL.
    INTERNAL: Build MySQL equivalent to LTRIM(string_exp, character).
    INTERNAL: MySQL specific localDateTime operator.
    INTERNAL: MySQL specific localTime operator.
    INTERNAL: Create the 10 based log operator for this platform.
    void
    Prints the platform-specific identity clause for a field (e.g., AUTO_INCREMENT).
    void
    printSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
    INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.
    void
    INTERNAL: Prints return keyword for StoredFunctionDefinition: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURN BIGINT The method was introduced because MySQL requires "RETURNS" instead: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURNS BIGINT
    boolean
    Used for stored procedure creation: MySQL platforms need brackets around arguments declaration even if no arguments exist.
    boolean
    INTERNAL: Return if this database requires the table name when dropping an index.
    INTERNAL: Build MySQL equivalent to RTRIM(string_exp, character).
    boolean
    INTERNAL: MySQL supports temp tables for update-all, delete-all queries.
    boolean
    INTERNAL: MySQL FOR UPDATE clause has to be the last
    boolean
    This is required in the construction of the stored procedures with output parameters
    boolean
    INTERNAL: MySQL stored procedure calls do not require the argument name be printed in the call string e.g. call MyStoredProc(?)
    boolean
    INTERNAL: JDBC defines an outer join syntax which many drivers do not support.
    boolean
    Some db allow VARCHAR db field to be used in arithmetic operations automatically converting them to numeric: UPDATE OL_PHONE SET PHONE_ORDER_VARCHAR = (PHONE_ORDER_VARCHAR + 1) WHERE ...
    boolean
    INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields.
    boolean
    Whether locking read concurrency with NOWAIT is supported.
    boolean
    Override this method if the platform supports setting fractional seconds precision in a SQL time or timestamp data type.
    boolean
    INTERNAL: MySQL supports temp tables for update-all, delete-all queries.
    boolean
    INTERNAL: Indicates whether the platform supports identity.
    boolean
    INTERNAL: Indicates whether locking clause could be selectively applied only to some tables in a ReadQuery.
    boolean
     
    INTERNAL: Build MySQL equivalent to TO_CHAR.
    INTERNAL: Build MySQL equivalent to TO_DATE.
    INTERNAL: MySQL specific today operator.
    INTERNAL: Build MySQL equivalent to TO_NUMBER.
    void
    writeDeleteFromTargetTableUsingTempTableSql(Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, org.eclipse.persistence.internal.helper.DatabaseTable targetTable, Collection<org.eclipse.persistence.internal.helper.DatabaseField> pkFields, Collection<org.eclipse.persistence.internal.helper.DatabaseField> targetPkFields, org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform platform)
    INTERNAL: Writes MySQL specific SQL for accessing temp tables for delete-all queries.
    void
    writeParameterMarker(Writer writer, org.eclipse.persistence.internal.expressions.ParameterExpression expression, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.databaseaccess.DatabaseCall call)
     
    void
    writeUpdateOriginalFromTempTableSql(Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, Collection<org.eclipse.persistence.internal.helper.DatabaseField> pkFields, Collection<org.eclipse.persistence.internal.helper.DatabaseField> 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, appendBoolean, appendByteArray, appendLiteralToCall, appendLiteralToCallWithBinding, appendNumber, appendParameter, appendParameterInternal, appendString, autoCommit, beginTransaction, buildBatchCriteria, buildBatchCriteriaForComplexId, buildCallWithReturning, buildCreateIndex, buildDropIndex, buildJavaTypes, canBuildCallWithReturning, checkSequenceExists, commitTransaction, convertToDatabaseType, copyInto, createArray, createArray, createPlatformDefaultSequence, createStruct, createStruct, createStruct, dontBindUpdateAllQueryUsingTempTables, executeBatch, executeStoredProcedure, freeTemporaryObject, getAssignmentString, getBatchRowCountAssignString, getBatchRowCountDeclareString, getBatchRowCountReturnString, getBatchWritingMechanism, getCastSizeForVarcharParameter, getConnection, getConnectionUserName, getCreateTempTableSqlBodyForTable, getCreateTempTableSqlSuffix, getCursorCode, getCustomModifyValueForCall, getDatabaseType, getDatabaseTypes, getDefaultSequenceTableName, getDriverSupportsNVarChar, getExecuteBatchRowCounts, getJavaTypes, getJDBCOuterJoinString, getJDBCType, getJDBCTypeForSetNull, getJdbcTypeName, getJsonPlatform, getMaxBatchWritingSize, getNoWaitString, getObjectFromResultSet, getParameterValueFromDatabaseCall, getParameterValueFromDatabaseCall, getPartitioningCallback, getPingSQL, getProcedureArgument, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTableCreationSuffix, getTempTableForTable, getTransactionIsolation, getTypeConverters, getUseNationalCharacterVaryingTypeForString, getVPDClearIdentifierQuery, getVPDCreationFunctionString, getVPDCreationPolicyString, getVPDDeletionString, getVPDSetIdentifierQuery, hasPartitioningCallback, initialize, isCastRequired, isDynamicSQLRequiredForFunctions, isInformixOuterJoin, isJDBCExecuteCompliant, isLobCompatibleWithDistinct, isLockTimeoutException, isNullAllowedInSelectClause, isOutputAllowWithResultSet, isRowCountOutputParameterRequired, isXDBDocument, maximumNumericValues, minimumNumericValues, minimumTimeIncrement, prepareBatchStatement, printValuelist, printValuelist, registerOutputParameter, registerOutputParameter, registerOutputParameter, registerOutputParameter, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTypeNameToRegisterOutputParameter, retrieveFirstPrimaryKeyOrOne, rollbackTransaction, setBatchWritingMechanism, setCastSizeForVarcharParameter, setCursorCode, setDatabaseTypes, setDriverName, setDriverSupportsNVarChar, setExecuteBatchRowCounts, setIsCastRequired, setJavaTypes, 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, shouldCreateIndicesOnForeignKeys, shouldForceBindAllParameters, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldIgnoreException, shouldOptimizeDataConversion, shouldPrintAliasForUpdate, shouldPrintFieldIdentityClause, shouldPrintInnerJoinInWhereClause, shouldPrintInOutputTokenBeforeType, shouldPrintLockingClauseAfterWhereClause, shouldPrintOuterJoinInWhereClause, shouldTempTableSpecifyPrimaryKeys, shouldTrimStrings, shouldUseCustomModifyForCall, shouldUseGetSetNString, shouldUseRownumFiltering, supportsANSIInnerJoinSyntax, supportsAutoCommit, supportsConnectionUserName, supportsLocalTempTables, supportsLockingQueriesWithMultipleTables, supportsNestingOuterJoins, supportsOrderByParameters, supportsOuterJoinsWithBrackets, supportsTempTables, supportsVPD, supportsWaitForUpdate, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAddColumnClause, writeAutoAssignmentSetClause, writeAutoJoinWhereClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDropColumnClause, writeFields, writeFieldsAutoClause, writeFieldsList, writeInsertIntoTableSql, writeJoinWhereClause, writeLOB, writeTruncateTable

    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, getSequencePreallocationSize, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, hasDefaultSequence, initializeDefaultQueries, isAccess, isAttunity, isCloudscape, isDB2, isDB2Z, isDBase, isDerby, isFirebird, isH2, isHANA, isHSQL, isInformix, isMariaDB, isMaxDB, isODBC, isOracle, isOracle12, 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, setUUIDQuery, shouldNativeSequenceUseTransaction, shouldPrepare, shouldSelectDistinctIncludeOrderBy, shouldSelectIncludeOrderBy, supportsNativeSequenceNumbers, supportsReturnGeneratedKeys, supportsSequenceObjects, toString, usesPlatformDefaultSequence

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.persistence.internal.databaseaccess.Platform

    connectionProperties
  • Constructor Details

    • MySQLPlatform

      public MySQLPlatform()
  • Method Details

    • initializeConnectionData

      public void initializeConnectionData(Connection connection) throws SQLException
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      INTERNAL: Allow initialization from the connection.
      Overrides:
      initializeConnectionData in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      SQLException
    • supportsForUpdateNoWait

      public boolean supportsForUpdateNoWait()
      Whether locking read concurrency with NOWAIT is supported. Requires MySQL 8.0.1 or later.
      Returns:
      value of true when locking read concurrency with NOWAIT is supported or false otherwise
    • appendDate

      protected void appendDate(Date date, Writer writer) throws IOException
      Appends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'YYYY-MM-DD'
      Overrides:
      appendDate in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      IOException
    • appendTime

      protected void appendTime(Time time, Writer writer) throws IOException
      Appends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'HH:MM:SS'.
      Overrides:
      appendTime in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      IOException
    • appendTimestamp

      protected void appendTimestamp(Timestamp timestamp, Writer writer) throws IOException
      Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'
      Overrides:
      appendTimestamp in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      IOException
    • appendCalendar

      protected void appendCalendar(Calendar calendar, Writer writer) throws IOException
      Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'
      Overrides:
      appendCalendar in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      IOException
    • getJDBCType

      public int getJDBCType(Class<?> javaType)
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Return the JDBC type for the Java type.
      Overrides:
      getJDBCType in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • buildSelectQueryForIdentity

      public ValueReadQuery buildSelectQueryForIdentity()
      INTERNAL: Build the identity query for native sequencing.
      Overrides:
      buildSelectQueryForIdentity in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
    • buildProcedureCallString

      public 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:
      buildProcedureCallString in class org.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:
      computeMaxRowsForSQL in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      See Also:
    • canBatchWriteWithOptimisticLocking

      public boolean canBatchWriteWithOptimisticLocking(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call)
      INTERNAL: Supports Batch Writing with Optimistic Locking.
      Overrides:
      canBatchWriteWithOptimisticLocking in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • getFunctionCallHeader

      public String getFunctionCallHeader()
      Used for stored function calls.
      Overrides:
      getFunctionCallHeader in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • getProcedureCallTail

      public String getProcedureCallTail()
      Used for sp calls.
      Overrides:
      getProcedureCallTail in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • getSelectForUpdateString

      public String getSelectForUpdateString()
      INTERNAL: Used for pessimistic locking.
      Overrides:
      getSelectForUpdateString in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • isForUpdateCompatibleWithDistinct

      public boolean isForUpdateCompatibleWithDistinct()
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      INTERNAL: Indicates whether SELECT DISTINCT ... FOR UPDATE is allowed by the platform (Oracle doesn't allow this).
      Overrides:
      isForUpdateCompatibleWithDistinct in class org.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:
      getTimestampQuery in interface org.eclipse.persistence.internal.databaseaccess.Platform
      Overrides:
      getTimestampQuery in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
    • isMySQL

      public boolean isMySQL()
      Answers whether platform is MySQL.
      Specified by:
      isMySQL in interface org.eclipse.persistence.internal.databaseaccess.Platform
      Overrides:
      isMySQL in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
    • initializePlatformOperators

      protected void initializePlatformOperators()
      Initialize any platform-specific operators.
      Overrides:
      initializePlatformOperators in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
    • currentTimeStamp

      public static ExpressionOperator currentTimeStamp()
      INTERNAL: MySQL specific currentTimeStamp operator.
      Returns:
      new ExpressionOperator instance with currentTimeStamp
    • today

      public static ExpressionOperator today()
      INTERNAL: MySQL specific today operator.
      Returns:
      new ExpressionOperator instance with today
    • currentTime

      public static ExpressionOperator currentTime()
      INTERNAL: MySQL specific currentTime operator.
      Returns:
      new ExpressionOperator instance with currentTime
    • localTime

      public static ExpressionOperator localTime()
      INTERNAL: MySQL specific localTime operator.
      Returns:
      new ExpressionOperator instance with localTime
    • localDateTime

      public static ExpressionOperator localDateTime()
      INTERNAL: MySQL specific localDateTime operator.
      Returns:
      new ExpressionOperator instance with localDateTime
    • 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.
    • shouldUseJDBCOuterJoinSyntax

      public boolean shouldUseJDBCOuterJoinSyntax()
      INTERNAL: JDBC defines an outer join syntax which many drivers do not support. So we normally avoid it.
      Overrides:
      shouldUseJDBCOuterJoinSyntax in class org.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:
      supportsIdentity in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
    • supportsCountDistinctWithMultipleFields

      public boolean supportsCountDistinctWithMultipleFields()
      INTERNAL: Indicates whether the platform supports the count distinct function with multiple fields.
      Overrides:
      supportsCountDistinctWithMultipleFields in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • requiresTableInIndexDropDDL

      public boolean requiresTableInIndexDropDDL()
      INTERNAL: Return if this database requires the table name when dropping an index.
    • supportsGlobalTempTables

      public boolean supportsGlobalTempTables()
      INTERNAL: MySQL supports temp tables for update-all, delete-all queries.
      Overrides:
      supportsGlobalTempTables in class org.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:
      supportsIndividualTableLocking in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • supportsStoredFunctions

      public boolean supportsStoredFunctions()
    • 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:
      supportsAutoConversionToNumericForArithmeticOperations in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • getCreateTempTableSqlPrefix

      protected String getCreateTempTableSqlPrefix()
      INTERNAL: MySQL temp table syntax, used for update-all, delete-all queries.
      Overrides:
      getCreateTempTableSqlPrefix in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • shouldAlwaysUseTempStorageForModifyAll

      public boolean shouldAlwaysUseTempStorageForModifyAll()
      INTERNAL: MySQL supports temp tables for update-all, delete-all queries.
      Overrides:
      shouldAlwaysUseTempStorageForModifyAll in class org.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:
      shouldPrintStoredProcedureArgumentNameInCall in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • shouldPrintForUpdateClause

      public boolean shouldPrintForUpdateClause()
      INTERNAL: MySQL FOR UPDATE clause has to be the last
      Overrides:
      shouldPrintForUpdateClause in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • getProcedureCallHeader

      public String getProcedureCallHeader()
      INTERNAL: Used for stored procedure calls.
      Overrides:
      getProcedureCallHeader in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • writeUpdateOriginalFromTempTableSql

      public void writeUpdateOriginalFromTempTableSql(Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, Collection<org.eclipse.persistence.internal.helper.DatabaseField> pkFields, Collection<org.eclipse.persistence.internal.helper.DatabaseField> assignedFields) throws IOException
      INTERNAL: Writes MySQL specific SQL for accessing temp tables for update-all queries.
      Overrides:
      writeUpdateOriginalFromTempTableSql in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Parameters:
      writer - for writing the sql
      table - is original table for which temp table is created.
      pkFields - primary key fields for the original table.
      assignedFields - fields to be assigned a new value.
      Throws:
      IOException
    • writeDeleteFromTargetTableUsingTempTableSql

      public void writeDeleteFromTargetTableUsingTempTableSql(Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, org.eclipse.persistence.internal.helper.DatabaseTable targetTable, Collection<org.eclipse.persistence.internal.helper.DatabaseField> pkFields, Collection<org.eclipse.persistence.internal.helper.DatabaseField> targetPkFields, org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform platform) throws IOException
      INTERNAL: Writes MySQL specific SQL for accessing temp tables for delete-all queries.
      Overrides:
      writeDeleteFromTargetTableUsingTempTableSql in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Parameters:
      writer - for writing the sql
      table - is original table for which temp table is created.
      targetTable - is a table from which to delete.
      pkFields - primary key fields for the original table.
      targetPkFields - primary key fields for the target table.
      Throws:
      IOException
    • writeParameterMarker

      public void writeParameterMarker(Writer writer, org.eclipse.persistence.internal.expressions.ParameterExpression expression, org.eclipse.persistence.internal.sessions.AbstractRecord record, org.eclipse.persistence.internal.databaseaccess.DatabaseCall call) throws IOException
      Overrides:
      writeParameterMarker in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      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)
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.
      Overrides:
      printSQLSelectStatement in class org.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.
    • printStoredFunctionReturnKeyWord

      public void printStoredFunctionReturnKeyWord(Writer writer) throws IOException
      INTERNAL: Prints return keyword for StoredFunctionDefinition: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURN BIGINT The method was introduced because MySQL requires "RETURNS" instead: CREATE FUNCTION StoredFunction_In (P_IN BIGINT) RETURNS BIGINT
      Overrides:
      printStoredFunctionReturnKeyWord in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Throws:
      IOException
    • getUUIDQuery

      public ValueReadQuery getUUIDQuery()
      INTERNAL: This method returns the query to select the UUID from the server for MySQL.
      Specified by:
      getUUIDQuery in interface org.eclipse.persistence.internal.databaseaccess.Platform
      Overrides:
      getUUIDQuery in class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
    • buildDatabaseTypes

      protected Map<Class<?>,FieldDefinition.DatabaseType> buildDatabaseTypes()
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Return the mapping of class types to database types for the schema framework.
      Overrides:
      buildDatabaseTypes in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
    • checkTableExists

      public boolean checkTableExists(org.eclipse.persistence.internal.sessions.AbstractSession session, TableDefinition table, boolean suppressLogging)
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      INTERNAL: Executes and evaluates query to check whether given table exists. Returned value is always true, because an exception is thrown when given table does not exist.
      Overrides:
      checkTableExists in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Parameters:
      session - current database session
      table - database table meta-data
      suppressLogging - whether to suppress logging during query execution
      Returns:
      value of true if given table exists or false otherwise
    • getConstraintDeletionString

      public String getConstraintDeletionString()
      Description copied from interface: DDLPlatform
      Used for constraint deletion.
    • getDropDatabaseSchemaString

      public String getDropDatabaseSchemaString(String schema)
      Description copied from interface: DDLPlatform
      Return the drop schema SQL syntax. Subclasses should override as needed.
    • getInOutputProcedureToken

      public String getInOutputProcedureToken()
      Description copied from interface: DDLPlatform
      This method is used to print the output parameter token when stored procedures are called
    • getProcedureAsString

      public String getProcedureAsString()
      Description copied from interface: DDLPlatform
      Used for stored procedure defs.
    • getProcedureBeginString

      public String getProcedureBeginString()
      Description copied from interface: DDLPlatform
      Used for stored procedure defs.
    • getProcedureEndString

      public String getProcedureEndString()
      Description copied from interface: DDLPlatform
      Used for stored procedure defs.
    • getTableExistsQuery

      protected DataReadQuery getTableExistsQuery(TableDefinition table)
      Description copied from class: org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      INTERNAL: Returns query to check whether given table exists. Query execution throws an exception when no such table exists.
      Overrides:
      getTableExistsQuery in class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      Parameters:
      table - database table meta-data
      Returns:
      query to check whether given table exists
    • getUniqueConstraintDeletionString

      public String getUniqueConstraintDeletionString()
      Description copied from interface: DDLPlatform
      Used for constraint deletion.
    • printFieldIdentityClause

      public void printFieldIdentityClause(Writer writer) throws ValidationException
      Description copied from interface: DDLPlatform
      Prints the platform-specific identity clause for a field (e.g., AUTO_INCREMENT).
      Parameters:
      writer - the writer to append to
      Throws:
      ValidationException
    • shouldPrintOutputTokenAtStart

      public boolean shouldPrintOutputTokenAtStart()
      Description copied from interface: DDLPlatform
      This is required in the construction of the stored procedures with output parameters
    • supportsFractionalTime

      public boolean supportsFractionalTime()
      Description copied from interface: DDLPlatform
      Override this method if the platform supports setting fractional seconds precision in a SQL time or timestamp data type.
      Returns:
      value of true when current database platform supports fractional seconds precision or false otherwise