summaryrefslogtreecommitdiffstats
path: root/system/database/DB_active_rec.php
diff options
context:
space:
mode:
authorGreg Aker <greg@gregaker.net>2011-12-25 08:44:33 +0100
committerGreg Aker <greg@gregaker.net>2011-12-25 08:44:33 +0100
commitef38f0a6d83025fbd99ace5ec60311acfe9121c4 (patch)
tree1728bc5df9412d8eccc2919bf3cd3f6bbe6a52d0 /system/database/DB_active_rec.php
parentd90e1a0fb541ee94459a20cf8b0726aebaec9692 (diff)
parenta96ade374f28cdae97036fc253fd8b2a0e8dc81a (diff)
Merge branch 'develop' into feature/unit-tests
Diffstat (limited to 'system/database/DB_active_rec.php')
-rw-r--r--system/database/DB_active_rec.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 5c4284ff2..1f77e41d7 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();
// --------------------------------------------------------------------
@@ -831,9 +831,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')
{
@@ -846,7 +847,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)
@@ -864,7 +865,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;
@@ -1425,7 +1429,7 @@ class CI_DB_active_record extends CI_DB_driver {
$this->limit($limit);
}
- $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit);
+ $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit, $this->ar_like);
$this->_reset_write();
return $this->query($sql);