On Fri, 13 Dec 2013 23:19:55 +0000 (UTC)
Will Parsons <[email protected]> wrote:

> I have two applications that access the same database and that can run
> at the same time.  If changes are made to the database by one
> application, I would like the other application to update its display
> to reflect the change.  The total_changes() function only works from a
> single connexion so doesn't help here, and it appears there is no API
> to access to the file change counter that's kept in an SQLite3 database.
> 
> Any suggestions on how to handle this?  In case it's relevant, the
> *only* purpose of the 2nd application's being able to detect a change
> is so that it can update its own display, and I will be using the Ruby
> bindings to SQLite3 in both programs.

There are many ways to do that, for example using pragma user_version. Each 
time you commit a change, upgrade the user_version and when you want to check 
if the other app has made a change check if it's equal to your user_version 
value.

You can do similar with a simple table with a single column row, every 
modification ends with updating the table row value.

I use user_version for other things, I put there the version of my app/db, but 
it can fit your needs.

> 
> -- 
> Will
> 
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


---   ---
Eduardo Morras <[email protected]>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to