Common.php 1.05 KB
Newer Older
zYne's avatar
zYne committed
1
<?php
2
Doctrine::autoload('Doctrine_Connection');
zYne's avatar
zYne committed
3 4
/**
 * standard connection, the parent of pgsql, mysql and sqlite
lsmith's avatar
lsmith committed
5 6 7 8 9 10 11 12
 * @package     Doctrine
 * @category    Object Relational Mapping
 * @link        www.phpdoctrine.com
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @since       1.0
 * @version     $Revision$
 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>
 */
lsmith's avatar
lsmith committed
13 14
class Doctrine_Connection_Common extends Doctrine_Connection
{
zYne's avatar
zYne committed
15 16 17 18 19 20 21
    /**
     * Adds an driver-specific LIMIT clause to the query
     *
     * @param string $query
     * @param mixed $limit
     * @param mixed $offset
     */
lsmith's avatar
lsmith committed
22 23
    public function modifyLimitQuery($query,$limit = false,$offset = false,$isManip=false)
    {
lsmith's avatar
lsmith committed
24
        if ($limit && $offset) {
zYne's avatar
zYne committed
25
            $query .= " LIMIT ".$limit." OFFSET ".$offset;
lsmith's avatar
lsmith committed
26
        } elseif ($limit && ! $offset) {
zYne's avatar
zYne committed
27
            $query .= " LIMIT ".$limit;
lsmith's avatar
lsmith committed
28
        } elseif ( ! $limit && $offset) {
zYne's avatar
zYne committed
29 30 31 32 33 34
            $query .= " LIMIT 999999999999 OFFSET ".$offset;
        }

        return $query;
    }
}