Roman Fleysher, on Friday, June 14, 2019 02:22 PM, wrote...
>
> Since ROLLBACK is not an error, I want SELECT to be executed only will update 
> actually happened (not rollback). Because of EXCLUSIVE, I want it to be in 
> one transaction and thus I need some indicator if SELECT was after successful 
> update, not rollback.
>
> Is this what changes() is for?
Yes, and no.  From what I understand, and have been using it, if something was 
written to the DB, it will give you a 1.  Otherwise a 0.  But, it is not the 
amount of fields, just a write. ie.

sqlite> create table a (a, b, c);
sqlite> create table b (a, d, e);
sqlite> insert into a values (1, 2, 3);
sqlite> insert into a values (2, 3, 4);
sqlite> insert into a values (3, 4, 5);
sqlite> select changes();  -- this is for the last write
1
sqlite> select total_changes(); -- this is for the total amount of writes
3
sqlite> insert into a values (4, 5, 6);
sqlite> select changes();
1
sqlite> select total_changes();
4

I hope this helps.

josé
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to