summaryrefslogtreecommitdiffstats
path: root/system/database/DB_query_builder.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-07-18 00:16:15 +0200
committerAndrey Andreev <narf@bofh.bg>2012-07-18 00:16:15 +0200
commitededc4a32a96315f18b7234153aa9cf7c87ca3ce (patch)
tree3b39190edc2c9fd72f0c48e95fd791b43ed4fff4 /system/database/DB_query_builder.php
parent6e7047576338e896a43a35eb2fa79136adc01d8d (diff)
Change _like() to append to the qb_where array
Diffstat (limited to 'system/database/DB_query_builder.php')
-rw-r--r--system/database/DB_query_builder.php20
1 files changed, 6 insertions, 14 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 92cb8c1d5..75da1c792 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -692,7 +692,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
/**
* Like
*
- * Called by like() or orlike()
+ * Called by like() or or_like()
*
* @param mixed
* @param mixed
@@ -708,8 +708,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
foreach ($field as $k => $v)
{
- $k = $this->protect_identifiers($k);
- $prefix = (count($this->qb_like) === 0) ? $this->_group_get_type('') : $this->_group_get_type($type);
+ $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
+ ? $this->_group_get_type('') : $this->_group_get_type($type);
$v = $this->escape_like_str($v);
if ($side === 'none')
@@ -735,13 +735,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
- $this->qb_like[] = $like_statement;
+ $this->qb_where[] = array('condition' => $like_statement, 'escape' => $this->_protect_identifiers);
if ($this->qb_caching === TRUE)
{
- $this->qb_cache_like[] = $like_statement;
- $this->qb_cache_exists[] = 'like';
+ $this->qb_cache_where[] = $like_statement;
+ $this->qb_cache_exists[] = 'where';
}
-
}
return $this;
@@ -2134,13 +2133,6 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$sql = '';
}
- // LIKE
- if (count($this->qb_like) > 0)
- {
- $sql .= ($sql === '') ? "\nWHERE " : "\nAND ";
- $sql .= implode("\n", $this->qb_like);
- }
-
// GROUP BY
if (count($this->qb_groupby) > 0)
{