summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlsrv
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/sqlsrv')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index e3e97f14b..655a9e90b 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -463,12 +463,9 @@ class CI_DB_sqlsrv_driver extends CI_DB {
protected function _limit($sql, $limit, $offset)
{
// As of SQL Server 2012 (11.0.*) OFFSET is supported
- if ($offset != 0 && version_compare($this->version(), '11', '>='))
- {
- return $sql .= ' OFFSET '. (int) $offset .' ROW FETCH NEXT '. (int) $limit .' ROW ONLY';
- }
-
- return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.($limit + $offset).' ', $sql);
+ return version_compare($this->version(), '11', '>=')
+ ? $sql.' OFFSET '.(int) $offset.' ROWS FETCH NEXT '.(int) $limit.' ROWS ONLY'
+ : preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.($limit + $offset).' ', $sql);
}
// --------------------------------------------------------------------