summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-08-22 16:01:22 +0200
committerAndrey Andreev <narf@devilix.net>2014-08-22 16:01:22 +0200
commita0c3ce3162aadcc017e3dad29ac7df6e5011c4f1 (patch)
treec5c3b7d228e5371e36637fd9b811fbb01af8d9b4
parent1b634f8b10de437a18982a91ccc78aee4be1c685 (diff)
parent8b583995309ca0f2ce6fad52fd18f4c59fad9cb6 (diff)
Merge pull request #3198 from ivantcholakov/feature/is-not-null
Query builder: IS NOT NULL support implementation, see #3194
-rw-r--r--system/database/DB_query_builder.php9
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 10 insertions, 0 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 085c615e5..69dc8c2d1 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -661,6 +661,15 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
// value appears not to have been set, assign the test to IS NULL
$k .= ' IS NULL';
}
+ else
+ {
+ $operator = trim($this->_get_operator($k));
+
+ if ($operator === '<>' OR $operator === '!=')
+ {
+ $k = str_replace($operator, ' IS NOT NULL', $k);
+ }
+ }
$this->{$qb_key}[] = array('condition' => $prefix.$k.$v, 'escape' => $escape);
if ($this->qb_caching === TRUE)
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index c4360aae4..6619ae971 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -187,6 +187,7 @@ Release Date: Not Released
- Changed ``limit()`` to ignore NULL values instead of always casting to integer.
- Changed ``offset()`` to ignore empty values instead of always casting to integer.
- Methods ``insert_batch()`` and ``update_batch()`` now return an integer representing the number of rows affected by them.
+ - Methods ``where()``, ``or_where()``, ``having()`` and ``or_having()`` now convert the operators *<>* and *!=* into *IS NOT NULL* when the supplied for comparison value is equal to *NULL*.
- :doc:`Database Results <database/results>` changes include: