You are here

function DB_common::limitQuery in Flickr API 5

Generates and executes a LIMIT query

Parameters

string $query the query:

intr $from the row to start to fetching (0 = the first row):

int $count the numbers of rows to fetch:

mixed $params array, string or numeric data to be used in: execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

Return value

mixed a new DB_result object for successful SELECT queries or DB_OK for successul data manipulation queries. A DB_Error object on failure.

File

phpFlickr/PEAR/DB/common.php, line 1190

Class

DB_common
DB_common is the base class from which each database driver class extends

Code

function &limitQuery($query, $from, $count, $params = []) {
  $query = $this
    ->modifyLimitQuery($query, $from, $count, $params);
  if (DB::isError($query)) {
    return $query;
  }
  $result =& $this
    ->query($query, $params);
  if (is_a($result, 'DB_result')) {
    $result
      ->setOption('limit_from', $from);
    $result
      ->setOption('limit_count', $count);
  }
  return $result;
}