Nette\Database\Drivers\OciDriver::applyLimit PHP Method

applyLimit() public method

Injects LIMIT/OFFSET to the SQL query.
public applyLimit ( &$sql, $limit, $offset )
    public function applyLimit(&$sql, $limit, $offset)
    {
        if ($limit < 0 || $offset < 0) {
            throw new Nette\InvalidArgumentException('Negative offset or limit.');
        } elseif ($offset) {
            // see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
            $sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t ' . ($limit !== NULL ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '') . ') WHERE "__rnum" > ' . (int) $offset;
        } elseif ($limit !== NULL) {
            $sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . (int) $limit;
        }
    }