mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-15 19:09:41 +00:00
ad79ef48a2
* add tests * add bench
34 lines
826 B
Plaintext
34 lines
826 B
Plaintext
|
|
CREATE VIRTUAL TABLE ft USING fts3;
|
|
INSERT INTO ft(rowid, content) VALUES(1, '1 2 3');
|
|
INSERT INTO ft(rowid, content) VALUES(2, '4 5 6');
|
|
INSERT INTO ft(rowid, content) VALUES(3, '7 8 9');
|
|
|
|
|
|
CREATE TABLE t1(x);
|
|
|
|
CREATE TRIGGER t1_ai AFTER INSERT ON t1 BEGIN
|
|
DELETE FROM ft WHERE rowid=new.x;
|
|
END;
|
|
|
|
CREATE TRIGGER t1_ad AFTER DELETE ON t1 BEGIN
|
|
UPDATE ft SET content = 'a b c' WHERE rowid=old.x;
|
|
END;
|
|
|
|
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 BEGIN
|
|
DELETE FROM ft WHERE rowid=old.x;
|
|
END;
|
|
|
|
|
|
CREATE VIRTUAL TABLE zt USING fts4(a, b);
|
|
INSERT INTO zt(rowid, a, b) VALUES(1, 'unus duo', NULL);
|
|
INSERT INTO zt(rowid, a, b) VALUES(2, NULL, NULL);
|
|
|
|
BEGIN;
|
|
UPDATE zt SET b='septum' WHERE rowid = 1;
|
|
UPDATE zt SET b='octo' WHERE rowid = 1;
|
|
COMMIT;
|
|
|
|
SELECT count(*) FROM zt_segdir;
|
|
|