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

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

48 lines
1.3 KiB
Plaintext

CREATE TABLE t16a(a TEXT, b REAL, c INT, PRIMARY KEY(a,b)) WITHOUT rowid;
INSERT INTO t16a VALUES('abc',1.25,99);
ALTER TABLE t16a ADD COLUMN d TEXT DEFAULT 'xyzzy';
INSERT INTO t16a VALUES('cba',5.5,98,'fizzle');
SELECT * FROM t16a ORDER BY a;
ALTER TABLE t16a RENAME TO t16a_rn;
SELECT * FROM t16a_rn ORDER BY a;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES(1,'apple'),(2,'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
DELETE FROM t2 WHERE id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;
SELECT * FROM t2 ORDER BY 1;
CREATE TABLE t1(x);
CREATE TABLE t2(c);
CREATE TRIGGER r1 AFTER INSERT ON t2 BEGIN
UPDATE t2 SET (c)=(
EXISTS(SELECT 1 WHERE (WITH cte1(a) AS (SELECT 1 FROM t1 WHERE (SELECT 1 WHERE (WITH cte2(b) AS (VALUES(1))SELECT b FROM cte2)))SELECT a FROM cte1))
);
END;
ALTER TABLE t2 RENAME TO t3;
SELECT name FROM sqlite_schema WHERE sql LIKE '%t2%';
SELECT name FROM sqlite_schema WHERE sql LIKE '%t3%' ORDER BY name;
CREATE TABLE t1(a INT) STRICT;
INSERT INTO t1(a) VALUES(45);
DELETE FROM t1;
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT x'313233';