From f94d3e470393f8fccb11b3d4766a19ce75b734e1 Mon Sep 17 00:00:00 2001 From: Tanken Date: Mon, 13 Nov 2006 08:01:56 +0000 Subject: [PATCH] Fixed OFFSET clause generation of Pgsql driver, which added the OFFSET keyword without a value to the SQL query in case of OFFSET 0. fixes #230 --- lib/Doctrine/Connection/Pgsql.php | 7 ++++++- lib/Doctrine/Query.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Connection/Pgsql.php b/lib/Doctrine/Connection/Pgsql.php index 66f0f2d8b..29188b785 100644 --- a/lib/Doctrine/Connection/Pgsql.php +++ b/lib/Doctrine/Connection/Pgsql.php @@ -128,7 +128,12 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common { . $from . ' ' . $where . ' LIMIT ' . $limit . ')'; } else { - $query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + if($limit !== false) { + $query .= ' LIMIT ' . $limit; + } + if($offset !== false) { + $query .= ' OFFSET ' . $offset; + } } } return $query; diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 33ed7e04d..816cef7a0 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -369,7 +369,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { break; case 'limit': case 'offset': - if($args[0] === null) + if($args[0] == null) $args[0] = false; $this->parts[$name] = $args[0];