0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-15 22:39:05 +00:00
ad hoc ad79ef48a2
libsql wal tests (#1408)
* add tests

* add bench
2024-05-24 13:59:17 +00:00

56 lines
1.2 KiB
Plaintext

PRAGMA recursive_triggers = 1;
CREATE TABLE t1(a);
CREATE INDEX i1 ON t1(a);
INSERT INTO t1(a) VALUES(0),(2),(3),(8),(9);
CREATE TABLE t2(b);
CREATE TABLE t3(c);
CREATE TRIGGER tr AFTER INSERT ON t3 BEGIN
INSERT INTO t3 SELECT new.c+1 WHERE new.c<5;
INSERT INTO t2 SELECT new.c*100+a FROM t1 WHERE a IN (1, 2, 3, 4);
END;
INSERT INTO t3 VALUES(2);
SELECT c FROM t3 ORDER BY c;;
SELECT b FROM t2 ORDER BY b;
DELETE FROM t1;
INSERT INTO t1(a) VALUES(0),(2),(3),(8),(9);
DELETE FROM t2;
DELETE FROM t3;
DROP TRIGGER tr;
CREATE TRIGGER tr AFTER INSERT ON t3 BEGIN
INSERT INTO t3 SELECT new.c+1 WHERE new.c<5;
INSERT INTO t2 SELECT new.c*10000+xx.a*100+yy.a
FROM t1 AS xx, t1 AS yy
WHERE xx.a IN (1,2,3,4)
AND yy.a IN (2,3,4,5);
END;
INSERT INTO t3 VALUES(2);
SELECT b FROM t2 ORDER BY b;
CREATE TABLE t4(x);
CREATE TRIGGER tr4 AFTER INSERT ON t4 BEGIN
SELECT 0x2147483648e0e0099 AS y WHERE y;
END;
CREATE VIEW v0(a) AS SELECT 1234;
CREATE TRIGGER t0001 INSTEAD OF DELETE ON v0 BEGIN
SELECT old.a;
END;
SELECT a FROM v0;
DELETE FROM v0;