org.kuali.rice.core.framework.persistence.platform
Interface DatabasePlatform

All Known Implementing Classes:
ANSISqlDatabasePlatform, DerbyDatabasePlatform, MySQLDatabasePlatform, Oracle9iDatabasePlatform, OracleDatabasePlatform, OraclePlatform

public interface DatabasePlatform

Interface that abstracts database dependent sql from core TODO Had to move this down into embedded source because of the OJB dependencies. This probably will go away once we get rid of the embedded plugin.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
 void applyLimit(Integer limit, org.apache.ojb.broker.query.Criteria criteria)
           
 String escapeString(String sqlString)
          Escapes any special DB-specific characters from an input String, to help prevent SQL injection attacks.
 String getCreateTableFromTableSql(String tableToCreate, String fromTable)
           
 String getCurTimeFunction()
           
 String getDateFormatString(String dateFormatString)
           
 String getDateSQL(String date, String time)
          Supplies the sql for a given date string that will satisfy a where clause
 String getDropTableSql(String tableName)
           
 String getInsertDataFromTableSql(String restoreTableName, String fromTableName)
           
 String getIsNullFunction(String exprToTest, String exprToReplaceIfTestExprNull)
          Returns a SQL expression that acts like nvl(exprToTest, exprToReplaceIfTestExprNull) on oracle.
 String getLockRouteHeaderQuerySQL(String documentId, boolean wait)
          Generates the query used to select route header rows for update
 Long getNextValSQL(String sequenceName, javax.persistence.EntityManager entityManager)
           
 Long getNextValSQL(String sequenceName, org.apache.ojb.broker.PersistenceBroker persistenceBroker)
          Supplies a parameterized sequence incrementation query
 String getSelectForUpdateSuffix(long waitMillis)
          Returns the suffix to append to a SQL query in order to perform a "select for update" lock on the table
 String getStrToDateFunction()
           
 String getTruncateTableSql(String tableName)
           
 String getUpperCaseFunction()
          Returns the name of a function for shifting a string to uppercase on the relevant platform.
 

Method Detail

getCurTimeFunction

String getCurTimeFunction()

getStrToDateFunction

String getStrToDateFunction()

getDateFormatString

String getDateFormatString(String dateFormatString)

getUpperCaseFunction

String getUpperCaseFunction()
Returns the name of a function for shifting a string to uppercase on the relevant platform.

Returns:
the name of a function as a String

getNextValSQL

Long getNextValSQL(String sequenceName,
                   org.apache.ojb.broker.PersistenceBroker persistenceBroker)
Supplies a parameterized sequence incrementation query

Parameters:
sequenceName - name of the sequence to be incremented
Returns:
parameterized sequence incrementation query

getNextValSQL

Long getNextValSQL(String sequenceName,
                   javax.persistence.EntityManager entityManager)

getLockRouteHeaderQuerySQL

String getLockRouteHeaderQuerySQL(String documentId,
                                  boolean wait)
Generates the query used to select route header rows for update

Parameters:
documentId - id of the routeHeader to select for update
wait - whether to block until lock is released
Returns:
the query used to select route header rows for update

getDateSQL

String getDateSQL(String date,
                  String time)
Supplies the sql for a given date string that will satisfy a where clause

Parameters:
date - in YYYY/MM/DD format
time - in hh:mm:ss format
Returns:
the sql for a given date string that will satisfy a where clause
See Also:
SqlUtil#establishDateString(String, String, String, StringBuffer, DatabasePlatform), TODO: refactor to use a parsed Date object or milliseconds instead of date String

getSelectForUpdateSuffix

String getSelectForUpdateSuffix(long waitMillis)
Returns the suffix to append to a SQL query in order to perform a "select for update" lock on the table

Parameters:
waitMillis - the milliseconds to wait, -1 forever, 0 if no wait
Returns:
the suffix to append to a SQL query in order to perform a "select for update" lock on the table

getCreateTableFromTableSql

String getCreateTableFromTableSql(String tableToCreate,
                                  String fromTable)
Parameters:
tableToCreate - the String name for the table to be created
fromTable - the String name of the original table
Returns:
the SQL string for creating the specified table from the second specified table

getTruncateTableSql

String getTruncateTableSql(String tableName)
Parameters:
tableName - the name of the table to be truncated
Returns:
a String of SQL for truncating a table
See Also:
Truncate (SQL)

getInsertDataFromTableSql

String getInsertDataFromTableSql(String restoreTableName,
                                 String fromTableName)
Parameters:
receivingTable - the name of the table receiving inserted data
fromTable - the name of the originating table
Returns:
an "INSERT INTO" SQL command

getDropTableSql

String getDropTableSql(String tableName)
Parameters:
tableName - the table to drop
Returns:
an SQL command for dropping the specified table

getIsNullFunction

String getIsNullFunction(String exprToTest,
                         String exprToReplaceIfTestExprNull)
Returns a SQL expression that acts like nvl(exprToTest, exprToReplaceIfTestExprNull) on oracle. That is, an expression that will return exprToTest does not evaluate to null, and will return exprToReplaceIfTestExprNull if exprToTest does evaluate to null. NOTE: this method does not provide any protection against SQL injection attacks, nor does it validate any of the parameters.

Parameters:
exprToTest - a SQL expression that will either evaluate to null or non-null
exprToReplaceIfTestExprNull - the value to return if
Returns:
a SQL expression that acts like nvl on oracle or ifnull() on MySQL

escapeString

String escapeString(String sqlString)
Escapes any special DB-specific characters from an input String, to help prevent SQL injection attacks. TODO: This method should be replaced by the "prepared statement" functionality in the future.

Parameters:
sqlString - The String to escape.
Returns:
The String from sqlString, but with all of its DB-specific special characters escaped.

applyLimit

void applyLimit(Integer limit,
                org.apache.ojb.broker.query.Criteria criteria)


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