OpenPetra
Free Administration Software for Non-Profits
Ict.Common.DB.DBCaching.TSQLCache Class Reference

This class allows to cache common SQL queries. More...

Public Member Functions

 TSQLCache ()
 Provides a simple method for caching datasets for queries that are called again and again. More...
 
DataSet GetDataSet (String sql, OdbcParameter[] AParameters, DataTable ATable, TDataBase ADataBase=null)
 checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataSet from the cache. More...
 
DataSet GetDataSet (String sql, OdbcParameter[] AParameters, TDataBase ADataBase=null)
 checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataSet from the cache. More...
 
DataTable GetDataTable (string sql, OdbcParameter[] AParameters, DataTable ATable, TDataBase ADataBase=null)
 checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataTable from the cache. More...
 
DataTable GetDataTable (String sql, OdbcParameter[] AParameters=null, TDataBase ADataBase=null)
 checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataTable from the cache. More...
 
DataTable GetDataTable (String sql, TDataBase ADataBase)
 overloaded method More...
 
ArrayList GetStringList (String sql, OdbcParameter[] AParameters=null, TDataBase ADataBase=null)
 checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a ArrayList from the cache. The ArrayList consists of the strings of the first column of the first table in the dataset. More...
 
ArrayList GetStringList (String sql, TDataBase ADataBase)
 overloaded method More...
 
void InvalidateTable (String tablename)
 remove all cached resultsets which have the table in their sql statement. More...
 
void Invalidate ()
 remove all cached resultsets More...
 

Detailed Description

This class allows to cache common SQL queries.

FIXME This class does not operate in a thread-safe manner - it needs to be made thread-safe by using locks anywhere where the two internally-held ArrayLists are accessed!!!

The queries are just stored as strings and compared as strings.

Constructor & Destructor Documentation

◆ TSQLCache()

Ict.Common.DB.DBCaching.TSQLCache.TSQLCache ( )
inline

Provides a simple method for caching datasets for queries that are called again and again.

The queries are just stored as strings and compared as strings.

Member Function Documentation

◆ GetDataSet() [1/2]

DataSet Ict.Common.DB.DBCaching.TSQLCache.GetDataSet ( String  sql,
OdbcParameter[]  AParameters,
DataTable  ATable,
TDataBase  ADataBase = null 
)
inline

checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataSet from the cache.

Parameters
sql
AParametersodbc parameters
ATablecan already have some prepared columns; optional parameter, can be null
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new DataBase connection
Returns
void

◆ GetDataSet() [2/2]

DataSet Ict.Common.DB.DBCaching.TSQLCache.GetDataSet ( String  sql,
OdbcParameter[]  AParameters,
TDataBase  ADataBase = null 
)
inline

checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataSet from the cache.

Parameters
sql
AParametersodbc parameters
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new DataBase connection
Returns

◆ GetDataTable() [1/3]

DataTable Ict.Common.DB.DBCaching.TSQLCache.GetDataTable ( string  sql,
OdbcParameter[]  AParameters,
DataTable  ATable,
TDataBase  ADataBase = null 
)
inline

checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataTable from the cache.

Parameters
sql
AParametersodbc parameters
ATablecan already have some prepared columns; optional parameter, can be nil
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new DataBase connection
Returns
void

◆ GetDataTable() [2/3]

DataTable Ict.Common.DB.DBCaching.TSQLCache.GetDataTable ( String  sql,
OdbcParameter[]  AParameters = null,
TDataBase  ADataBase = null 
)
inline

checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a DataTable from the cache.

Parameters
sql
AParametersodbc parameters
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new DataBase connection
Returns

◆ GetDataTable() [3/3]

DataTable Ict.Common.DB.DBCaching.TSQLCache.GetDataTable ( String  sql,
TDataBase  ADataBase 
)
inline

overloaded method

◆ GetStringList() [1/2]

ArrayList Ict.Common.DB.DBCaching.TSQLCache.GetStringList ( String  sql,
OdbcParameter[]  AParameters = null,
TDataBase  ADataBase = null 
)
inline

checks if the result for this query is already cached. If not, the result is retrieved from the database. The result is added to the cache, and the result is returned as a ArrayList from the cache. The ArrayList consists of the strings of the first column of the first table in the dataset.

Parameters
sql
AParametersodbc parameters
ADataBaseAn instantiated TDataBase object, or null (default = null). If null gets passed then the Method executes DB commands with a new DataBase connection
Returns
void

◆ GetStringList() [2/2]

ArrayList Ict.Common.DB.DBCaching.TSQLCache.GetStringList ( String  sql,
TDataBase  ADataBase 
)
inline

overloaded method

◆ Invalidate()

void Ict.Common.DB.DBCaching.TSQLCache.Invalidate ( )
inline

remove all cached resultsets

Returns
void

◆ InvalidateTable()

void Ict.Common.DB.DBCaching.TSQLCache.InvalidateTable ( String  tablename)
inline

remove all cached resultsets which have the table in their sql statement.

Returns
void

The documentation for this class was generated from the following file: