Allow update to be passed an empty array for the WHERE condition

This commit is contained in:
Sam Reed 2011-08-24 21:38:31 +00:00
parent 1473e98382
commit 87f03bf97e
2 changed files with 2 additions and 2 deletions

View 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 );
}

View 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 );
}