diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-06-02 06:58:29 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-06-02 06:58:29 +0000 |
commit | a309cb4279885de962e535df1148f6e34f0fda9a (patch) | |
tree | 72b6717ebcb763234dd266406de154b135d73e7a | |
parent | 248902b1b50be90a1edcba7adced159d7a00b418 (diff) | |
download | brdo-a309cb4279885de962e535df1148f6e34f0fda9a.tar.gz brdo-a309cb4279885de962e535df1148f6e34f0fda9a.tar.bz2 |
- Patch #813540 by chx: handle NULL values nicely.
-rw-r--r-- | includes/database/query.inc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/database/query.inc b/includes/database/query.inc index 3e6987235..ef2b29b99 100644 --- a/includes/database/query.inc +++ b/includes/database/query.inc @@ -1212,7 +1212,15 @@ class DatabaseCondition implements QueryConditionInterface, Countable { public function condition($field, $value = NULL, $operator = NULL) { if (!isset($operator)) { - $operator = is_array($value) ? 'IN' : '='; + if (is_array($value)) { + $operator = 'IN'; + } + elseif (!isset($value)) { + $operator = 'IS NULL'; + } + else { + $operator = '='; + } } $this->conditions[] = array( 'field' => $field, @@ -1237,7 +1245,7 @@ class DatabaseCondition implements QueryConditionInterface, Countable { } public function isNull($field) { - return $this->condition($field, NULL, 'IS NULL'); + return $this->condition($field); } public function isNotNull($field) { |