On 8/10/19, Kevin Martin <ke...@khn.org.uk> wrote: > Hi, > > I have a without rowid virtual table with an implementation of xColumn that > begins with > > if(sqlite3_vtab_nochange(ctx)) return SQLITE_OK; > > If I try to perform an update on this table that doesn't involve a primary > key change, then my understanding from the documentation is that xUpdate > will be called and the value of argv[0] and argv[1] will be the same. What I > am seeing is that argv[1] is set an sql null value, although when I call > sqlite3_value_nochange(argv[1]) I do get true returned. > > Am I therefore right in thinking that the correct detection of whether there > is an update without a primary key change when using sqlite3_vtab_nochange > is actually > > sqlite3_value_nochange(argv[1]) || values_are_equal(argv[0], argv[1]) >
I think that is correct. Honestly, when I invented the sqlite3_vtab_nochange() mechanism, I intended it to be used for auxiliary columns that were expensive to compute. Example: In the zipvfile virtual table (used to read/write ZIP archives), if you want to update the access permissions on a file, you shouldn't have to load and decompess the complete content of that file as part of the UPDATE operation. sqlite3_vtab_nochange() facilitates such optimizations. But it never occurred to me that somebody might do this on the PRIMARY KEY. I don't see any reason why it wouldn't work, though. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users