Add a default _limit() method to the Query Builder class
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index e25013a..a3ad469 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -599,19 +599,12 @@
*/
protected function _limit($sql, $limit, $offset)
{
- if ($this->pdodriver === 'cubrid' OR $this->pdodriver === 'sqlite')
+ if ($this->pdodriver === 'pgsql')
{
- $offset = ($offset == 0) ? '' : $offset.', ';
-
- return $sql.'LIMIT '.$offset.$limit;
+ return $sql.' LIMIT '.$limit.($offset ? ' OFFSET '.$offset : '');
}
- else
- {
- $sql .= 'LIMIT '.$limit;
- $sql .= ($offset > 0) ? ' OFFSET '.$offset : '';
- return $sql;
- }
+ return $sql.' LIMIT '.($offset ? $offset.', ' : '').$limit;
}
}