com.scooterframework.orm.sqldataexpress.vendor
Class MySQLDBAdapter

java.lang.Object
  extended by com.scooterframework.orm.sqldataexpress.vendor.DBAdapter
      extended by com.scooterframework.orm.sqldataexpress.vendor.MySQLDBAdapter

public class MySQLDBAdapter
extends DBAdapter

MySQLDBAdapter class applies to MySQL database.


Field Summary
 
Fields inherited from class com.scooterframework.orm.sqldataexpress.vendor.DBAdapter
IGNORE, USE_LOGIN_USER_ID_AS_SCHEMA
 
Constructor Summary
MySQLDBAdapter()
           
 
Method Summary
 boolean canChangeTableNameCase()
          Checks if table name case can be changed.
 java.lang.String[] getCatalogAndSchema(java.lang.String connName)
          Returns both catalog and schema of a connection.
 java.lang.String getExpandedTableName(java.lang.String catalog, java.lang.String schema, java.lang.String tableName)
          MySQL does not use schema.
protected static java.lang.String getMySQLCatalog(java.lang.String connName)
           
 java.lang.Object getObjectFromResultSetByType(java.sql.ResultSet rs, java.lang.String javaClassType, int sqlDataType, int index)
           
 java.lang.Object getObjectFromStatementByType(java.sql.CallableStatement cstmt, java.lang.String javaClassType, int sqlDataType, int index)
           
 java.lang.String getOneRowSelectSQL(java.lang.String catalog, java.lang.String schema, java.lang.String tableName)
          Returns a SQL SELECT query which retrieves only one record from a table.
 java.lang.String preparePaginationSql(java.lang.String selectSql, java.util.Map<java.lang.String,java.lang.Object> inputs, java.util.Map<java.lang.String,java.lang.String> outputFilters)
          Returns a SQL query for pagination.
 java.lang.String[] resolveCatalogAndSchemaAndTableFromTableName(java.lang.String tableName)
          Override the super method because MySQL does not use schema.
 boolean vendorSpecificSetObject(java.sql.PreparedStatement pstmt, java.lang.Object obj, Parameter p, java.util.Map<java.lang.String,java.lang.Object> inputs)
           
 
Methods inherited from class com.scooterframework.orm.sqldataexpress.vendor.DBAdapter
dotCount, getBlobData, getClobData, getExpandedTableName, getExpandedTableName, getInputStream, getLoginPassword, getLoginUserId, getOneRowSelectSQL, getRetrieveAllSQL, getRetrieveAllSQL, getTotalCountSQL, getTotalCountSQL, getType, isEmpty, resolveCatalogAndSchemaAndTable, resolveCatalogAndSchemaAndTable, resolveCatalogAndSchemaAndTable, useLoginAsSchema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQLDBAdapter

public MySQLDBAdapter()
Method Detail

getCatalogAndSchema

public java.lang.String[] getCatalogAndSchema(java.lang.String connName)
Description copied from class: DBAdapter
Returns both catalog and schema of a connection.

Specified by:
getCatalogAndSchema in class DBAdapter
Parameters:
connName - database connection name
Returns:
a string array containing catalog and schema

getMySQLCatalog

protected static java.lang.String getMySQLCatalog(java.lang.String connName)

canChangeTableNameCase

public boolean canChangeTableNameCase()
Checks if table name case can be changed.

Overrides:
canChangeTableNameCase in class DBAdapter
Returns:
true if table name case can be changed.

resolveCatalogAndSchemaAndTableFromTableName

public java.lang.String[] resolveCatalogAndSchemaAndTableFromTableName(java.lang.String tableName)
Override the super method because MySQL does not use schema.

Overrides:
resolveCatalogAndSchemaAndTableFromTableName in class DBAdapter
Returns:
a string array containing catalog, schema and table

getExpandedTableName

public java.lang.String getExpandedTableName(java.lang.String catalog,
                                             java.lang.String schema,
                                             java.lang.String tableName)
MySQL does not use schema. Therefore it is ignored.

Overrides:
getExpandedTableName in class DBAdapter
Parameters:
catalog - catalog name
schema - schema name
tableName - table name
Returns:
an expanded table name

getOneRowSelectSQL

public java.lang.String getOneRowSelectSQL(java.lang.String catalog,
                                           java.lang.String schema,
                                           java.lang.String tableName)
Description copied from class: DBAdapter
Returns a SQL SELECT query which retrieves only one record from a table. This query is used for retrieving meta data of the underlining table.

Specified by:
getOneRowSelectSQL in class DBAdapter
Parameters:
catalog - catalog name
schema - schema name
tableName - table name
Returns:
a SELECT query string

preparePaginationSql

public java.lang.String preparePaginationSql(java.lang.String selectSql,
                                             java.util.Map<java.lang.String,java.lang.Object> inputs,
                                             java.util.Map<java.lang.String,java.lang.String> outputFilters)
Description copied from class: DBAdapter
Returns a SQL query for pagination. This method converts a generic SQL query statement to a SQL query for pagination.

Specified by:
preparePaginationSql in class DBAdapter
Parameters:
selectSql - the original SQL statement
inputs - inputs
outputFilters - outputFilters
Returns:
a SQL query for pagination

getObjectFromResultSetByType

public java.lang.Object getObjectFromResultSetByType(java.sql.ResultSet rs,
                                                     java.lang.String javaClassType,
                                                     int sqlDataType,
                                                     int index)
                                              throws java.sql.SQLException
Overrides:
getObjectFromResultSetByType in class DBAdapter
Throws:
java.sql.SQLException

getObjectFromStatementByType

public java.lang.Object getObjectFromStatementByType(java.sql.CallableStatement cstmt,
                                                     java.lang.String javaClassType,
                                                     int sqlDataType,
                                                     int index)
                                              throws java.sql.SQLException
Overrides:
getObjectFromStatementByType in class DBAdapter
Throws:
java.sql.SQLException

vendorSpecificSetObject

public boolean vendorSpecificSetObject(java.sql.PreparedStatement pstmt,
                                       java.lang.Object obj,
                                       Parameter p,
                                       java.util.Map<java.lang.String,java.lang.Object> inputs)
                                throws java.lang.Exception
Overrides:
vendorSpecificSetObject in class DBAdapter
Throws:
java.lang.Exception