org.apache.ojb.broker.platforms
Class PlatformMySQLImpl

java.lang.Object
  extended by org.apache.ojb.broker.platforms.PlatformDefaultImpl
      extended by org.apache.ojb.broker.platforms.PlatformMySQLImpl
All Implemented Interfaces:
JoinSyntaxTypes, Platform

public class PlatformMySQLImpl
extends PlatformDefaultImpl

Version:
1.0, $Id: PlatformMySQLImpl.java,v 1.1 2007-08-24 22:17:35 ewestfal Exp $
Author:
jakob br�uchi

Field Summary
 
Fields inherited from class org.apache.ojb.broker.platforms.PlatformDefaultImpl
log, m_batchUpdatesChecked, m_supportsBatchUpdates
 
Fields inherited from interface org.apache.ojb.broker.accesslayer.JoinSyntaxTypes
ORACLE_JOIN_SYNTAX, SQL92_JOIN_SYNTAX, SQL92_NOPAREN_JOIN_SYNTAX, SYBASE_JOIN_SYNTAX
 
Constructor Summary
PlatformMySQLImpl()
           
 
Method Summary
 void addPagingSql(StringBuffer anSqlString)
          Add the LIMIT or equivalent to the SQL SQL-Paging is not yet supported
 String concatenate(String[] theColumns)
          Concatenate the columns
ie: col1 || col2 || col3 (ANSI)
ie: col1 + col2 + col3 (MS SQL-Server)
ie: concat(col1, col2, col3) (MySql)
 String createSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 String dropSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 String getEscapeClause(LikeCriteria aCriteria)
          Answer the Clause used Escape wildcards in LIKE
 byte getJoinSyntaxType()
          Get join syntax type for this RDBMS - one on of the constants from JoinSyntaxType interface
 String getLastInsertIdentityQuery(String tableName)
          If database supports native key generation via identity column, this method should return the sql-query to obtain the last generated id.
 String nextSequenceQuery(String sequenceName)
          Override this method to enable database based sequence generation
 CallableStatement prepareNextValProcedureStatement(Connection con, String procedureName, String sequenceName)
          Create stored procedure call for a special sequence manager implementation SequenceManagerStoredProcedureImpl, because it seems that jdbc-driver differ in handling of CallableStatement.
 void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType)
          Called to let the Platform implementation perform any JDBC type-specific operations needed by the driver when binding positional parameters for a PreparedStatement.
 boolean supportsPaging()
          Answer true if LIMIT or equivalent is supported SQL-Paging is not yet supported
 
Methods inherited from class org.apache.ojb.broker.platforms.PlatformDefaultImpl
addBatch, afterStatementClose, afterStatementCreate, beforeBatch, beforeStatementClose, bindPagingParameters, bindPagingParametersFirst, changeAutoCommitState, checkForBatchSupport, createSequenceQuery, executeBatch, getConcatenationCharacter, initializeJdbcConnection, registerOutResultSet, setNullForStatement, supportsBatchOperations, supportsMultiColumnCountDistinct, useCountForResultsetSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformMySQLImpl

public PlatformMySQLImpl()
Method Detail

setObjectForStatement

public void setObjectForStatement(PreparedStatement ps,
                                  int index,
                                  Object value,
                                  int sqlType)
                           throws SQLException
Description copied from interface: Platform
Called to let the Platform implementation perform any JDBC type-specific operations needed by the driver when binding positional parameters for a PreparedStatement.

Specified by:
setObjectForStatement in interface Platform
Overrides:
setObjectForStatement in class PlatformDefaultImpl
Throws:
SQLException

getJoinSyntaxType

public byte getJoinSyntaxType()
Get join syntax type for this RDBMS - one on of the constants from JoinSyntaxType interface

Specified by:
getJoinSyntaxType in interface Platform
Overrides:
getJoinSyntaxType in class PlatformDefaultImpl
See Also:
Platform.getJoinSyntaxType()

getLastInsertIdentityQuery

public String getLastInsertIdentityQuery(String tableName)
Description copied from interface: Platform
If database supports native key generation via identity column, this method should return the sql-query to obtain the last generated id.

Specified by:
getLastInsertIdentityQuery in interface Platform
Overrides:
getLastInsertIdentityQuery in class PlatformDefaultImpl

addPagingSql

public void addPagingSql(StringBuffer anSqlString)
Description copied from interface: Platform
Add the LIMIT or equivalent to the SQL SQL-Paging is not yet supported

Specified by:
addPagingSql in interface Platform
Overrides:
addPagingSql in class PlatformDefaultImpl
See Also:
Platform.addPagingSql(java.lang.StringBuffer)

createSequenceQuery

public String createSequenceQuery(String sequenceName)
Description copied from class: PlatformDefaultImpl
Override this method to enable database based sequence generation

Specified by:
createSequenceQuery in interface Platform
Overrides:
createSequenceQuery in class PlatformDefaultImpl
Parameters:
sequenceName - The name of the sequence to create.
Returns:
a sql string to create a sequence

nextSequenceQuery

public String nextSequenceQuery(String sequenceName)
Description copied from class: PlatformDefaultImpl
Override this method to enable database based sequence generation

Specified by:
nextSequenceQuery in interface Platform
Overrides:
nextSequenceQuery in class PlatformDefaultImpl
Returns:
a sql string to get next sequence value

dropSequenceQuery

public String dropSequenceQuery(String sequenceName)
Description copied from class: PlatformDefaultImpl
Override this method to enable database based sequence generation

Specified by:
dropSequenceQuery in interface Platform
Overrides:
dropSequenceQuery in class PlatformDefaultImpl
Returns:
a sql string to drop a sequence

prepareNextValProcedureStatement

public CallableStatement prepareNextValProcedureStatement(Connection con,
                                                          String procedureName,
                                                          String sequenceName)
                                                   throws PlatformException
Description copied from interface: Platform
Create stored procedure call for a special sequence manager implementation SequenceManagerStoredProcedureImpl, because it seems that jdbc-driver differ in handling of CallableStatement.
Note: The out-parameter of the stored procedure must be registered at first position, because lookup for new long id in the implementation:
 Connection con = broker.serviceConnectionManager().getConnection();
 cs = getPlatform().prepareNextValProcedureStatement(con, PROCEDURE_NAME, sequenceName);
 cs.executeUpdate();
 return cs.getLong(1);
 

Specified by:
prepareNextValProcedureStatement in interface Platform
Overrides:
prepareNextValProcedureStatement in class PlatformDefaultImpl
Throws:
PlatformException

supportsPaging

public boolean supportsPaging()
Description copied from interface: Platform
Answer true if LIMIT or equivalent is supported SQL-Paging is not yet supported

Specified by:
supportsPaging in interface Platform
Overrides:
supportsPaging in class PlatformDefaultImpl
See Also:
Platform.supportsPaging()

concatenate

public String concatenate(String[] theColumns)
Description copied from interface: Platform
Concatenate the columns
ie: col1 || col2 || col3 (ANSI)
ie: col1 + col2 + col3 (MS SQL-Server)
ie: concat(col1, col2, col3) (MySql)

Specified by:
concatenate in interface Platform
Overrides:
concatenate in class PlatformDefaultImpl
Returns:
the concatenated String
See Also:
Platform.concatenate(java.lang.String[])

getEscapeClause

public String getEscapeClause(LikeCriteria aCriteria)
Description copied from interface: Platform
Answer the Clause used Escape wildcards in LIKE

Specified by:
getEscapeClause in interface Platform
Overrides:
getEscapeClause in class PlatformDefaultImpl
See Also:
Platform.getEscapeClause(org.apache.ojb.broker.query.LikeCriteria)


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.