I added a custom function named "notifyObservers" via sqlite3_create_function.
CREATE TABLE foo( x, y, z );
CREATE TRIGGER foo_insert AFTER INSERT ON foo FOR EACH ROW WHEN NEW.x > 0 BEGIN SELECT notifyObservers( "insert", x ) FROM foo; END;
INSERT INTO foo VALUES( 1, 2, 3 ); -- notifyObservers( "insert", 1 ) gets called -- as expected
INSERT INTO foo VALUES( 4, 5, 6 ); --notifyObservers( "insert", 1 ) gets called again -- not desired --notifyObservers( "insert", 4 ) gets called -- OK
INSERT INTO foo VALUES( 7, 8, 9 ); --notifyObservers( "insert", 1 ) gets called yet again -- not desired --notifyObservers( "insert", 4 ) gets called again -- not desired --notifyObservers( "insert", 7 ) gets called -- OK
Can anyone suggest how I might accomplish what I'm seeking?
-Eric