OLD | NEW |
1 # 2008 June 26 | 1 # 2008 June 26 |
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 do_test fts3d-4.matches { | 207 do_test fts3d-4.matches { |
208 execsql { | 208 execsql { |
209 SELECT OFFSETS(t1) FROM t1 | 209 SELECT OFFSETS(t1) FROM t1 |
210 WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY docid; | 210 WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY docid; |
211 } | 211 } |
212 } [list {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4} \ | 212 } [list {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4} \ |
213 {0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} \ | 213 {0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} \ |
214 {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}] | 214 {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}] |
215 | 215 |
216 check_terms_all fts3d-4.1 {a four is one test that this three two was} | 216 puts [db eval {SELECT c FROM t1 } ] |
| 217 check_terms_all fts3d-4.1 {a four is test that this was} |
217 check_doclist_all fts3d-4.1.1 a {[1 0[2]] [2 0[2]] [3 0[2]]} | 218 check_doclist_all fts3d-4.1.1 a {[1 0[2]] [2 0[2]] [3 0[2]]} |
218 check_doclist_all fts3d-4.1.2 four {} | 219 check_doclist_all fts3d-4.1.2 four {} |
219 check_doclist_all fts3d-4.1.3 is {[1 0[1]] [3 0[1]]} | 220 check_doclist_all fts3d-4.1.3 is {[1 0[1]] [3 0[1]]} |
220 check_doclist_all fts3d-4.1.4 one {} | 221 #check_doclist_all fts3d-4.1.4 one {} |
221 check_doclist_all fts3d-4.1.5 test {[1 0[3]] [2 0[3]] [3 0[3]]} | 222 check_doclist_all fts3d-4.1.5 test {[1 0[3]] [2 0[3]] [3 0[3]]} |
222 check_doclist_all fts3d-4.1.6 that {[2 0[0]]} | 223 check_doclist_all fts3d-4.1.6 that {[2 0[0]]} |
223 check_doclist_all fts3d-4.1.7 this {[1 0[0]] [3 0[0]]} | 224 check_doclist_all fts3d-4.1.7 this {[1 0[0]] [3 0[0]]} |
224 check_doclist_all fts3d-4.1.8 three {} | 225 #check_doclist_all fts3d-4.1.8 three {} |
225 check_doclist_all fts3d-4.1.9 two {} | 226 #check_doclist_all fts3d-4.1.9 two {} |
226 check_doclist_all fts3d-4.1.10 was {[2 0[1]]} | 227 check_doclist_all fts3d-4.1.10 was {[2 0[1]]} |
227 | 228 |
228 check_terms fts3d-4.2 0 0 {a four test that was} | 229 check_terms fts3d-4.2 0 0 {a four test that was} |
229 check_doclist fts3d-4.2.1 0 0 a {[2 0[2]]} | 230 check_doclist fts3d-4.2.1 0 0 a {[2 0[2]]} |
230 check_doclist fts3d-4.2.2 0 0 four {[2]} | 231 check_doclist fts3d-4.2.2 0 0 four {[2]} |
231 check_doclist fts3d-4.2.3 0 0 test {[2 0[3]]} | 232 check_doclist fts3d-4.2.3 0 0 test {[2 0[3]]} |
232 check_doclist fts3d-4.2.4 0 0 that {[2 0[0]]} | 233 check_doclist fts3d-4.2.4 0 0 that {[2 0[0]]} |
233 check_doclist fts3d-4.2.5 0 0 was {[2 0[1]]} | 234 check_doclist fts3d-4.2.5 0 0 was {[2 0[1]]} |
234 | 235 |
235 check_terms fts3d-4.3 0 1 {a four is test this} | 236 check_terms fts3d-4.3 0 1 {a four is test this} |
236 check_doclist fts3d-4.3.1 0 1 a {[3 0[2]]} | 237 check_doclist fts3d-4.3.1 0 1 a {[3 0[2]]} |
237 check_doclist fts3d-4.3.2 0 1 four {[3]} | 238 check_doclist fts3d-4.3.2 0 1 four {[3]} |
238 check_doclist fts3d-4.3.3 0 1 is {[3 0[1]]} | 239 check_doclist fts3d-4.3.3 0 1 is {[3 0[1]]} |
239 check_doclist fts3d-4.3.4 0 1 test {[3 0[3]]} | 240 check_doclist fts3d-4.3.4 0 1 test {[3 0[3]]} |
240 check_doclist fts3d-4.3.5 0 1 this {[3 0[0]]} | 241 check_doclist fts3d-4.3.5 0 1 this {[3 0[0]]} |
241 | 242 |
242 check_terms fts3d-4.4 1 0 {a four is one test that this three two was} | 243 check_terms fts3d-4.4 1 0 {a four is test that this was} |
243 check_doclist fts3d-4.4.1 1 0 a {[1 0[2]] [2 0[2]] [3 0[2]]} | 244 check_doclist fts3d-4.4.1 1 0 a {[1 0[2]] [2 0[2]] [3 0[2]]} |
244 check_doclist fts3d-4.4.2 1 0 four {[1] [2 0[4]] [3 0[4]]} | 245 check_doclist fts3d-4.4.2 1 0 four {[2 0[4]] [3 0[4]]} |
245 check_doclist fts3d-4.4.3 1 0 is {[1 0[1]] [3 0[1]]} | 246 check_doclist fts3d-4.4.3 1 0 is {[1 0[1]] [3 0[1]]} |
246 check_doclist fts3d-4.4.4 1 0 one {[1] [2] [3]} | 247 #check_doclist fts3d-4.4.4 1 0 one {[1] [2] [3]} |
247 check_doclist fts3d-4.4.5 1 0 test {[1 0[3]] [2 0[3]] [3 0[3]]} | 248 check_doclist fts3d-4.4.5 1 0 test {[1 0[3]] [2 0[3]] [3 0[3]]} |
248 check_doclist fts3d-4.4.6 1 0 that {[2 0[0]]} | 249 check_doclist fts3d-4.4.6 1 0 that {[2 0[0]]} |
249 check_doclist fts3d-4.4.7 1 0 this {[1 0[0]] [3 0[0]]} | 250 check_doclist fts3d-4.4.7 1 0 this {[1 0[0]] [3 0[0]]} |
250 check_doclist fts3d-4.4.8 1 0 three {[1] [2] [3]} | 251 #check_doclist fts3d-4.4.8 1 0 three {[1] [2] [3]} |
251 check_doclist fts3d-4.4.9 1 0 two {[1] [2] [3]} | 252 #check_doclist fts3d-4.4.9 1 0 two {[1] [2] [3]} |
252 check_doclist fts3d-4.4.10 1 0 was {[2 0[1]]} | 253 check_doclist fts3d-4.4.10 1 0 was {[2 0[1]]} |
253 | 254 |
254 # Optimize should leave the result in the level of the highest-level | 255 # Optimize should leave the result in the level of the highest-level |
255 # prior segment. | 256 # prior segment. |
256 breakpoint | |
257 do_test fts3d-4.5 { | 257 do_test fts3d-4.5 { |
258 execsql { | 258 execsql { |
259 SELECT OPTIMIZE(t1) FROM t1 LIMIT 1; | 259 SELECT OPTIMIZE(t1) FROM t1 LIMIT 1; |
260 SELECT level, idx FROM t1_segdir ORDER BY level, idx; | 260 SELECT level, idx FROM t1_segdir ORDER BY level, idx; |
261 } | 261 } |
262 } {{Index optimized} 1 0} | 262 } {{Index optimized} 1 0} |
263 | 263 |
264 # Identical to fts3d-4.matches. | 264 # Identical to fts3d-4.matches. |
265 do_test fts3d-4.5.matches { | 265 do_test fts3d-4.5.matches { |
266 execsql { | 266 execsql { |
(...skipping 30 matching lines...) Expand all Loading... |
297 | 297 |
298 # Even if we move things around, still does nothing. | 298 # Even if we move things around, still does nothing. |
299 do_test fts3d-5.1 { | 299 do_test fts3d-5.1 { |
300 execsql { | 300 execsql { |
301 UPDATE t1_segdir SET level = 2 WHERE level = 1 AND idx = 0; | 301 UPDATE t1_segdir SET level = 2 WHERE level = 1 AND idx = 0; |
302 SELECT OPTIMIZE(t1) FROM t1 LIMIT 1; | 302 SELECT OPTIMIZE(t1) FROM t1 LIMIT 1; |
303 SELECT level, idx FROM t1_segdir ORDER BY level, idx; | 303 SELECT level, idx FROM t1_segdir ORDER BY level, idx; |
304 } | 304 } |
305 } {{Index already optimal} 2 0} | 305 } {{Index already optimal} 2 0} |
306 | 306 |
| 307 |
| 308 # ALTER TABLE RENAME should work regardless of the database encoding. |
| 309 # |
| 310 do_test fts3d-6.0 { |
| 311 db close |
| 312 forcedelete test.db |
| 313 sqlite3 db test.db |
| 314 db eval { |
| 315 PRAGMA encoding=UTF8; |
| 316 CREATE VIRTUAL TABLE fts USING fts3(a,b,c); |
| 317 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 318 } |
| 319 } {fts_content fts_segdir fts_segments} |
| 320 do_test fts3d-6.1 { |
| 321 db eval { |
| 322 ALTER TABLE fts RENAME TO xyz; |
| 323 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 324 } |
| 325 } {xyz_content xyz_segdir xyz_segments} |
| 326 do_test fts3d-6.2 { |
| 327 db close |
| 328 forcedelete test.db |
| 329 sqlite3 db test.db |
| 330 db eval { |
| 331 PRAGMA encoding=UTF16le; |
| 332 CREATE VIRTUAL TABLE fts USING fts3(a,b,c); |
| 333 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 334 } |
| 335 } {fts_content fts_segdir fts_segments} |
| 336 do_test fts3d-6.3 { |
| 337 db eval { |
| 338 ALTER TABLE fts RENAME TO xyz; |
| 339 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 340 } |
| 341 } {xyz_content xyz_segdir xyz_segments} |
| 342 do_test fts3d-6.4 { |
| 343 db close |
| 344 forcedelete test.db |
| 345 sqlite3 db test.db |
| 346 db eval { |
| 347 PRAGMA encoding=UTF16be; |
| 348 CREATE VIRTUAL TABLE fts USING fts3(a,b,c); |
| 349 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 350 } |
| 351 } {fts_content fts_segdir fts_segments} |
| 352 do_test fts3d-6.5 { |
| 353 db eval { |
| 354 ALTER TABLE fts RENAME TO xyz; |
| 355 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 356 } |
| 357 } {xyz_content xyz_segdir xyz_segments} |
| 358 |
| 359 # ALTER TABLE RENAME on an FTS3 table following an incr-merge op. |
| 360 # |
| 361 do_test fts3d-6.6 { |
| 362 execsql { INSERT INTO xyz(xyz) VALUES('merge=2,2') } |
| 363 sqlite3 db test.db |
| 364 execsql { |
| 365 ALTER TABLE xyz RENAME TO ott; |
| 366 SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
| 367 } |
| 368 } {ott_content ott_segdir ott_segments ott_stat} |
| 369 |
| 370 |
307 finish_test | 371 finish_test |
OLD | NEW |