crystal-sqlite3 icon indicating copy to clipboard operation
crystal-sqlite3 copied to clipboard

Data Change Notification Hook

Open Svenskunganka opened this issue 8 years ago • 3 comments

I've been skimming through the source and looking through the docs, and I can't find any indications that crystal-sqlite3 supports the sqlite3_update_hook callback to get "notified" when potentially interesting data is created, updated or deleted. It is similar to the PostgreSQL NOTIFY feature.

I'm not sure if the underlying DB wrapper has support for this kind of functionality yet though, but I figured I'd open an issue here nonetheless.

Svenskunganka avatar Jun 18 '17 11:06 Svenskunganka

I wasn't aware sqlite could do that. Despite crystal-db does not abstract the notification functionality it could be added. This driver for example expose dump/backup methods.

In case of implementing it i would say to check that it works across connections. Since the Database has a pool of connections if the notification only works with the connection that performed the insert/update, then that limits the api. That is the user will need to checkout and work with one connection for all operationa or it will be able to keep on connection for the notification and leave a bunch of others for the pool.

PR are welcome.

bcardiff avatar Jun 18 '17 13:06 bcardiff

I just want to let you know that I'm interested in this feature as well. The function looks quite simple

vladfaust avatar Mar 13 '19 15:03 vladfaust

+1

unplugandplay avatar Apr 20 '19 23:04 unplugandplay