public class StatementCache extends Object implements IStatementCache
| Constructor and Description |
|---|
StatementCache(int size,
boolean maintainStats,
Statistics statistics)
Creates a statement cache of given size.
|
| Modifier and Type | Method and Description |
|---|---|
String |
calculateCacheKey(String sql,
int autoGeneratedKeys)
Alternate version of autoGeneratedKeys.
|
String |
calculateCacheKey(String sql,
int[] columnIndexes)
Calculate a cache key.
|
String |
calculateCacheKey(String sql,
int resultSetType,
int resultSetConcurrency)
Cache key calculation.
|
String |
calculateCacheKey(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Simply appends the given parameters and returns it to obtain a cache key
|
String |
calculateCacheKey(String sql,
String[] columnNames)
Calculate a cache key.
|
void |
checkForProperClosure()
Checks that the entries in the cache have been properly closed when the connection dies down.
|
void |
clear()
Clears the cache
|
StatementHandle |
get(String key)
Retrieves the cached statement identified by the given key
|
StatementHandle |
get(String sql,
int autoGeneratedKeys)
Retrieves the cached statement identified by the given key
|
StatementHandle |
get(String sql,
int[] columnIndexes)
Retrieves the cached statement identified by the given key
|
StatementHandle |
get(String sql,
int resultSetType,
int resultSetConcurrency)
Retrieves the cached statement identified by the given key
|
StatementHandle |
get(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Retrieves the cached statement identified by the given key
|
StatementHandle |
get(String sql,
String[] columnNames)
Retrieves the cached statement identified by the given key
|
void |
putIfAbsent(String key,
StatementHandle handle)
Wrapper for map putIfAbsent.
|
int |
size()
Returns size of the cache.
|
public StatementCache(int size,
boolean maintainStats,
Statistics statistics)
size - of cache.maintainStats - if true, keep track of statistics.statistics - statistics handle.public String calculateCacheKey(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
calculateCacheKey in interface IStatementCachesql - resultSetConcurrency - resultSetHoldability - resultSetType - public String calculateCacheKey(String sql, int resultSetType, int resultSetConcurrency)
calculateCacheKey in interface IStatementCachesql - stringresultSetType - resultSetConcurrency - public String calculateCacheKey(String sql, int autoGeneratedKeys)
calculateCacheKey in interface IStatementCachesql - autoGeneratedKeys - public String calculateCacheKey(String sql, int[] columnIndexes)
calculateCacheKey in interface IStatementCachesql - to usecolumnIndexes - to usepublic String calculateCacheKey(String sql, String[] columnNames)
calculateCacheKey in interface IStatementCachesql - to usecolumnNames - to usepublic StatementHandle get(String key)
get in interface IStatementCachekey - SQL statementIStatementCache.get(java.lang.String)public StatementHandle get(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
IStatementCacheget in interface IStatementCachesql - SQL StatementresultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLEresultSetHoldability - a ResultSet holdability constant; one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMITpublic StatementHandle get(String sql, int resultSetType, int resultSetConcurrency)
IStatementCacheget in interface IStatementCachesql - SQL StatementresultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLEpublic StatementHandle get(String sql, int autoGeneratedKeys)
IStatementCacheget in interface IStatementCachesql - SQL StatementautoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYSpublic StatementHandle get(String sql, int[] columnIndexes)
IStatementCacheget in interface IStatementCachesql - SQL StatementcolumnIndexes - an array of column indexes indicating the columns that should be returned from the inserted row or rowspublic StatementHandle get(String sql, String[] columnNames)
IStatementCacheget in interface IStatementCachesql - SQL StatementcolumnNames - an array of column names indicating the columns that should be returned from the inserted row or rowspublic int size()
size in interface IStatementCacheIStatementCache.size()public void clear()
clear in interface IStatementCacheIStatementCache.clear()public void checkForProperClosure()
IStatementCachecheckForProperClosure in interface IStatementCachepublic void putIfAbsent(String key, StatementHandle handle)
IStatementCacheputIfAbsent in interface IStatementCacheCopyright © 2009-2013 JolBox. All Rights Reserved.