FWIW, I have parsing, automatic creation of the crutch views, and
creation of the DB triggers working.  Next up: firing of DB triggers.
The changes so far are fairly trivial, adding very few branches, which
means that writing tests for them should be relatively simple too.
That said, it's taken quite a few hours to figure it all out, and I'm
sure firing the triggers too will be hard to get right but simple
looking in the end.

Hopefully I can have something worth submitting to the SQLite3 dev
community soon, and hopefully there will be interest.  If not, I'll
see if I can get the open source project I'm doing this for to accept
keeping patches to SQLite3.

sqlite> select * from sqlite_master;
sqlite> create trigger main.test2 on database disconnect begin select
raise(abort, 'Hey, this works!'); end;sqlite> select * from
sqlite_master;
view|sqlite_intview_disconnect|sqlite_intview_disconnect|0|CREATE VIEW
sqlite_intview_disconnect AS SELECT 0 AS nothing
trigger|test2|sqlite_intview_disconnect|0|CREATE TRIGGER test2 on
database disconnect begin select raise(abort, 'Hey, this works!'); end
sqlite> insert into sqlite_intview_disconnect values (1);
Error: Hey, this works!
sqlite>

The syntax I have a parser for is:

CREATE TRIGGER ON <db-event> BEGIN ... END;

where <db-event> is one of DATABASE CONNECT, DATABASE DISCONNECT,
TRANSACTION START, TRANSACTION COMMIT, and TRANSACTION ROLLBACK.

Cheers,

Nico
--
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to