previous->escape() (Previous) (Next) ->orderBy()next

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

->limit()

->limit() – Définit la clause 'limit'

Synopsis

void $DB_DataObject->limit ( int $from , int $number )

Description

Définit la clause 'limit' dans une requête (ceci ne fonctionne que pour les bases de données supportant la clause 'limit'). Sans aucun argument, cette méthode effacera la clause 'limit' courante.

Parameter

  • int $from - début de la limitation (un nombre), ou vide pour effacer

  • int $number - limitation des résultats (un nombre)

Note

This function can not be called statically.

Seuls MySQL et PostGRes supportent réellement la clause 'limit' - l'appel à cette méthode sur une base de données que ne supporte pas la clause 'limit', une PEAR::Error sera émise.

Example

Définission de la limitation

<?php
$person 
= new DataObjects_Person;
$person->limit(2);
$person->find();
while (
$person->fetch()) {
echo 
"{$person->id} {$person->name}<BR>";
}

$person = new DataObjects_Person;
$person->limit(2,4);
$person->find();

while (
$person->fetch()) {
echo 
"{$person->id} {$person->name}<BR>";
}
?>

SQL résultant


SELECT * FROM person LIMIT 2
SELECT * FROM person LIMIT 2,4
previous->escape() (Previous) (Next) ->orderBy()next

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.