Lighter icon indicating copy to clipboard operation
Lighter copied to clipboard

TBD: Add a change notification center

Open helje5 opened this issue 2 years ago • 1 comments

This can very quickly become non-Light, and maybe it shouldn't be actually done, but it might be useful to have a simple notification center that can broadcast DB change notifications. I had the feeling that it is better to let the user do this in own code as required.

I'd probably do this as a simple closure the user can hook up to anything he wants, like:

MyDatabase.onChange { some enum in  }

It quickly becomes a Pony, users might want to know the exact tables or IDs affected and so on, which sometimes isn't even possible w/ SQL itself. Transactions also complicate the matter.

Maybe rather something for Heavier. So a basic mechanism might be helpful.

helje5 avatar Aug 17 '22 14:08 helje5

Something straightforward that forwards notifications from https://www.sqlite.org/c3ref/update_hook.html would be helpful imho.

Since that callback gives the table id, and is called once for each changed rowid, it could associate changes with tables/views nicely and even group rowids together per transaction.

PadraigK avatar Oct 02 '22 00:10 PadraigK