Fix #3238

Close #3239
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index f11f846..4e37e4c 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -663,11 +663,15 @@
 			}
 			else
 			{
-				$operator = trim($this->_get_operator($k));
-
-				if ($operator === '<>' OR $operator === '!=')
+				$operator = $this->_get_operator($k);
+				if (stripos($operator, 'NULL') === FALSE)
 				{
-					$k = str_replace($operator, ' IS NOT NULL', $k);
+					$op = strrpos($k, $operator);
+					if (strlen($k) === ($op + strlen($operator)))
+					{
+						$operator = strtr($operator, array('<>' => 'IS NOT', '!=' => 'IS NOT'));
+						$k = substr($k, 0, $op).rtrim($operator).' NULL';
+					}
 				}
 			}