Hi All,
I was wondering if there was a definite way of determining what sequence or
order that triggers are executed in sqlite3. Have searched this list and the
internet and the only thing I have found suggested that triggers are executed
in alphabetical order, which is wrong.
The following SQL:
CREATE TABLE Test(s TEXT);
CREATE TABLE Log(s TEXT);
CREATE TRIGGER btest_1 BEFORE INSERT ON Test
BEGIN
INSERT INTO Log(s) VALUES('btest_1');
END;
CREATE TRIGGER btest_3 BEFORE INSERT ON Test
BEGIN
INSERT INTO Log(s) VALUES('btest_3');
END;
CREATE TRIGGER btest_2 BEFORE INSERT ON Test
BEGIN
INSERT INTO Log(s) VALUES('btest_2');
END;
CREATE TRIGGER atest_1 AFTER INSERT ON Test
BEGIN
INSERT INTO Log(s) VALUES('atest_1');
END;
CREATE TRIGGER atest_3 AFTER INSERT ON Test
BEGIN
INSERT INTO Log(s) VALUES('atest_3');
END;
CREATE TRIGGER atest_2 AFTER INSERT ON Test
BEGIN
INSERT INTO Log(s) VALUES('atest_2');
END;
INSERT INTO Test(s) VALUES('Test');
SELECT rowid,* FROM log;
Returns the following on both windows (3.6.14) and linux (3.4.2):
1|btest_2
2|btest_3
3|btest_1
4|atest_2
5|atest_3
6|atest_1
So sqlite seems to run triggers LIFO. However, there seems to be no
specification for this.
Cheers!
____________________________________________________________________________________
Access Yahoo!7 Mail on your mobile. Anytime. Anywhere.
Show me how: http://au.mobile.yahoo.com/mail
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users