modifyLimitQuery for ibase.php
| From: | Ludovico Magnocavallo | Date: | Mon, 07 Jan 2002 11:31:05 +0000 |
| Subject: | modifyLimitQuery for ibase.php | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-3798@lists.php.net to get a copy of this message | ||
uses the new first n skip n syntax of Firebird 1.0
249a250,275
>
> // {{{ modifyLimitQuery()
>
> /**
> * This method is used by backends to alter limited queries
> * Uses the new FIRST n SKIP n Firebird 1.0 syntax, so it is
> * only compatible with Firebird 1.x
> *
> * @param string $query query to modify
> * @param integer $from the row to start to fetching
> * @param integer $count the numbers of rows to fetch
> *
> * @return the new (modified) query
> *
> * @access private
> */
>
> function modifyLimitQuery($query, $from, $count)
> {
> $from++; // SKIP starts from 1, ie SKIP 1 starts from the first
record, not skipping anything
> $query = preg_replace('/^\s*select\s(.*)$/i', "SELECT FIRST $count
SKIP $from $1", $query);
> return $query;
> }
>
> // }}}
>