summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-23 11:44:09 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-23 11:44:09 +0200
commita53ea846b045e57ebd94463e463965124eba7142 (patch)
tree1ec2e1006914188d74e582e977cd7b8a4b68ab4e
parent256a18c50f0c042ae80d931ab3bd54b09f0fafa0 (diff)
Alter _compile_order_by() to re-fix MSSQL, SQLSRV limit()
-rw-r--r--system/database/DB_query_builder.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 1ab165835..0eb5a9e45 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -2146,10 +2146,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
*/
protected function _compile_order_by()
{
- if (count($this->qb_orderby) > 0)
+ if (is_array($this->qb_orderby) && count($this->qb_orderby) > 0)
{
- $sql = "\nORDER BY ";
-
for ($i = 0, $c = count($this->qb_orderby); $i < $c; $i++)
{
if ($this->qb_orderby[$i]['escape'] !== FALSE && ! $this->_is_literal($this->qb_orderby[$i]['field']))
@@ -2160,7 +2158,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$this->qb_orderby[$i] = $this->qb_orderby[$i]['field'].$this->qb_orderby[$i]['direction'];
}
- return "\nORDER BY ".implode(', ', $this->qb_orderby);
+ return $this->qb_orderby = "\nORDER BY ".implode(', ', $this->qb_orderby);
+ }
+ elseif (is_string($this->qb_orderby))
+ {
+ return $this->qb_orderby;
}
return '';