summaryrefslogtreecommitdiffstats
path: root/system/database/DB_active_rec.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2011-12-25 14:53:24 +0100
committerAndrey Andreev <narf@bofh.bg>2011-12-25 14:53:24 +0100
commitd34686f1a5ef557e8022c81961ad179a88c347ae (patch)
tree62c74b609e2093399abd5bc9af3934fb129cf33c /system/database/DB_active_rec.php
parenta92b903c0e6c2faa2a9480e23e2d3e4b6308878f (diff)
parenta96ade374f28cdae97036fc253fd8b2a0e8dc81a (diff)
Merge upstream branch
Diffstat (limited to 'system/database/DB_active_rec.php')
-rw-r--r--system/database/DB_active_rec.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 41950e7d8..530b44e09 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -75,7 +75,7 @@ class CI_DB_active_record extends CI_DB_driver {
protected $ar_cache_set = array();
protected $ar_no_escape = array();
- protected $ar_cache_no_escape = array();
+ protected $ar_cache_no_escape = array();
// --------------------------------------------------------------------
@@ -830,9 +830,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* @param string
* @param string direction: asc or desc
+ * @param bool enable field name escaping
* @return object
*/
- public function order_by($orderby, $direction = '')
+ public function order_by($orderby, $direction = '', $escape = TRUE)
{
if (strtolower($direction) == 'random')
{
@@ -845,7 +846,7 @@ class CI_DB_active_record extends CI_DB_driver {
}
- if (strpos($orderby, ',') !== FALSE)
+ if ((strpos($orderby, ',') !== FALSE) && ($escape === TRUE))
{
$temp = array();
foreach (explode(',', $orderby) as $part)
@@ -863,7 +864,10 @@ class CI_DB_active_record extends CI_DB_driver {
}
else if ($direction != $this->_random_keyword)
{
- $orderby = $this->_protect_identifiers($orderby);
+ if ($escape === TRUE)
+ {
+ $orderby = $this->_protect_identifiers($orderby);
+ }
}
$orderby_statement = $orderby.$direction;