Just as I said. You are executing *TWO* SEPARATE *INSERTS* OF *1 CHANGE* EACH. So sqlite3_changes() reports 1 change (from the second INSERT), just as it is supposed to.
If you call sqlite3_total_changes() before executing the inserts and again afterwards, the *difference* of the returned values will be 2.
Von: Prajeesh Prakash [mailto:***@elear.solutions]
Gesendet: Mittwoch, 05. Dezember 2018 14:04
An: Hick Gunter <***@scigames.at>
Betreff: Re: AW: [sqlite] [EXTERNAL] Number of changes
I ma trying to two insert on a single sqlite3_exec()
eg: char *url = ""BEGIN TRANSACTION;"INSERT INTO Cars(NAME) VALUES('ABC');"INSERT INTO Cars(NAME) VALUES('ABC');"COMMIT";
then i am calling sqlite3_exec() then sqlite3_change()
On December 5, 2018 at 6:23 PM Hick Gunter <***@scigames.at<mailto:***@scigames.at>> wrote:
Show what you executed. Make sure that there is no interference from other threads on the same connection. If you execute more than 1 statement in one call to sqlite3_exec(), only the last INSERT/UPDATE/DELETE will determine the return value of sqlite3_changes(). If you want the aggregate count of changes from 1 call to sqlite3_exec(), take the difference of the sqlite3_total_changes() values before and after.
Von: Prajeesh Prakash [mailto:***@elear.solutions]
Gesendet: Mittwoch, 05. Dezember 2018 13:47
An: SQLite mailing list <sqlite-***@mailinglists.sqlite.org<mailto:sqlite-***@mailinglists.sqlite.org>>; Hick Gunter <***@scigames.at<mailto:***@scigames.at>>
Betreff: Re: [sqlite] [EXTERNAL] Number of changes
Thank you i tried sqlite3_changes() but in that case i INSERT 2 rows but it gave 1.
On December 5, 2018 at 5:51 PM Hick Gunter <***@scigames.at<mailto:***@scigames.at>> wrote:
RTM.
Sqlite3_total_changes() counts the *total* number of changes done since the connection was opened. To get the number of changes made by the *last statement*, use sqlite3_changes(). This applies only to connections that are not shared between threads.
-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-***@mailinglists.sqlite.org] Im Auftrag von Prajeesh Prakash
Gesendet: Mittwoch, 05. Dezember 2018 13:10
An: sqlite-***@mailinglists.sqlite.org<mailto:sqlite-***@mailinglists.sqlite.org>
Betreff: [EXTERNAL] [sqlite] Number of changes
Hi team,
How we can find the number of changes done on a particular table in DB using sqlite3 library function (C program). I tried with sqlite3_total_changes() but its doesn't helps me. I am writing only one record but its giving me 22 records. At present my db contains 23 table and i tried to INSERT record into 1 table out of 23 after INSERT (i used sqlite3_exec()) i kept sqlite3_total_changes() but it giving result as 22.
Thank you
_______________________________________________
sqlite-users mailing list
sqlite-***@mailinglists.sqlite.org<mailto:sqlite-***@mailinglists.sqlite.org>
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___________________________________________
Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0
May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
sqlite-***@mailinglists.sqlite.org<mailto:sqlite-***@mailinglists.sqlite.org>
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___________________________________________
Gunter Hick | Software Engineer | Scientific Games International GmbH<http://www.scigames.at> | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0
May be privileged. May be confidential. Please delete if not the addressee.
___________________________________________
Gunter Hick | Software Engineer | Scientific Games International GmbH<http://www.scigames.at> | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0
May be privileged. May be confidential. Please delete if not the addressee.