-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/07/2015 04:23 PM, Nicolas J?ger wrote:
> I'm writing a program using sqlite3 and gtk to screen a database,
> there is a way to get a signal from sqlite3 when something is
> modified inside a database (values, add/delete row...), in the way
> to update what the program has to screen ?

Is the database being modified from within the same process, or from
outside?

The update hook will tell you (most of the time) about changes within
the same connection (ie if you are making the changes):

  https://sqlite.org/c3ref/update_hook.html

The data_version pragma can tell you if something has changed, but
you'll need to poll:

  https://www.sqlite.org/pragma.html#pragma_data_version

You can use change notification of the file system to know when the
database file is changing and then do the pragma polling to find out
when the change is complete.  For example on Windows the API starts
with FindFirstChangeNotification and on Linux you'll find i/dnotify.
Do make sure to monitor the main database file, as well as any other
related filenames such as wal, journal and shm.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlXFTvcACgkQmOOfHg372QSjZwCfZkGNxETrd5MSdx41Wks9/wGh
670AnA7I7jQxlKMe2rMkVTraR/m7PYag
=Uu+0
-----END PGP SIGNATURE-----

Reply via email to