diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-07-19 13:46:51 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-07-19 13:46:51 +0200 |
commit | 2d486231c0fbc9a5c9ad5bf6897e7bb1aff275ba (patch) | |
tree | 542257bc06ceeea9f1df658121db3953969a5084 /system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php | |
parent | 96feb586c7fc2c232675590fe4e1032198a39535 (diff) |
Implement _compile_order_by()
Diffstat (limited to 'system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php')
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php index 399d134af..4b5747d90 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php @@ -256,13 +256,13 @@ class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver { // 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; } |