As far as I can tell, a query that updates all rows cannot be changed to use UpdateQueryBuilder. Take this example from EntitySchema’s SqlIdGenerator (operating on a table with only one row):
$success = $database->update( $this->tableName, [ 'id_value' => $id ], IDatabase::ALL_ROWS, __METHOD__ );
This replacement doesn’t work:
$success = $database->newUpdateQueryBuilder() ->update( $this->tableName ) ->set( [ 'id_value' => $id ] ) ->where( $database::ALL_ROWS ) ->caller( __METHOD__ )->execute()
Wikimedia\Rdbms\DBQueryError: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*)' at line 1
Function: EntitySchema\DataAccess\SqlIdGenerator::generateNewId
Query: UPDATE unittest_entityschema_id_counter SET id_value = 2 WHERE (*)
This is because UpdateQueryBuilder::where() always makes $this->conds an array, but ISQLPlatform::ALL_ROWS ('*') must be passed into $conds directly, not as an array element.
Note that omitting the ->where() call is also not allowed:
$success = $database->newUpdateQueryBuilder() ->update( $this->tableName ) ->set( [ 'id_value' => $id ] ) ->caller( __METHOD__ )->execute();
UnexpectedValueException: Wikimedia\Rdbms\UpdateQueryBuilder::execute expects at least one condition to be set