Allow update to be passed an empty array for the WHERE condition
authorSam Reed <reedy@users.mediawiki.org>
Wed, 24 Aug 2011 21:38:31 +0000 (21:38 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Wed, 24 Aug 2011 21:38:31 +0000 (21:38 +0000)
includes/db/Database.php
includes/db/DatabaseOracle.php

index 279948f..fd14153 100644 (file)
@@ -1693,7 +1693,7 @@ abstract class DatabaseBase implements DatabaseType {
                $opts = $this->makeUpdateOptions( $options );
                $sql = "UPDATE $opts $table SET " . $this->makeList( $values, LIST_SET );
 
-               if ( $conds != '*' ) {
+               if ( $conds != '*' || ( is_array( $conds ) && count( $conds ) ) ) {
                        $sql .= " WHERE " . $this->makeList( $conds, LIST_AND );
                }
 
index 70f76b6..23e449a 100644 (file)
@@ -1194,7 +1194,7 @@ class DatabaseOracle extends DatabaseBase {
                        $sql .= $sqlSet;
                }
 
-               if ( $conds != '*' ) {
+               if ( $conds != '*' || ( is_array( $conds ) && count( $conds ) ) ) {
                        $conds = $this->wrapConditionsForWhere( $table, $conds );
                        $sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND );
                }