summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlsrv/sqlsrv_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-07-19 13:46:51 +0200
committerAndrey Andreev <narf@bofh.bg>2012-07-19 13:46:51 +0200
commit2d486231c0fbc9a5c9ad5bf6897e7bb1aff275ba (patch)
tree542257bc06ceeea9f1df658121db3953969a5084 /system/database/drivers/sqlsrv/sqlsrv_driver.php
parent96feb586c7fc2c232675590fe4e1032198a39535 (diff)
Implement _compile_order_by()
Diffstat (limited to 'system/database/drivers/sqlsrv/sqlsrv_driver.php')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 4eb12f910..badbb8e90 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -454,13 +454,13 @@ class CI_DB_sqlsrv_driver extends CI_DB {
// An ORDER BY clause is required for ROW_NUMBER() to work
if ($this->qb_offset && ! empty($this->qb_orderby))
{
- $orderby = trim($this->_compile_order_by());
+ $orderby = $this->_compile_order_by();
// We have to strip the ORDER BY clause
- $sql = trim(substr($sql, 0, strrpos($sql, 'ORDER BY '.$orderby)));
+ $sql = trim(substr($sql, 0, strrpos($sql, $orderby)));
return 'SELECT '.(count($this->qb_select) === 0 ? '*' : implode(', ', $this->qb_select))." FROM (\n"
- .preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.$orderby.') AS '.$this->escape_identifiers('CI_rownum').', ', $sql)
+ .preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.trim($orderby).') AS '.$this->escape_identifiers('CI_rownum').', ', $sql)
."\n) ".$this->escape_identifiers('CI_subquery')
."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit;
}