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/mssql | |
parent | 96feb586c7fc2c232675590fe4e1032198a39535 (diff) |
Implement _compile_order_by()
Diffstat (limited to 'system/database/drivers/mssql')
-rw-r--r-- | system/database/drivers/mssql/mssql_driver.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index bfc82a6c2..edc6a8480 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -453,13 +453,13 @@ class CI_DB_mssql_driver extends CI_DB { // however an ORDER BY clause is required for it to work if (version_compare($this->version(), '9', '>=') && $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; } |