diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-24 02:05:26 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-24 02:05:26 +0200 |
commit | 2c35b64fc2b072ce873c56dde0f4bb1e5f404450 (patch) | |
tree | 516cc4bf32dba19eba93ce3be9770e414e957ae1 /system/database/drivers/pdo | |
parent | 473130a226219dac6ef5c59b625b0e1361b292b3 (diff) |
Add a default _limit() method to the Query Builder class
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index e25013a52..a3ad46900 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -599,19 +599,12 @@ class CI_DB_pdo_driver extends CI_DB { */ 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; } } |