Consider this SQL in SQLite:
CREATE TABLE X (Xid INTEGER PRIMARY KEY);
CREATE TABLE Y (Yid INTEGER PRIMARY KEY, Xid INTEGER NOT NULL);
CREATE TABLE Z (Yid INTEGER PRIMARY KEY, Blah INTEGER NOT NULL);
CREATE TRIGGER IF NOT EXISTS OnDeleteX
BEFORE DELETE ON X
FOR EACH ROW BEGIN
DELETE FROM Y WHERE Xid = OLD.Xid;
END;
CREATE TRIGGER IF NOT EXISTS OnDeleteY
BEFORE DELETE ON Y
FOR EACH ROW BEGIN
DELETE FROM Z WHERE Yid = OLD.Yid;
END;
When I delete a line in X, I expect that its related elements in Y and Z will also be deleted. I tested this behavior on my PC using SQLite 3.7.11. In Android 4.0.4, this does not work.
Q: Does SQLite on Android support cascading triggers? That is, triggers that trigger other triggers.
In addition, it may be that some transaction may interfere with the operation of the trigger?
source
share