Database Abstraction Layer for PHP

User Tools

Site Tools

Action unknown: siteexport_addpage


Use of $ADODB_FETCH_MODE and setFetchMode() is incompatible with use of cached result sets as the results of the cached query are stored using the original fetch mode settings.

 mixed cacheExecute {
       mixed $cacheTimeInSeconds,
       optional mixed $sql
       optional string[] $bindvars


The function executes a statement and returns a handle to a recordset or false if the statement execution fails.

  1. If the first parameter passed is a positive integer, then the query cache is searched for a matching query cached within that period. If no matching cache file is found, A new statement is executed and cached.
  2. If the first parameter is the SQL statement, the query cache default is used $cacheSecs


Parameter 1

The first parameter can be either:

  1. A positive integer e.g. 600
  2. A string containing a complete SQL statement, such. SELECT * FROM ACT
  3. A string containing an SQL statement with bind variables, SELECT * FROM ACT WHERE empno>:emp, in which case the second parameter is an array containing the bind variables
  4. A array of SQL Statements. This is only available to internal functions.

Parameter 2

either the SQL statement or if set, an array of bind variables.

Parameter 3

if set, an array of bind variables.


If the execution succeeds, it returns a recordset. This recordset can be used by functions such as getUpdateSQL() or fetchRow(). if the execution fails, it returns false. You can access errors using errorMsg().


 * Connection assumed
$result = $db->cacheExecute(6000,"SELECT * FROM ACT");
$result = $db->cacheExecute("SELECT * FROM ACT WHERE empno > :emp",
v5/reference/connection/cacheexecute.txt · Last modified: 2016/05/15 15:27 by mnewnham