diff options
author | Timothy Warren <tim@timshomepage.net> | 2011-09-16 02:15:19 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2011-09-16 02:15:19 +0200 |
commit | 0a43ad879440c7dad246d3545ec883871ef460b8 (patch) | |
tree | 9114c2e1ac6265728bfdd248f974de3c5365c6a7 /system/database | |
parent | 57cea51f89a1da6f15d2e9e22dbd5f071b7bb286 (diff) |
Implemented limit handling
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 149a05247..ba02605b1 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -642,8 +642,30 @@ class CI_DB_pdo_driver extends CI_DB { */ function _limit($sql, $limit, $offset) { - // Does PDO doesn't use the LIMIT clause? - return $sql; + if(strpos('cubrid', $this->hostname) !== FALSE || strpos('sqlite', $this->hostname) !== FALSE) + { + if ($offset == 0) + { + $offset = ''; + } + else + { + $offset .= ", "; + } + + return $sql."LIMIT ".$offset.$limit; + } + else + { + $sql .= "LIMIT ".$limit; + + if ($offset > 0) + { + $sql .= " OFFSET ".$offset; + } + + return $sql; + } } // -------------------------------------------------------------------- |