You are right, sorry, just checked. sqlite3_changes returns number of records hit, not changed. Have been using sqlite for 2 years now and was always under the impression this was for actual changes.
But which is better behaviour, reporting "row hits" versus real changes? Especially when it comes to triggers? On Tue, Jul 3, 2012 at 2:19 PM, Yuriy Kaminskiy <yum...@gmail.com> wrote: > Paul van Helden wrote: > > Is this correct? Should update triggers not only fire for actual > changes? I > > have a large table with a column which contains all NULL values except > for > > 4. I expected an UPDATE table SET column=NULL to only fire 4 triggers, > > except it fires for every row. > > I'm pretty sure that sqlite3_changes() in this case also returns *all* > rows, not > only 4 "really" changed. If you want triggers to only fire for really > changed > rows (and sqlite3_changes() to return only those 4 rows), you should add > WHERE > clause: > UPDATE table SET column=NULL WHERE column IS NOT NULL; > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users