Re: notify all processes of database modification

Jens Alfke <jens-mAcipnqRhZf2eFz/[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <[email protected]>

> On Feb 7, 2020, at 6:23 AM, Kees Nuyt <[email protected]> wrote:
> 
> Anyway, SQLite doesn't have such a mechanism by itself.
> Maybe inotify is useful to you :
> 
> https://en.wikipedia.org/wiki/Inotify <https://en.wikipedia.org/wiki/Inotify>
> http://man7.org/linux/man-pages/man7/inotify.7.html <http://man7.org/linux/man-pages/man7/inotify.7.html>

Or on Apple platforms, FSEvents.

On any platform, you'd need to monitor both the main database and the .wal file.

And the notification would trigger soon after a transaction began making changes, although the changes wouldn't be visible to you until the commit, so you'd probably need to start polling until you see the changes, with some heuristic about timing out if nothing happens for a while (e.g. if the transaction is aborted.)

—Jens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.