Zend_Db_Adapter_Pdo_Sqlite::limit PHP Méthode

limit() public méthode

Adds an adapter-specific LIMIT clause to the SELECT statement.
public limit ( string $sql, integer $count, integer $offset ) : string
$sql string
$count integer
$offset integer OPTIONAL
Résultat string
    public function limit($sql, $count, $offset = 0)
    {
        $count = intval($count);
        if ($count <= 0) {
            /** @see Zend_Db_Adapter_Exception */
            require_once 'Zend/Db/Adapter/Exception.php';
            throw new Zend_Db_Adapter_Exception("LIMIT argument count={$count} is not valid");
        }
        $offset = intval($offset);
        if ($offset < 0) {
            /** @see Zend_Db_Adapter_Exception */
            require_once 'Zend/Db/Adapter/Exception.php';
            throw new Zend_Db_Adapter_Exception("LIMIT argument offset={$offset} is not valid");
        }
        $sql .= " LIMIT {$count}";
        if ($offset > 0) {
            $sql .= " OFFSET {$offset}";
        }
        return $sql;
    }