On 11/08/2017 02:41 AM, Simon Slavin wrote:
On 7 Nov 2017, at 6:53pm, David Raymond <david.raym...@tomtom.com> wrote:
I think pragma data_version is what you're looking for.
http://www.sqlite.org/pragma.html#pragma_data_version
An excellent solution, though there’s a /caveat/. From the original post:
Right now everything's a single process, so it's really easy, just clear
the cache on every write. However, I want to be prepared for the near
future where I will have multiple processes using this db file.
Documentation for the PRAGMA says
" The "PRAGMA data_version" value is a local property of each database connection and so
values returned by two concurrent invocations of "PRAGMA data_version" on separate database
connections are often different even though the underlying database is identical."
So when you convert your code to use multiple processes, they must all use the
same connection for this to work properly. That means you will have to invent
a method to ensure that only one of them makes changes at a time. That might
not be what you wanted to do.
I think it's the opposite. For connection A, the value of "PRAGMA
data_version" does not change as a result of commits by connection A. It
changes if the db is modified by any other connection, regardless of
whether or not that other connection resides in a different process or not.
"The integer values returned by two invocations of "PRAGMA data_version"
from the same connection will be different if changes were committed to
the database by any other connection in the interim. The "PRAGMA
data_version" value is unchanged for commits made on the same database
connection."
Dan.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users