Commit f94d3e47 authored by Tanken's avatar Tanken

Fixed OFFSET clause generation of Pgsql driver, which added the OFFSET keyword...

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
parent 219a2c20
...@@ -128,7 +128,12 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common { ...@@ -128,7 +128,12 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common {
. $from . ' ' . $where . ' LIMIT ' . $limit . ')'; . $from . ' ' . $where . ' LIMIT ' . $limit . ')';
} else { } else {
$query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; if($limit !== false) {
$query .= ' LIMIT ' . $limit;
}
if($offset !== false) {
$query .= ' OFFSET ' . $offset;
}
} }
} }
return $query; return $query;
......
...@@ -369,7 +369,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { ...@@ -369,7 +369,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
break; break;
case 'limit': case 'limit':
case 'offset': case 'offset':
if($args[0] === null) if($args[0] == null)
$args[0] = false; $args[0] = false;
$this->parts[$name] = $args[0]; $this->parts[$name] = $args[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment