OLD | NEW |
1 # 2014 Dec 20 | 1 # 2014 Dec 20 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 set doc | 56 set doc |
57 } | 57 } |
58 db func rnddoc rnddoc | 58 db func rnddoc rnddoc |
59 | 59 |
60 do_execsql_test 2.2 { | 60 do_execsql_test 2.2 { |
61 WITH r(a, b) AS ( | 61 WITH r(a, b) AS ( |
62 SELECT rnddoc(6), rnddoc(6) UNION ALL | 62 SELECT rnddoc(6), rnddoc(6) UNION ALL |
63 SELECT rnddoc(6), rnddoc(6) FROM r | 63 SELECT rnddoc(6), rnddoc(6) FROM r |
64 ) | 64 ) |
65 INSERT INTO x1 SELECT * FROM r LIMIT 10000; | 65 INSERT INTO x1 SELECT * FROM r LIMIT 10000; |
| 66 DELETE FROM x1 WHERE (rowid%2); |
66 } | 67 } |
67 | 68 |
68 set res [db one {SELECT count(*) FROM x1_data}] | 69 set res [db one {SELECT count(*) FROM x1_data}] |
69 do_execsql_test 2.3 { | 70 do_execsql_test 2.3 { |
70 SELECT count(fts5_decode(rowid, block)) FROM x1_data; | 71 SELECT count(fts5_decode(rowid, block)) FROM x1_data; |
71 } $res | 72 } $res |
72 do_execsql_test 2.4 { | 73 do_execsql_test 2.4 { |
73 UPDATE x1_data SET block = X''; | 74 UPDATE x1_data SET block = X''; |
74 -- SELECT count(fts5_decode(rowid, block)) FROM x1_data; | 75 SELECT count(fts5_decode(rowid, block)) FROM x1_data; |
75 SELECT count(*) FROM x1_data; | |
76 } $res | 76 } $res |
77 | 77 |
78 do_execsql_test 2.5 { | 78 do_execsql_test 2.5 { |
79 INSERT INTO x1(x1, rank) VALUES('pgsz', 1024); | 79 INSERT INTO x1(x1, rank) VALUES('pgsz', 1024); |
80 INSERT INTO x1(x1) VALUES('rebuild'); | 80 INSERT INTO x1(x1) VALUES('rebuild'); |
81 } | 81 } |
82 | 82 |
83 set res [db one {SELECT count(*) FROM x1_data}] | 83 set res [db one {SELECT count(*) FROM x1_data}] |
84 do_execsql_test 2.6 { | 84 do_execsql_test 2.6 { |
85 SELECT count(fts5_decode(rowid, block)) FROM x1_data; | 85 SELECT count(fts5_decode(rowid, block)) FROM x1_data; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 do_execsql_test 5.1 { | 178 do_execsql_test 5.1 { |
179 SELECT rowid FROM x4 WHERE x4 MATCH 'a' | 179 SELECT rowid FROM x4 WHERE x4 MATCH 'a' |
180 } {1 2 3 4} | 180 } {1 2 3 4} |
181 | 181 |
182 set res [db one {SELECT count(*) FROM x4_data}] | 182 set res [db one {SELECT count(*) FROM x4_data}] |
183 do_execsql_test 5.2 { | 183 do_execsql_test 5.2 { |
184 SELECT count(fts5_decode(rowid, block)) FROM x4_data; | 184 SELECT count(fts5_decode(rowid, block)) FROM x4_data; |
185 } $res | 185 } $res |
186 | 186 |
| 187 #------------------------------------------------------------------------- |
| 188 # |
| 189 |
| 190 do_execsql_test 6.0 { |
| 191 CREATE VIRTUAL TABLE x5 USING fts5(x, detail=none); |
| 192 INSERT INTO x5(x5, rank) VALUES('pgsz', 32); |
| 193 INSERT INTO x5 VALUES('a b c d e f'); |
| 194 INSERT INTO x5 VALUES('a b c d e f'); |
| 195 INSERT INTO x5 VALUES('a b c d e f'); |
| 196 BEGIN; |
| 197 WITH s(i) AS ( |
| 198 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100 |
| 199 ) INSERT INTO x5 SELECT 'a b c d e f' FROM s; |
| 200 COMMIT; |
| 201 SELECT count(fts5_decode_none(rowid, block)) FROM x5_data; |
| 202 } {32} |
| 203 |
| 204 do_execsql_test 6.1 { |
| 205 DELETE FROM x5 WHERE rowid <= 2; |
| 206 SELECT count(fts5_decode_none(rowid, block)) FROM x5_data; |
| 207 } {34} |
| 208 |
| 209 do_execsql_test 6.2 { |
| 210 UPDATE x5 SET x='a b c d e f' WHERE rowid=3; |
| 211 SELECT count(fts5_decode_none(rowid, block)) FROM x5_data; |
| 212 } {36} |
| 213 |
| 214 #db eval {SELECT rowid, fts5_decode_none(rowid, block) aS r FROM x5_data} {puts
$r} |
| 215 |
| 216 |
| 217 |
187 finish_test | 218 finish_test |
188 | 219 |
OLD | NEW |