summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_active_rec.php24
-rw-r--r--user_guide/changelog.html1
2 files changed, 17 insertions, 8 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 0a4327b42..dfa0a3efb 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -226,16 +226,25 @@ class CI_DB_active_record extends CI_DB_driver {
foreach ($key as $k => $v)
{
+
$prefix = (count($this->ar_where) == 0) ? '' : $type;
+
+ if (is_null($key[$k]))
+ {
+ // value appears not to have been set, assign the test to IS NULL
+ $k .= ' IS NULL';
+ }
if ( ! is_null($v))
{
+
if ( ! $this->_has_operator($k))
{
$k .= ' =';
}
-
+
$v = ' '.$this->escape($v);
+
}
$this->ar_where[] = $prefix.$k.$v;
@@ -278,7 +287,7 @@ class CI_DB_active_record extends CI_DB_driver {
*/
function or_where_in($key = NULL, $values = NULL)
{
- return $this->_where_in($key, $values, FALSE, 'or');
+ return $this->_where_in($key, $values, FALSE, 'OR ');
}
// --------------------------------------------------------------------
@@ -316,7 +325,7 @@ class CI_DB_active_record extends CI_DB_driver {
*/
function or_where_not_in($key = NULL, $values = NULL)
{
- return $this->_where_in($key, $values, FALSE, 'or');
+ return $this->_where_in($key, $values, FALSE, 'OR ');
}
// --------------------------------------------------------------------
@@ -333,7 +342,7 @@ class CI_DB_active_record extends CI_DB_driver {
* @param string
* @return object
*/
- function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'and')
+ function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
{
if ($key === NULL || !is_array($values))
{
@@ -341,7 +350,6 @@ class CI_DB_active_record extends CI_DB_driver {
}
$not = ($not) ? ' NOT ' : '';
- $type = (strtolower($type) == 'or') ? ' OR ' : ' AND ';
foreach ($values as $value)
{
@@ -955,13 +963,13 @@ class CI_DB_active_record extends CI_DB_driver {
}
return FALSE;
}
-
+
$sql = $this->_delete($this->dbprefix.$table, $this->ar_where, $this->ar_limit);
$this->_reset_write();
return $this->query($sql);
}
-
+
// --------------------------------------------------------------------
/**
@@ -1020,7 +1028,7 @@ class CI_DB_active_record extends CI_DB_driver {
if (count($this->ar_from) > 0)
{
$sql .= "\nFROM ";
- $sql .= implode(', ', $this->ar_from);
+ $sql .= '(' . implode(', ', $this->ar_from) . ')';
}
if (count($this->ar_join) > 0)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index b122c42fa..f5f1ad28d 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -84,6 +84,7 @@ Change Log
<li>Added a language entry for valid_ip validation error.</li>
<li>Added a third parameter to Active Record's <kbd>like()</kbd> clause to control where the wildcard goes. </li>
<li>Moved the safe mode and auth checks for the Email library into the constructor. </li>
+ <li>Changed the behaviour of variables submitted to the where() clause with no values to auto set &quot;IS NULL&quot;</li>
<li>Fixed a bug in <kbd>highlight_pharse()</kbd> that caused an error with slashes.</li>
<li>Fixed a bug in <kbd>word_wrap()</kbd> of the Text Helper that incorrectly referenced an object. </li>
<li>Fixed a bug in the <a href="./libraries/email.html">Email</a> library where some timezones were calculated incorrectly. </li>