On Mon, Sep 12, 2011 at 8:02 AM, Igor Tandetnik <itandet...@mvps.org> wrote:

> Simon Slavin <slav...@bigfraud.org> wrote:
> > <http://www.sqlite.org/c3ref/total_changes.html>
> >
> > int sqlite3_total_changes(sqlite3*);
> >
> > My understanding (which might be wrong) is that this count includes all
> changes made by all connections to that database: not
> > only changes made using your connection but also chances made by another
> computer, process, or thread.
>
> I'm 99% sure your understanding is wrong, and this function only reports
> changes made by the connection passed in as a parameter. There is simply no
> machinery in SQLite that would have allowed one connection to indicate to
> another how many changes it has made.
>

Igor is right.  The sqlite3_total_changes() function only reports the number
of rows that have been changed by the same database connection that issued
the sqlite3_total_changes() call.

There is no API for accessing the database change counter.  But you can read
it yourself by looking at bytes 24-27 of the database file.

Caution: if you open and close the database file on unix using some
mechanism other than SQLite and if you have other threads using SQLite at
the same time, then you will likely corrupt the database file. This is a
design bug in posix advisory locking which is impossible for us to work
around.  See paragraph 2.2 of http://www.sqlite.org/howtocorrupt.html for
further information.



> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to