From 0a43ad879440c7dad246d3545ec883871ef460b8 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 15 Sep 2011 20:15:19 -0400 Subject: Implemented limit handling --- system/database/drivers/pdo/pdo_driver.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'system/database') 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; + } } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b