OLD | NEW |
1 # 2006 September 9 | 1 # 2006 September 9 |
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 # errors in query expressions. This is done using a real fts3 table and | 329 # errors in query expressions. This is done using a real fts3 table and |
330 # MATCH clauses, not the parser test interface. | 330 # MATCH clauses, not the parser test interface. |
331 # | 331 # |
332 do_test fts3expr-4.1 { | 332 do_test fts3expr-4.1 { |
333 execsql { CREATE VIRTUAL TABLE t1 USING fts3(a, b, c) } | 333 execsql { CREATE VIRTUAL TABLE t1 USING fts3(a, b, c) } |
334 } {} | 334 } {} |
335 | 335 |
336 # Mismatched parenthesis: | 336 # Mismatched parenthesis: |
337 do_test fts3expr-4.2.1 { | 337 do_test fts3expr-4.2.1 { |
338 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example AND (hello OR world))' } | 338 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example AND (hello OR world))' } |
339 } {1 {SQL logic error or missing database}} | 339 } {1 {malformed MATCH expression: [example AND (hello OR world))]}} |
340 do_test fts3expr-4.2.2 { | 340 do_test fts3expr-4.2.2 { |
341 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example AND (hello OR world' } | 341 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example AND (hello OR world' } |
342 } {1 {SQL logic error or missing database}} | 342 } {1 {malformed MATCH expression: [example AND (hello OR world]}} |
343 do_test fts3expr-4.2.3 { | 343 do_test fts3expr-4.2.3 { |
344 catchsql { SELECT * FROM t1 WHERE t1 MATCH '(hello' } | 344 catchsql { SELECT * FROM t1 WHERE t1 MATCH '(hello' } |
345 } {1 {SQL logic error or missing database}} | 345 } {1 {malformed MATCH expression: [(hello]}} |
346 do_test fts3expr-4.2.4 { | 346 do_test fts3expr-4.2.4 { |
347 catchsql { SELECT * FROM t1 WHERE t1 MATCH '(' } | 347 catchsql { SELECT * FROM t1 WHERE t1 MATCH '(' } |
348 } {1 {SQL logic error or missing database}} | 348 } {1 {malformed MATCH expression: [(]}} |
349 do_test fts3expr-4.2.5 { | 349 do_test fts3expr-4.2.5 { |
350 catchsql { SELECT * FROM t1 WHERE t1 MATCH ')' } | 350 catchsql { SELECT * FROM t1 WHERE t1 MATCH ')' } |
351 } {1 {SQL logic error or missing database}} | 351 } {1 {malformed MATCH expression: [)]}} |
352 | 352 |
353 do_test fts3expr-4.2.6 { | 353 do_test fts3expr-4.2.6 { |
354 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example (hello world' } | 354 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example (hello world' } |
355 } {1 {SQL logic error or missing database}} | 355 } {1 {malformed MATCH expression: [example (hello world]}} |
356 | 356 |
357 # Unterminated quotation marks: | 357 # Unterminated quotation marks: |
358 do_test fts3expr-4.3.1 { | 358 do_test fts3expr-4.3.1 { |
359 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example OR "hello world' } | 359 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example OR "hello world' } |
360 } {1 {SQL logic error or missing database}} | 360 } {1 {malformed MATCH expression: [example OR "hello world]}} |
361 do_test fts3expr-4.3.2 { | 361 do_test fts3expr-4.3.2 { |
362 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example OR hello world"' } | 362 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example OR hello world"' } |
363 } {1 {SQL logic error or missing database}} | 363 } {1 {malformed MATCH expression: [example OR hello world"]}} |
364 | 364 |
365 # Binary operators without the required operands. | 365 # Binary operators without the required operands. |
366 do_test fts3expr-4.4.1 { | 366 do_test fts3expr-4.4.1 { |
367 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'OR hello world' } | 367 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'OR hello world' } |
368 } {1 {SQL logic error or missing database}} | 368 } {1 {malformed MATCH expression: [OR hello world]}} |
369 do_test fts3expr-4.4.2 { | 369 do_test fts3expr-4.4.2 { |
370 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'hello world OR' } | 370 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'hello world OR' } |
371 } {1 {SQL logic error or missing database}} | 371 } {1 {malformed MATCH expression: [hello world OR]}} |
372 do_test fts3expr-4.4.3 { | 372 do_test fts3expr-4.4.3 { |
373 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one (hello world OR) two' } | 373 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one (hello world OR) two' } |
374 } {1 {SQL logic error or missing database}} | 374 } {1 {malformed MATCH expression: [one (hello world OR) two]}} |
375 do_test fts3expr-4.4.4 { | 375 do_test fts3expr-4.4.4 { |
376 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one (OR hello world) two' } | 376 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one (OR hello world) two' } |
377 } {1 {SQL logic error or missing database}} | 377 } {1 {malformed MATCH expression: [one (OR hello world) two]}} |
378 | 378 |
379 # NEAR operators with something other than phrases as arguments. | 379 # NEAR operators with something other than phrases as arguments. |
380 do_test fts3expr-4.5.1 { | 380 do_test fts3expr-4.5.1 { |
381 catchsql { SELECT * FROM t1 WHERE t1 MATCH '(hello OR world) NEAR one' } | 381 catchsql { SELECT * FROM t1 WHERE t1 MATCH '(hello OR world) NEAR one' } |
382 } {1 {SQL logic error or missing database}} | 382 } {1 {malformed MATCH expression: [(hello OR world) NEAR one]}} |
383 do_test fts3expr-4.5.2 { | 383 do_test fts3expr-4.5.2 { |
384 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one NEAR (hello OR world)' } | 384 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one NEAR (hello OR world)' } |
385 } {1 {SQL logic error or missing database}} | 385 } {1 {malformed MATCH expression: [one NEAR (hello OR world)]}} |
386 | 386 |
387 #------------------------------------------------------------------------ | 387 #------------------------------------------------------------------------ |
388 # The following OOM tests are designed to cover cases in fts3_expr.c. | 388 # The following OOM tests are designed to cover cases in fts3_expr.c. |
389 # | 389 # |
390 source $testdir/malloc_common.tcl | 390 source $testdir/malloc_common.tcl |
391 do_malloc_test fts3expr-malloc-1 -sqlbody { | 391 do_malloc_test fts3expr-malloc-1 -sqlbody { |
392 SELECT fts3_exprtest('simple', 'a b c "d e f"', 'a', 'b', 'c') | 392 SELECT fts3_exprtest('simple', 'a b c "d e f"', 'a', 'b', 'c') |
393 } | 393 } |
394 do_malloc_test fts3expr-malloc-2 -tclprep { | 394 do_malloc_test fts3expr-malloc-2 -tclprep { |
395 set sqlite_fts3_enable_parentheses 0 | 395 set sqlite_fts3_enable_parentheses 0 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 execsql { | 490 execsql { |
491 CREATE VIRTUAL TABLE test USING fts3 (keyword); | 491 CREATE VIRTUAL TABLE test USING fts3 (keyword); |
492 INSERT INTO test VALUES ('abc'); | 492 INSERT INTO test VALUES ('abc'); |
493 SELECT * FROM test WHERE keyword MATCH '""'; | 493 SELECT * FROM test WHERE keyword MATCH '""'; |
494 } | 494 } |
495 } {} | 495 } {} |
496 | 496 |
497 | 497 |
498 set sqlite_fts3_enable_parentheses 0 | 498 set sqlite_fts3_enable_parentheses 0 |
499 finish_test | 499 finish_test |
OLD | NEW |