DatabaseUpdateTestCase fails because it returns only changed records, not all records.
Created by: jlfranklin
The other database drivers return all records, so SQLite should, too.
From the test itself:
// At 5am in the morning, all band members but those with a priority 1 task
// are sleeping. So we set their tasks to 'sleep'. 5 records match the
// condition and therefore are affected by the query, even though two of
// them actually don't have to be changed because their value was already
// 'sleep'. Still, execute() should return 5 affected rows, not only 3,
// because that's cross-db expected behaviour.
Contrast this with the comment header for the UpdateQuery_sqlite
class:
SQLite counts all the rows that match the conditions as modified, even if they
will not be affected by the query. We workaround this by ensuring that
we don't select those rows.
A query like this one:
UPDATE test SET col1 = 'newcol1', col2 = 'newcol2' WHERE tid = 1
will become:
UPDATE test SET col1 = 'newcol1', col2 = 'newcol2' WHERE tid = 1 AND (col1 <> 'newcol1' OR col2 <> 'newcol2')
See also the discussion in d.o issue #805858
As it seems the Backdrop way is to return all records, and the easiest thing to do is remove the unnecessarily complicated UpdateQuery_sqlite
class, let's do that.