On 12 Sep 2011, at 1:35pm, Richard Hipp wrote:

> 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 [snip]
> 
> 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.

Okay,  I find that page in the documentation ambiguous then.  Could that 
sentence, or something like it, be added for clarity ?

> 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.

How hard would it be to implement this safely using sqlite3's own filehandle to 
the database file ?  I know we're meant to treat sqlite3* as a black box but 
could it be done relatively safely, with a warning that it might fail under 
certain weird conditions ?  Would one use sqlite3_file_control() ?

Alternatively, suppose one was doing a lot of in-memory caching for a SQLite 
database but didn't want to block other apps from accessing it.  Is there a 
clean way to say "Has anyone been messing with this but me ?" ?

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

Reply via email to