org.rimudb
Class SQLStatementCache

java.lang.Object
  extended by org.rimudb.SQLStatementCache

public class SQLStatementCache
extends java.lang.Object

This class represents a cache of SQL statements for a table. There are typically a small set of frequently used CRUD statements for a table. Tables use this class to contain a cache of those statements, reducing the need to rebuild the strings each time.

Author:
Simon Ritchie

Constructor Summary
SQLStatementCache()
           
 
Method Summary
 void addDeleteSQL(WhereList whereList, java.lang.String sql)
          Add a delete SQL statement.
 void addUpdatePKSQL(OptimisticLocking optimisticLocking, java.util.List<java.lang.String> changedPropertyList, java.util.List<java.lang.String> nullColumnList, java.lang.String sql)
          Add the update primary key SQL statement to the cache.
 void clear()
          Clear the cache
 java.lang.String getDeleteSQL(WhereList whereList)
          Return a delete SQL statement.
 java.lang.String getInsertSQL()
          Return the insertSQL string from the cache.
 java.lang.String getSelectPK(Lock lockType)
          Return a select primary key SQL statement for a lockType.
 java.lang.String getUpdatePKSQL(OptimisticLocking optimisticLocking, java.util.List<java.lang.String> changedPropertyList, java.util.List<java.lang.String> nullColumnList)
          Return the update SQL statement for the locking scheme and changed properties.
 void setInsertSQL(java.lang.String insertSQL)
          Set the insertSQL string to the cache.
 void setSelectPK(Lock lockType, java.lang.String sql)
          Set a select primary key SQL statement for a lockType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLStatementCache

public SQLStatementCache()
Method Detail

setInsertSQL

public void setInsertSQL(java.lang.String insertSQL)
Set the insertSQL string to the cache.

Parameters:
insertSQL - String

getInsertSQL

public java.lang.String getInsertSQL()
Return the insertSQL string from the cache.

Returns:
String

addUpdatePKSQL

public void addUpdatePKSQL(OptimisticLocking optimisticLocking,
                           java.util.List<java.lang.String> changedPropertyList,
                           java.util.List<java.lang.String> nullColumnList,
                           java.lang.String sql)
Add the update primary key SQL statement to the cache.

Parameters:
optimisticLocking - OptimisticLocking
changedPropertyList - List
sql - String

getUpdatePKSQL

public java.lang.String getUpdatePKSQL(OptimisticLocking optimisticLocking,
                                       java.util.List<java.lang.String> changedPropertyList,
                                       java.util.List<java.lang.String> nullColumnList)
Return the update SQL statement for the locking scheme and changed properties.

Parameters:
optimisticLocking - OptimisticLocking
changedPropertyList - List
nullColumnList -
Returns:
String

addDeleteSQL

public void addDeleteSQL(WhereList whereList,
                         java.lang.String sql)
Add a delete SQL statement.

Parameters:
whereList - WhereList
sql - String

getDeleteSQL

public java.lang.String getDeleteSQL(WhereList whereList)
Return a delete SQL statement.

Parameters:
whereList - WhereList
Returns:
String

getSelectPK

public java.lang.String getSelectPK(Lock lockType)
Return a select primary key SQL statement for a lockType.

Parameters:
lockType -
Returns:
String

setSelectPK

public void setSelectPK(Lock lockType,
                        java.lang.String sql)
Set a select primary key SQL statement for a lockType.

Parameters:
lockType - Lock
sql - String

clear

public void clear()
Clear the cache



Copyright © 2008-2011 Simon Ritchie. All Rights Reserved.