mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-15 08:39:46 +00:00
ad79ef48a2
* add tests * add bench
216 lines
12 KiB
Plaintext
216 lines
12 KiB
Plaintext
|
|
BEGIN;
|
|
CREATE VIRTUAL TABLE ft USING fts3;
|
|
INSERT INTO ft VALUES('aback');
|
|
INSERT INTO ft VALUES('abaft');
|
|
INSERT INTO ft VALUES('abandon');
|
|
COMMIT;
|
|
|
|
|
|
SELECT quote(root) FROM ft_segdir;
|
|
|
|
|
|
UPDATE ft_segdir SET root = blob(
|
|
'0005616261636B03010200 FFFFFFFF0702 66740302020003046E646F6E03030200'
|
|
);
|
|
|
|
|
|
CREATE VIRTUAL TABLE ft USING fts3;
|
|
INSERT INTO ft(ft) VALUES('nodesize=32');
|
|
|
|
|
|
INSERT INTO ft(ft) VALUES('merge=1,4');
|
|
SELECT count(*) FROM ft_segdir;
|
|
SELECT count(*) FROM ft_segments;
|
|
|
|
|
|
SELECT quote(block) FROM ft_segments WHERE blockid=2
|
|
|
|
|
|
UPDATE ft_segments SET block =
|
|
blob('00056162633130031F0200 FFFFFFFF07FF55 66740302020003046E646F6E03030200')
|
|
WHERE blockid=2;
|
|
|
|
|
|
UPDATE ft_segments SET block =
|
|
blob('00056162633130031F0200 02FFFFFFFF07 66740302020003046E646F6E03030200')
|
|
WHERE blockid=2;
|
|
|
|
|
|
UPDATE ft_segments SET block =
|
|
blob('00056162633130031F0200 0202 6674 FFFFFF070302020003046E646F6E030200')
|
|
WHERE blockid=2;
|
|
|
|
|
|
CREATE VIRTUAL TABLE ft USING fts3;
|
|
INSERT INTO ft(ft) VALUES('nodesize=32');
|
|
|
|
|
|
SELECT quote(root) FROM ft_segdir
|
|
|
|
|
|
UPDATE ft_segdir
|
|
SET root = blob('0101056162633132FFFFFFFF070236030132030136');
|
|
|
|
|
|
CREATE VIRTUAL TABLE t1 USING fts3();
|
|
INSERT INTO t1 VALUES('one two three');
|
|
UPDATE t1_segdir SET start_block = 1;
|
|
|
|
|
|
INSERT INTO t1(t1) VALUES('optimize');
|
|
|
|
|
|
CREATE VIRTUAL TABLE Table0 USING fts3();
|
|
INSERT INTO Table0_segdir VALUES(1,NULL,1,NULL,NULL,NULL);
|
|
|
|
|
|
SELECT count(*) FROM t1 WHERE t1 MATCH '"json1 enable"';
|
|
|
|
|
|
PRAGMA writable_schema = 1;
|
|
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10)
|
|
INSERT INTO t1(a) SELECT randomblob(3000) FROM c;
|
|
|
|
|
|
CREATE VIRTUAL TABLE t1 USING fts3(a, content="");
|
|
INSERT INTO t1_segdir VALUES(0,0,0,0,'0 665',X'000261640303040002086970697363696e670301080001056c6971756103020c00050269700304040001036d65740301060001036e6a6d03080900010375746503050300000663696c6c756d0306020001066f6d6d6f646f0304070002096e736563746574757203010700050471756174030408000104756c7061030804000207706964617461740307050000086465736572756e740308070001016f0302030002036c6f720601040004050005016506020a00040300010375697303050200000265610304060001066975736d6f640302040001036c69740301090001036e696d13030300010373736503050b0002017403080b0001017403020900010175030604000101780304050002076365707465757203070100020a65726369746174696f6e030309000006667567696174030605000002696403080a0001016e070506040003030002086369646964756e740302060001047073756d030103000104727572650305040000066c61626f7265030208000502697303030b000502756d03080c0001046f72656d0301020000056d61676e6103020b000104696e696d0303050001056f6c6c69740308080000046e6973690304020001026f6e0307060002057374727564030308000104756c6c610306060000086f636361656361740307040001066666696369610308060000087061726961747572030607000107726f6964656e740307070000037175690308050003017303030700000d726570726568656e6465726974030507000003736564030202000103696e7403070300020174030105000103756e7403080200000674656d706f72030205000007756c6c616d636f03030a0001017409020700010200010300000576656c697403050a0002046e69616d0303060001086f6c75707461746503050900');
|
|
|
|
|
|
SELECT quote(matchinfo(t1, t1 ))==0 FROM t1 WHERE t1 MATCH 'e*';
|
|
|
|
|
|
BEGIN;
|
|
INSERT INTO t1(t1) SELECT x FROM t2;
|
|
UPDATE t1 SET b=quote(zeroblob(200)) WHERE a MATCH 'thread*';
|
|
|
|
|
|
INSERT INTO t1(t1) VALUES('optimize');
|
|
|
|
|
|
PRAGMA writable_schema = 1;
|
|
BEGIN;
|
|
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10)
|
|
INSERT INTO t1(a) SELECT randomblob(3000) FROM c;
|
|
|
|
|
|
INSERT INTO t1(t1) VALUES('optimize');
|
|
|
|
|
|
PRAGMA writable_schema = 1;
|
|
SELECT count(*) FROM (
|
|
SELECT t1, (t1) FROM t1 WHERE b MATCH 'x'
|
|
)
|
|
|
|
|
|
UPDATE t1 SET b=a;
|
|
|
|
|
|
CREATE VIRTUAL TABLE t1 USING fts3(a,b,c);
|
|
INSERT INTO t1_segdir VALUES(0,0,0,0,'0 592',X'00016dcb048ce6fbd3b2d68bfebf0101020200808080808080808020010202008080808080808080100102020080808080808080800801020200808080808080808004010202008080808080808080020102020080808080808080800101020200808080808080804001020200808080808080802001020200808080808080801001020200808080808080800801020200808080808080800401020200808080808080800201020200808080808080800101020200808080808080400102020080808080808020010202008080808080801001020200808080808080080102020080808080808004010202008080808080800201020200808080808080010102020080808080804001020200808080808020010202008080808080100102020080808080800801020200808080808004010202008080808080020102020080808080800101020200808080804001020200808080802001020200808080801001020200808080800801020200808080800401020200808080800201020200808080800101020200808080400102020080808020010202008080801001020200808080080102020080808004010202008080800201020200808080010102020080804001020200808020010202008080100102020080800801020200808004010202008080020102020080800101020200804001020200802001020200801001020200800801020200800401020200800201020200800101020200400102020020010202001001020200080102020004010202000201020200010102020001010202008080808080808080800101020200');
|
|
INSERT INTO t1_segdir VALUES(0,1,0,0,'0 18',X'00026d6d0d8ee6fbd3b2d68bfe7f01020200');
|
|
|
|
|
|
CREATE VIRTUAL TABLE f USING fts3(a,b);
|
|
INSERT INTO f VALUES (1, '1234');
|
|
INSERT INTO f_segdir VALUES (1,255,0,0,'1 255',x'00');
|
|
UPDATE f_segdir SET level = 0 WHERE level IN (
|
|
SELECT level FROM f_segdir LIMIT 1 OFFSET 1
|
|
);
|
|
INSERT INTO f_segdir VALUES (255,249,0,121,'0 0',x'00');
|
|
INSERT INTO f_content VALUES (255,0,x'ff');
|
|
INSERT INTO f_segdir VALUES (1,255,16,0,'1 255',x'00');
|
|
|
|
|
|
CREATE VIRTUAL TABLE f USING fts3(a,b);
|
|
INSERT INTO f_segdir VALUES (1,255,0,0,'1 255',x'0001ff000001ff000001ff000001ff000001ff00c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5bec5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5');
|
|
|
|
|
|
PRAGMA integrity_check;
|
|
|
|
|
|
CREATE VIRTUAL TABLE f USING fts3(a,b);
|
|
CREATE TABLE 'f_stat'(id INTEGER PRIMARY KEY, value BLOB);
|
|
INSERT INTO f_stat VALUES (1,x'11014101000101c5c5014b010164c5014b010101c50101c5c5010201010101014101000101c5c5014b010101c5014b010101c50101c5c501010100c50101c5c5010101010101e40201010101014101000201010101014101000101010201010101014101000101c5c503b5fefefe3afeffffc5c5c5c50101010101010201010101014101adadadadadadadadadadadad91adadadadadadadad0101c50101c5c501f9ffffffffffffffff0001010102010101010140f5000101c5c5014b010101c50101c5c501010101e6010201010101014101000101c5c5014b010101c50101c5c5010101114b0101c5c50101010a0101020101e60101');
|
|
|
|
|
|
CREATE VIRTUAL TABLE f USING fts3(a,b);
|
|
INSERT INTO f_segdir VALUES (28,0,0,0,'0 0',x'00');
|
|
INSERT INTO f_segdir VALUES (0,241,0,0,'0 0',x'0001000030310000f1');
|
|
|
|
|
|
UPDATE t1 SET b=a;
|
|
|
|
|
|
CREATE VIRTUAL TABLE t0 USING fts3(
|
|
col0 INTEGER PRIMARY KEY,
|
|
col1 VARCHAR(8),
|
|
col2 BINARY,
|
|
col3 BINARY
|
|
);
|
|
INSERT INTO t0_content VALUES(1,1,'1234','aaaa','bbbb');
|
|
INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'000131030782000103323334050101010200000461616161050101020200000462626262050101030200');
|
|
|
|
|
|
|
|
CREATE VIRTUAL TABLE t0 USING fts3(col0 INTEGER PRIMARY KEY, col1, col2 ,col3 );
|
|
INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',
|
|
X'0001310301020001033233340500010102000004616161bc050101020200000462626262050101030200'
|
|
);
|
|
|
|
|
|
SELECT 0==matchinfo(t0,'sx') FROM t0 WHERE t0 MATCH '1* 2 3 4 5 6 OR 1';
|
|
|
|
|
|
CREATE VIRTUAL TABLE t1 USING fts3(a,b,c);
|
|
INSERT INTO t1_segdir VALUES(0,0,0,0,'0 835',X'000130120106000106000106001f030001030001030000083230313630363039090107000107000107000001340901050001050001050000013509010400010400010400010730303030303030091c0400010400010400000662696e6172793c0301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000008636f3870696c657209010200010200010200000664627374617409070300010300010300010465627567090402000102000102000006656e61626c653f07020001020001020001020001020001020001020001020001020001030001010002020001020001020001020001120001020001020001020001020001020001087874656e73696f6e091f0400010400010400000466747334090a0300010300010400030135090d03000103000103000003676363090103000103000103000106656f706f6c790910030001030001030000056a736f6e310913030001030001030000046c6f6164091f030001030001030000036d6178091c02000102000102000105656d6f7279091c03000103000103000304737973350916030001030001030000066e6f636173653c02010202000301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000301020200030102020000046f6d6974091f020001020001020000057274726565091903000103000103000302696d3c010102020003010202000301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000301020200000a746872656164736166650922020001020001020000047674616209070400010400010400000178b401010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200');
|
|
|
|
|
|
SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'rtree ner "json1^enable"';
|
|
|
|
|
|
CREATE VIRTUAL TABLE f USING fts3(a, b);
|
|
|
|
|
|
INSERT INTO f_segdir VALUES(0,2,1111,0,0,X'00');
|
|
INSERT INTO f_segdir VALUES(0,3,0 ,0,0,X'00013003010200');
|
|
|
|
|
|
INSERT INTO f(f) VALUES ('merge=107,2');
|
|
|
|
|
|
CREATE VIRTUAL TABLE def USING fts3(xyz);
|
|
INSERT INTO def_segdir VALUES(0,0,0,0,0, X'0001310301c9000103323334050d81');
|
|
|
|
|
|
SELECT rowid FROM def WHERE def MATCH '1 NEAR 1'
|
|
|
|
|
|
CREATE VIRTUAL TABLE t0 USING fts3(col0 INTEGER PRIMARY KEY,col1 VARCHAR(8),col2 BINARY,col3 BINARY);
|
|
INSERT INTO t0_content VALUES(0,NULL,NULL,NULL,NULL);
|
|
INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'00013103010200010332333405010201ba00000461616161050101020200000462626262050101030200');
|
|
|
|
|
|
SELECT matchinfo(t0, t0) IS NULL FROM t0 WHERE t0 MATCH '1*'
|
|
|
|
|
|
CREATE VIRTUAL TABLE t0 USING fts3(a INTEGER PRIMARY KEY,b,c,d);
|
|
INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'0001310301c9000103323334050d8000f200000461616161050101020200000462626262050101030200');
|
|
|
|
|
|
CREATE VIRTUAL TABLE t1 USING fts3(a,b,c);
|
|
|
|
|
|
INSERT INTO t1_segdir VALUES(0,0,0,0,0,X'000130120106000106000106001f030001030001030000083230313630363039090107000107000107000001340901050001050001050000013509010400010400010400010730303030303030091c0400010400010400000662696e6172793c0301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000008636f6d70696c657209010200010200010200000664627374617409070300010300010300010465627567090402000102000102000006656e61626c653f07020001020001020001020001020001020001020001020001020001020001020001020001010001020001020001020001020001020001020001020001020001087874656e73696f6e091f0400010400010400000466747334090a0300010300010300030135090d03000103000103000003676363090103000103000103000106656f706f6c790910030001030001030000056a736f6e310913030001030001030000046c6f6164091f030001030001030000036d6178091c02000102000102000105656d6f7279091c03000103000103000304737973350916030001030001030000066e6f636173653c02010202000301020200030102020003010202000301020200030102020003010202000301020200030102020003010202000301020200030102020000046f6d6974091f020001020001020000057274726565091903000103000103000302696d3c01010202000301020200030102020003010202000301020200030102020003010202000301a202000301020200030102020003010202000301020200000a746872656164736166650922020001020001020000047674616209070400010400010400000178b401010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200010101020001010102000101010200');
|
|
INSERT INTO t1_segdir VALUES(0,1,0,0,0,X'0001300425061b000008323031363036303903250700000134032505000001350325040001073030303030303003251a000008636f6d70696c657203250200000664627374617403250a00010465627567032508000006656e61626c650925090504040404040001087874656e73696f6e03251d0000046674733403250d0003013503250f000003676363032503000106656f706f6c790325110000056a736f6e310325130000046c6f616403251c0000036d6178032518000105656d6f7279032519000304737973350325150000046f6d697403251b000005727472656503251700000a7468726561647361666503251e0000047674616333250b00');
|
|
|
|
|
|
SELECT NULL FROM t1 WHERE t1 MATCH '"^enable"'
|
|
|
|
|
|
SELECT*FROM t1 WHERE t1 MATCH'ATE"0"OR"2D:P"""ATE"0"OR"2:P"""';
|
|
|
|
|
|
SELECT rowid, quote(matchinfo(t1,'pcxybspcxybs')) FROM t1 WHERE t1 MATCH'ATE"0"OR"2:P"""';
|
|
|