IDatabaseDBCountCache Method |
Returns the number of items in the specified column and table using the SQL WHERE clause supplied.
Note: For improved performance use DBExistsCache(String, String, DataFuncOptions, String) when possible.
DBCountCache is an enhancement to the existing DBCount function. Ultimately we still use the same DBCount mechanism to retrieve the required value
but the result is cached to Thread Local Storage. Subsequent requests to lookup the same count (using the SAME SQL) will pull that value from the thread cache
rather than hitting the database.
Namespace:
NetQuarry
Assembly:
EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax int DBCountCache(
string column,
string table,
string where,
DataFuncOptions options = ,
string logSource = null,
int commandTimeout = 30
)
Function DBCountCache (
column As String,
table As String,
where As String,
Optional options As DataFuncOptions = ,
Optional logSource As String = Nothing,
Optional commandTimeout As Integer = 30
) As Integer
Parameters
- column
- Type: SystemString
The name of the column from which to retrieve the value. - table
- Type: SystemString
The name of the table from which to retrieve the value. - where
- Type: SystemString
Filter criteria for which records to retrieve. - options (Optional)
- Type: NetQuarryDataFuncOptions
Option flags affecting the operation. - logSource (Optional)
- Type: SystemString
The source of the operation, to be logged to the devlog. - commandTimeout (Optional)
- Type: SystemInt32
The command timeout in seconds (overriding system default).
Return Value
Type:
Int32The number of matching records.
Examples
object val = db.DBLookupCache("CompanyName", "Customers", "CompanyName LIKE 'Alfreds%'");
Console.WriteLine(val.ToString());
Console.WriteLine(db.DBCountCache("*", "Customers", ""));
See Also