ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:cacheselectlimit

This is an old revision of the document!


cacheSelectLimit

The order of the $rowsToReturn and $startOffset variables may not match the order specified in the underlying PHP function

syntax
 mixed cacheSelectLimit(
       mixed $cacheSeconds,
       optional string $sql=-1,
       optional int $rowsToReturn=-1,
       optional int $startOffset=-1,
       optional string[] $bindvars=false
       }

Description

Cache functions search for the results of an executed query in the query cache. The results of a query have an expiration time specified by either the first parameter, if that parameter is a positive integer, or the value of cacheSecs if not. If an unexpired cache result is not found, the query is cached for the specified period.

For an explanation of the syntax of the other parameter of cacheSelectLimit(), see selectLimit().

Usage

/*
 * DB2 Connection assumed
*/
$SQL = "SELECT * FROM act";
$result = $db->cacheSelectLimit(3000,$SQL,2,3);
while ($r = $result->FetchRow())
    print_r($r);
 
/*
 * Returns 2 rows starting at offset 3 (4th record starting at 0)
 
 
Array
(
    [0] => 40
    [1] => LEADPR
    [2] => LEAD PROGRAM/DESIGN
)
Array
(
    [0] => 50
    [1] => SPECS
    [2] => WRITE SPECS
)
 
*/
 
v5/reference/connection/cacheselectlimit.1438531106.txt.gz · Last modified: 2017/04/21 11:36 (external edit)