*Make null values of arrays use NULL(for lists) or IS NULL, rather than x = NULL...
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 11 Jul 2007 20:07:25 +0000 (20:07 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 11 Jul 2007 20:07:25 +0000 (20:07 +0000)
includes/Database.php

index 160e143..4e6efa4 100644 (file)
@@ -1531,8 +1531,13 @@ class Database {
                                $list .= "($value)";
                        } elseif ( ($mode == LIST_SET) && is_numeric( $field ) ) {
                                $list .= "$value";
-                       } elseif ( ($mode == LIST_AND || $mode == LIST_OR) && is_array ($value) ) {
+                       } elseif ( ($mode == LIST_AND || $mode == LIST_OR) && is_array($value) ) {
                                $list .= $field." IN (".$this->makeList($value).") ";
+                       } elseif( is_null($value) ) {
+                               if ( $mode == LIST_AND || $mode == LIST_OR || $mode == LIST_SET ) {
+                                       $list .= "$field IS ";
+                               }
+                               $list .= 'NULL';
                        } else {
                                if ( $mode == LIST_AND || $mode == LIST_OR || $mode == LIST_SET ) {
                                        $list .= "$field = ";