EclipseLink 1.0_1.0M2 API Reference - Incubation

org.eclipse.persistence.platform.database
Class MySQL4Platform

java.lang.Object
  extended by org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      extended by org.eclipse.persistence.platform.database.DatabasePlatform
          extended by org.eclipse.persistence.platform.database.MySQL4Platform

public class MySQL4Platform
extends DatabasePlatform

Purpose: Provides MySQL specific behaviour.

Responsibilities:

Since:
OracleAS TopLink 10g (10.1.3)

Constructor Summary
MySQL4Platform()
           
 
Method Summary
protected  void appendCalendar(java.util.Calendar calendar, java.io.Writer writer)
          Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format.
protected  void appendDate(java.sql.Date date, java.io.Writer writer)
          Appends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format.
protected  void appendTime(java.sql.Time time, java.io.Writer writer)
          Appends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format.
protected  void appendTimestamp(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.Hashtable buildFieldTypes()
          Return the mapping of class types to database types for the schema framework.
 ValueReadQuery buildSelectQueryForIdentity()
          INTERNAL: Build the identity query for native sequencing.
protected  ExpressionOperator currentDateOperator()
          INTERNAL: Create the current date operator for this platform.
protected  ExpressionOperator dateToStringOperator()
          INTERNAL: Build MySQL equivalent to TO_CHAR.
 java.lang.String getConstraintDeletionString()
          INTERNAL: Used for constraint deletion.
protected  java.lang.String getCreateTempTableSqlBodyForTable(DatabaseTable table)
          INTERNAL:
protected  java.lang.String getCreateTempTableSqlPrefix()
          INTERNAL: MySQL temp table syntax, used for update-all, delete-all queries.
 java.lang.String getIdentifierQuoteCharacter()
          INTERNAL: MySQL uses ' to allow identifier to have spaces.
 java.lang.String getInOutputProcedureToken()
          INTERNAL: MySQL uses the INOUT keyword for this.
 java.lang.String getProcedureAsString()
          MySQL does not use the AS token.
 java.lang.String getProcedureBeginString()
          INTERNAL: MySQL requires BEGIN.
 java.lang.String getProcedureCallHeader()
          INTERNAL: Used for stored procedure calls.
 java.lang.String getProcedureEndString()
          INTERNAL: MySQL requires END.
 java.lang.String getSelectForUpdateString()
          INTERNAL: Used for pessimistic locking.
 ValueReadQuery getTimestampQuery()
          INTERNAL: This method returns the query to select the timestamp from the server for MySQL.
protected  void initializePlatformOperators()
          Initialize any platform-specific operators.
 boolean isMySQL()
          Answers whether platform is MySQL.
protected  ExpressionOperator leftTrim2()
          INTERNAL: Build MySQL equivalent to LTRIM(string_exp, character).
protected  ExpressionOperator logOperator()
          INTERNAL: Create the 10 based log operator for this platform.
 void printFieldIdentityClause(java.io.Writer writer)
          INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.
protected  ExpressionOperator rightTrim2()
          INTERNAL: Build MySQL equivalent to RTRIM(string_exp, character).
 boolean shouldAlwaysUseTempStorageForModifyAll()
          INTERNAL: MySQL supports temp tables for update-all, delete-all queries.
 boolean shouldPrintOutputTokenAtStart()
          INTERNAL: MySQL requires the direction at the start of the argument.
 boolean shouldPrintStoredProcedureArgumentNameInCall()
          INTERNAL: MySQL stored procedure calls do not require the argument name be printed in the call string e.g. call MyStoredProc(?)
 boolean shouldUseJDBCOuterJoinSyntax()
          INTERNAL: JDBC defines an outer join syntax which many drivers do not support.
 boolean supportsGlobalTempTables()
          INTERNAL: MySQL supports temp tables for update-all, delete-all queries.
 boolean supportsIdentity()
          INTERNAL: Indicates whether the platform supports identity.
protected  ExpressionOperator toCharOperator()
          INTERNAL: Build MySQL equivalent to TO_CHAR.
protected  ExpressionOperator toDateOperator()
          INTERNAL: Build MySQL equivalent to TO_DATE.
protected  ExpressionOperator toNumberOperator()
          INTERNAL: Build MySQL equivalent to TO_NUMBER.
 void writeDeleteFromTargetTableUsingTempTableSql(java.io.Writer writer, DatabaseTable table, DatabaseTable targetTable, java.util.Collection pkFields, java.util.Collection targetPkFields)
          INTERNAL: Writes MySQL specific SQL for accessing temp tables for delete-all queries.
 void writeUpdateOriginalFromTempTableSql(java.io.Writer writer, 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQL4Platform

public MySQL4Platform()
Method Detail

appendDate

protected void appendDate(java.sql.Date date,
                          java.io.Writer writer)
                   throws java.io.IOException
Appends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'YYYY-MM-DD'

Throws:
java.io.IOException

appendTime

protected void appendTime(java.sql.Time time,
                          java.io.Writer writer)
                   throws java.io.IOException
Appends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'HH:MM:SS'.

Throws:
java.io.IOException

appendTimestamp

protected void appendTimestamp(java.sql.Timestamp timestamp,
                               java.io.Writer writer)
                        throws java.io.IOException
Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'

Throws:
java.io.IOException

appendCalendar

protected void appendCalendar(java.util.Calendar calendar,
                              java.io.Writer writer)
                       throws java.io.IOException
Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'

Throws:
java.io.IOException

buildFieldTypes

protected java.util.Hashtable buildFieldTypes()
Return the mapping of class types to database types for the schema framework.


buildSelectQueryForIdentity

public ValueReadQuery buildSelectQueryForIdentity()
INTERNAL: Build the identity query for native sequencing.


getConstraintDeletionString

public java.lang.String getConstraintDeletionString()
INTERNAL: Used for constraint deletion.


getSelectForUpdateString

public java.lang.String getSelectForUpdateString()
INTERNAL: Used for pessimistic locking.


getTimestampQuery

public ValueReadQuery getTimestampQuery()
INTERNAL: This method returns the query to select the timestamp from the server for MySQL.


isMySQL

public boolean isMySQL()
Answers whether platform is MySQL.


initializePlatformOperators

protected void initializePlatformOperators()
Initialize any platform-specific operators.


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 ValidationException
INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.

Throws:
ValidationException

shouldUseJDBCOuterJoinSyntax

public boolean shouldUseJDBCOuterJoinSyntax()
INTERNAL: JDBC defines an outer join syntax which many drivers do not support. So we normally avoid it.


supportsIdentity

public boolean supportsIdentity()
INTERNAL: Indicates whether the platform supports identity. MySQL supports native sequencing through AUTO_INCREMENT field types.


supportsGlobalTempTables

public boolean supportsGlobalTempTables()
INTERNAL: MySQL supports temp tables for update-all, delete-all queries.


getCreateTempTableSqlPrefix

protected java.lang.String getCreateTempTableSqlPrefix()
INTERNAL: MySQL temp table syntax, used for update-all, delete-all queries.


getCreateTempTableSqlBodyForTable

protected java.lang.String getCreateTempTableSqlBodyForTable(DatabaseTable table)
INTERNAL:


shouldAlwaysUseTempStorageForModifyAll

public boolean shouldAlwaysUseTempStorageForModifyAll()
INTERNAL: MySQL supports temp tables for update-all, delete-all queries.


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 = ?)

Returns:

getIdentifierQuoteCharacter

public java.lang.String getIdentifierQuoteCharacter()
INTERNAL: MySQL uses ' to allow identifier to have spaces.


getInOutputProcedureToken

public java.lang.String getInOutputProcedureToken()
INTERNAL: MySQL uses the INOUT keyword for this.


getProcedureAsString

public java.lang.String getProcedureAsString()
MySQL does not use the AS token.


shouldPrintOutputTokenAtStart

public boolean shouldPrintOutputTokenAtStart()
INTERNAL: MySQL requires the direction at the start of the argument.


getProcedureCallHeader

public java.lang.String getProcedureCallHeader()
INTERNAL: Used for stored procedure calls.


getProcedureBeginString

public java.lang.String getProcedureBeginString()
INTERNAL: MySQL requires BEGIN.


getProcedureEndString

public java.lang.String getProcedureEndString()
INTERNAL: MySQL requires END.


writeUpdateOriginalFromTempTableSql

public void writeUpdateOriginalFromTempTableSql(java.io.Writer writer,
                                                DatabaseTable table,
                                                java.util.Collection pkFields,
                                                java.util.Collection assignedFields)
                                         throws java.io.IOException
INTERNAL: Writes MySQL specific SQL for accessing temp tables for update-all queries.

Throws:
java.io.IOException

writeDeleteFromTargetTableUsingTempTableSql

public void writeDeleteFromTargetTableUsingTempTableSql(java.io.Writer writer,
                                                        DatabaseTable table,
                                                        DatabaseTable targetTable,
                                                        java.util.Collection pkFields,
                                                        java.util.Collection targetPkFields)
                                                 throws java.io.IOException
INTERNAL: Writes MySQL specific SQL for accessing temp tables for delete-all queries.

Throws:
java.io.IOException

EclipseLink 1.0_1.0M2 API Reference - Incubation