Artifact
39b65c11913d277c91d7426c62cfc1d147d1b4e9a48fecd9e38f60d0b5a5f505:
- File
test/fts3aa.test
— part of check-in
[352413ee]
at
2017-04-17 16:07:25
on branch trunk
— Further improvements to test coverage in fts3.
(user:
dan
size: 8741)
[more...]
0000: 23 20 32 30 30 36 20 53 65 70 74 65 6d 62 65 72 # 2006 September
0010: 20 39 0a 23 0a 23 20 54 68 65 20 61 75 74 68 6f 9.#.# The autho
0020: 72 20 64 69 73 63 6c 61 69 6d 73 20 63 6f 70 79 r disclaims copy
0030: 72 69 67 68 74 20 74 6f 20 74 68 69 73 20 73 6f right to this so
0040: 75 72 63 65 20 63 6f 64 65 2e 20 20 49 6e 20 70 urce code. In p
0050: 6c 61 63 65 20 6f 66 0a 23 20 61 20 6c 65 67 61 lace of.# a lega
0060: 6c 20 6e 6f 74 69 63 65 2c 20 68 65 72 65 20 69 l notice, here i
0070: 73 20 61 20 62 6c 65 73 73 69 6e 67 3a 0a 23 0a s a blessing:.#.
0080: 23 20 20 20 20 4d 61 79 20 79 6f 75 20 64 6f 20 # May you do
0090: 67 6f 6f 64 20 61 6e 64 20 6e 6f 74 20 65 76 69 good and not evi
00a0: 6c 2e 0a 23 20 20 20 20 4d 61 79 20 79 6f 75 20 l..# May you
00b0: 66 69 6e 64 20 66 6f 72 67 69 76 65 6e 65 73 73 find forgiveness
00c0: 20 66 6f 72 20 79 6f 75 72 73 65 6c 66 20 61 6e for yourself an
00d0: 64 20 66 6f 72 67 69 76 65 20 6f 74 68 65 72 73 d forgive others
00e0: 2e 0a 23 20 20 20 20 4d 61 79 20 79 6f 75 20 73 ..# May you s
00f0: 68 61 72 65 20 66 72 65 65 6c 79 2c 20 6e 65 76 hare freely, nev
0100: 65 72 20 74 61 6b 69 6e 67 20 6d 6f 72 65 20 74 er taking more t
0110: 68 61 6e 20 79 6f 75 20 67 69 76 65 2e 0a 23 0a han you give..#.
0120: 23 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a #***************
0130: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0140: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0150: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0160: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 23 20 54 68 69 **********.# Thi
0170: 73 20 66 69 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 s file implement
0180: 73 20 72 65 67 72 65 73 73 69 6f 6e 20 74 65 73 s regression tes
0190: 74 73 20 66 6f 72 20 53 51 4c 69 74 65 20 6c 69 ts for SQLite li
01a0: 62 72 61 72 79 2e 20 20 54 68 65 0a 23 20 66 6f brary. The.# fo
01b0: 63 75 73 20 6f 66 20 74 68 69 73 20 73 63 72 69 cus of this scri
01c0: 70 74 20 69 73 20 74 65 73 74 69 6e 67 20 74 68 pt is testing th
01d0: 65 20 46 54 53 33 20 6d 6f 64 75 6c 65 2e 0a 23 e FTS3 module..#
01e0: 0a 23 20 24 49 64 3a 20 66 74 73 33 61 61 2e 74 .# $Id: fts3aa.t
01f0: 65 73 74 2c 76 20 31 2e 31 20 32 30 30 37 2f 30 est,v 1.1 2007/0
0200: 38 2f 32 30 20 31 37 3a 33 38 3a 34 32 20 73 68 8/20 17:38:42 sh
0210: 65 73 73 20 45 78 70 20 24 0a 23 0a 0a 73 65 74 ess Exp $.#..set
0220: 20 74 65 73 74 64 69 72 20 5b 66 69 6c 65 20 64 testdir [file d
0230: 69 72 6e 61 6d 65 20 24 61 72 67 76 30 5d 0a 73 irname $argv0].s
0240: 6f 75 72 63 65 20 24 74 65 73 74 64 69 72 2f 74 ource $testdir/t
0250: 65 73 74 65 72 2e 74 63 6c 0a 73 65 74 20 74 65 ester.tcl.set te
0260: 73 74 70 72 65 66 69 78 20 66 74 73 33 61 61 0a stprefix fts3aa.
0270: 0a 23 20 49 66 20 53 51 4c 49 54 45 5f 45 4e 41 .# If SQLITE_ENA
0280: 42 4c 45 5f 46 54 53 33 20 69 73 20 64 65 66 69 BLE_FTS3 is defi
0290: 6e 65 64 2c 20 6f 6d 69 74 20 74 68 69 73 20 66 ned, omit this f
02a0: 69 6c 65 2e 0a 69 66 63 61 70 61 62 6c 65 20 21 ile..ifcapable !
02b0: 66 74 73 33 20 7b 0a 20 20 66 69 6e 69 73 68 5f fts3 {. finish_
02c0: 74 65 73 74 0a 20 20 72 65 74 75 72 6e 0a 7d 0a test. return.}.
02d0: 0a 23 20 43 6f 6e 73 74 72 75 63 74 20 61 20 66 .# Construct a f
02e0: 75 6c 6c 2d 74 65 78 74 20 73 65 61 72 63 68 20 ull-text search
02f0: 74 61 62 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 table containing
0300: 20 66 69 76 65 20 6b 65 79 77 6f 72 64 73 3a 0a five keywords:.
0310: 23 20 6f 6e 65 2c 20 74 77 6f 2c 20 74 68 72 65 # one, two, thre
0320: 65 2c 20 66 6f 75 72 2c 20 61 6e 64 20 66 69 76 e, four, and fiv
0330: 65 2c 20 69 6e 20 76 61 72 69 6f 75 73 20 63 6f e, in various co
0340: 6d 62 69 6e 61 74 69 6f 6e 73 2e 20 20 54 68 65 mbinations. The
0350: 0a 23 20 72 6f 77 69 64 20 66 6f 72 20 65 61 63 .# rowid for eac
0360: 68 20 77 69 6c 6c 20 62 65 20 61 20 62 69 74 6d h will be a bitm
0370: 61 73 6b 20 66 6f 72 20 74 68 65 20 65 6c 65 6d ask for the elem
0380: 65 6e 74 73 20 69 74 20 63 6f 6e 74 61 69 6e 73 ents it contains
0390: 2e 0a 23 0a 64 62 20 65 76 61 6c 20 7b 0a 20 20 ..#.db eval {.
03a0: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 CREATE VIRTUAL T
03b0: 41 42 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 ABLE t1 USING ft
03c0: 73 33 28 63 6f 6e 74 65 6e 74 29 3b 0a 20 20 49 s3(content);. I
03d0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28 63 6f NSERT INTO t1(co
03e0: 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 28 27 6f ntent) VALUES('o
03f0: 6e 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 ne');. INSERT I
0400: 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 20 NTO t1(content)
0410: 56 41 4c 55 45 53 28 27 74 77 6f 27 29 3b 0a 20 VALUES('two');.
0420: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28 INSERT INTO t1(
0430: 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 28 content) VALUES(
0440: 27 6f 6e 65 20 74 77 6f 27 29 3b 0a 20 20 49 4e 'one two');. IN
0450: 53 45 52 54 20 49 4e 54 4f 20 74 31 28 63 6f 6e SERT INTO t1(con
0460: 74 65 6e 74 29 20 56 41 4c 55 45 53 28 27 74 68 tent) VALUES('th
0470: 72 65 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 ree');. INSERT
0480: 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 INTO t1(content)
0490: 20 56 41 4c 55 45 53 28 27 6f 6e 65 20 74 68 72 VALUES('one thr
04a0: 65 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 ee');. INSERT I
04b0: 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 20 NTO t1(content)
04c0: 56 41 4c 55 45 53 28 27 74 77 6f 20 74 68 72 65 VALUES('two thre
04d0: 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e e');. INSERT IN
04e0: 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 20 56 TO t1(content) V
04f0: 41 4c 55 45 53 28 27 6f 6e 65 20 74 77 6f 20 74 ALUES('one two t
0500: 68 72 65 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 hree');. INSERT
0510: 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 INTO t1(content
0520: 29 20 56 41 4c 55 45 53 28 27 66 6f 75 72 27 29 ) VALUES('four')
0530: 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 ;. INSERT INTO
0540: 74 31 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 t1(content) VALU
0550: 45 53 28 27 6f 6e 65 20 66 6f 75 72 27 29 3b 0a ES('one four');.
0560: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 INSERT INTO t1
0570: 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 (content) VALUES
0580: 28 27 74 77 6f 20 66 6f 75 72 27 29 3b 0a 20 20 ('two four');.
0590: 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28 63 INSERT INTO t1(c
05a0: 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 28 27 ontent) VALUES('
05b0: 6f 6e 65 20 74 77 6f 20 66 6f 75 72 27 29 3b 0a one two four');.
05c0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 INSERT INTO t1
05d0: 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 (content) VALUES
05e0: 28 27 74 68 72 65 65 20 66 6f 75 72 27 29 3b 0a ('three four');.
05f0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 INSERT INTO t1
0600: 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 (content) VALUES
0610: 28 27 6f 6e 65 20 74 68 72 65 65 20 66 6f 75 72 ('one three four
0620: 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 ');. INSERT INT
0630: 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 20 56 41 O t1(content) VA
0640: 4c 55 45 53 28 27 74 77 6f 20 74 68 72 65 65 20 LUES('two three
0650: 66 6f 75 72 27 29 3b 0a 20 20 49 4e 53 45 52 54 four');. INSERT
0660: 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 INTO t1(content
0670: 29 20 56 41 4c 55 45 53 28 27 6f 6e 65 20 74 77 ) VALUES('one tw
0680: 6f 20 74 68 72 65 65 20 66 6f 75 72 27 29 3b 0a o three four');.
0690: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 INSERT INTO t1
06a0: 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 (content) VALUES
06b0: 28 27 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 ('five');. INSE
06c0: 52 54 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 RT INTO t1(conte
06d0: 6e 74 29 20 56 41 4c 55 45 53 28 27 6f 6e 65 20 nt) VALUES('one
06e0: 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 five');. INSERT
06f0: 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 INTO t1(content
0700: 29 20 56 41 4c 55 45 53 28 27 74 77 6f 20 66 69 ) VALUES('two fi
0710: 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 ve');. INSERT I
0720: 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 20 NTO t1(content)
0730: 56 41 4c 55 45 53 28 27 6f 6e 65 20 74 77 6f 20 VALUES('one two
0740: 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 five');. INSERT
0750: 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 INTO t1(content
0760: 29 20 56 41 4c 55 45 53 28 27 74 68 72 65 65 20 ) VALUES('three
0770: 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 five');. INSERT
0780: 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 INTO t1(content
0790: 29 20 56 41 4c 55 45 53 28 27 6f 6e 65 20 74 68 ) VALUES('one th
07a0: 72 65 65 20 66 69 76 65 27 29 3b 0a 20 20 49 4e ree five');. IN
07b0: 53 45 52 54 20 49 4e 54 4f 20 74 31 28 63 6f 6e SERT INTO t1(con
07c0: 74 65 6e 74 29 20 56 41 4c 55 45 53 28 27 74 77 tent) VALUES('tw
07d0: 6f 20 74 68 72 65 65 20 66 69 76 65 27 29 3b 0a o three five');.
07e0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 INSERT INTO t1
07f0: 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 (content) VALUES
0800: 28 27 6f 6e 65 20 74 77 6f 20 74 68 72 65 65 20 ('one two three
0810: 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 five');. INSERT
0820: 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 INTO t1(content
0830: 29 20 56 41 4c 55 45 53 28 27 66 6f 75 72 20 66 ) VALUES('four f
0840: 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 ive');. INSERT
0850: 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 INTO t1(content)
0860: 20 56 41 4c 55 45 53 28 27 6f 6e 65 20 66 6f 75 VALUES('one fou
0870: 72 20 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 r five');. INSE
0880: 52 54 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 RT INTO t1(conte
0890: 6e 74 29 20 56 41 4c 55 45 53 28 27 74 77 6f 20 nt) VALUES('two
08a0: 66 6f 75 72 20 66 69 76 65 27 29 3b 0a 20 20 49 four five');. I
08b0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28 63 6f NSERT INTO t1(co
08c0: 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 28 27 6f ntent) VALUES('o
08d0: 6e 65 20 74 77 6f 20 66 6f 75 72 20 66 69 76 65 ne two four five
08e0: 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 ');. INSERT INT
08f0: 4f 20 74 31 28 63 6f 6e 74 65 6e 74 29 20 56 41 O t1(content) VA
0900: 4c 55 45 53 28 27 74 68 72 65 65 20 66 6f 75 72 LUES('three four
0910: 20 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 45 52 five');. INSER
0920: 54 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 65 6e T INTO t1(conten
0930: 74 29 20 56 41 4c 55 45 53 28 27 6f 6e 65 20 74 t) VALUES('one t
0940: 68 72 65 65 20 66 6f 75 72 20 66 69 76 65 27 29 hree four five')
0950: 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 ;. INSERT INTO
0960: 74 31 28 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 t1(content) VALU
0970: 45 53 28 27 74 77 6f 20 74 68 72 65 65 20 66 6f ES('two three fo
0980: 75 72 20 66 69 76 65 27 29 3b 0a 20 20 49 4e 53 ur five');. INS
0990: 45 52 54 20 49 4e 54 4f 20 74 31 28 63 6f 6e 74 ERT INTO t1(cont
09a0: 65 6e 74 29 20 56 41 4c 55 45 53 28 27 6f 6e 65 ent) VALUES('one
09b0: 20 74 77 6f 20 74 68 72 65 65 20 66 6f 75 72 20 two three four
09c0: 66 69 76 65 27 29 3b 0a 7d 0a 0a 64 6f 5f 74 65 five');.}..do_te
09d0: 73 74 20 66 74 73 33 61 61 2d 31 2e 31 20 7b 0a st fts3aa-1.1 {.
09e0: 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 execsql {SELEC
09f0: 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 T rowid FROM t1
0a00: 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 WHERE content MA
0a10: 54 43 48 20 27 6f 6e 65 27 7d 0a 7d 20 7b 31 20 TCH 'one'}.} {1
0a20: 33 20 35 20 37 20 39 20 31 31 20 31 33 20 31 35 3 5 7 9 11 13 15
0a30: 20 31 37 20 31 39 20 32 31 20 32 33 20 32 35 20 17 19 21 23 25
0a40: 32 37 20 32 39 20 33 31 7d 0a 64 6f 5f 74 65 73 27 29 31}.do_tes
0a50: 74 20 66 74 73 33 61 61 2d 31 2e 32 20 7b 0a 20 t fts3aa-1.2 {.
0a60: 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 execsql {SELECT
0a70: 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 57 rowid FROM t1 W
0a80: 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 HERE content MAT
0a90: 43 48 20 27 6f 6e 65 20 74 77 6f 27 7d 0a 7d 20 CH 'one two'}.}
0aa0: 7b 33 20 37 20 31 31 20 31 35 20 31 39 20 32 33 {3 7 11 15 19 23
0ab0: 20 32 37 20 33 31 7d 0a 64 6f 5f 74 65 73 74 20 27 31}.do_test
0ac0: 66 74 73 33 61 61 2d 31 2e 33 20 7b 0a 20 20 65 fts3aa-1.3 {. e
0ad0: 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 xecsql {SELECT r
0ae0: 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 owid FROM t1 WHE
0af0: 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 RE content MATCH
0b00: 20 27 74 77 6f 20 6f 6e 65 27 7d 0a 7d 20 7b 33 'two one'}.} {3
0b10: 20 37 20 31 31 20 31 35 20 31 39 20 32 33 20 32 7 11 15 19 23 2
0b20: 37 20 33 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 7 31}.do_test ft
0b30: 73 33 61 61 2d 31 2e 34 20 7b 0a 20 20 65 78 65 s3aa-1.4 {. exe
0b40: 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 csql {SELECT row
0b50: 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 id FROM t1 WHERE
0b60: 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 content MATCH '
0b70: 6f 6e 65 20 74 77 6f 20 74 68 72 65 65 27 7d 0a one two three'}.
0b80: 7d 20 7b 37 20 31 35 20 32 33 20 33 31 7d 0a 64 } {7 15 23 31}.d
0b90: 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d 31 2e o_test fts3aa-1.
0ba0: 35 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b 53 5 {. execsql {S
0bb0: 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d ELECT rowid FROM
0bc0: 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 65 6e t1 WHERE conten
0bd0: 74 20 4d 41 54 43 48 20 27 6f 6e 65 20 74 68 72 t MATCH 'one thr
0be0: 65 65 20 74 77 6f 27 7d 0a 7d 20 7b 37 20 31 35 ee two'}.} {7 15
0bf0: 20 32 33 20 33 31 7d 0a 64 6f 5f 74 65 73 74 20 23 31}.do_test
0c00: 66 74 73 33 61 61 2d 31 2e 36 20 7b 0a 20 20 65 fts3aa-1.6 {. e
0c10: 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 xecsql {SELECT r
0c20: 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 owid FROM t1 WHE
0c30: 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 RE content MATCH
0c40: 20 27 74 77 6f 20 74 68 72 65 65 20 6f 6e 65 27 'two three one'
0c50: 7d 0a 7d 20 7b 37 20 31 35 20 32 33 20 33 31 7d }.} {7 15 23 31}
0c60: 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d .do_test fts3aa-
0c70: 31 2e 37 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 1.7 {. execsql
0c80: 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 {SELECT rowid FR
0c90: 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 OM t1 WHERE cont
0ca0: 65 6e 74 20 4d 41 54 43 48 20 27 74 77 6f 20 6f ent MATCH 'two o
0cb0: 6e 65 20 74 68 72 65 65 27 7d 0a 7d 20 7b 37 20 ne three'}.} {7
0cc0: 31 35 20 32 33 20 33 31 7d 0a 64 6f 5f 74 65 73 15 23 31}.do_tes
0cd0: 74 20 66 74 73 33 61 61 2d 31 2e 38 20 7b 0a 20 t fts3aa-1.8 {.
0ce0: 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 execsql {SELECT
0cf0: 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 57 rowid FROM t1 W
0d00: 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 HERE content MAT
0d10: 43 48 20 27 74 68 72 65 65 20 6f 6e 65 20 74 77 CH 'three one tw
0d20: 6f 27 7d 0a 7d 20 7b 37 20 31 35 20 32 33 20 33 o'}.} {7 15 23 3
0d30: 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 1}.do_test fts3a
0d40: 61 2d 31 2e 39 20 7b 0a 20 20 65 78 65 63 73 71 a-1.9 {. execsq
0d50: 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 l {SELECT rowid
0d60: 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f FROM t1 WHERE co
0d70: 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 74 68 72 ntent MATCH 'thr
0d80: 65 65 20 74 77 6f 20 6f 6e 65 27 7d 0a 7d 20 7b ee two one'}.} {
0d90: 37 20 31 35 20 32 33 20 33 31 7d 0a 64 6f 5f 74 7 15 23 31}.do_t
0da0: 65 73 74 20 66 74 73 33 61 61 2d 31 2e 31 30 20 est fts3aa-1.10
0db0: 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c {. execsql {SEL
0dc0: 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 ECT rowid FROM t
0dd0: 31 20 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 1 WHERE content
0de0: 4d 41 54 43 48 20 27 6f 6e 65 20 74 77 6f 20 54 MATCH 'one two T
0df0: 48 52 45 45 27 7d 0a 7d 20 7b 37 20 31 35 20 32 HREE'}.} {7 15 2
0e00: 33 20 33 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 3 31}.do_test ft
0e10: 73 33 61 61 2d 31 2e 31 31 20 7b 0a 20 20 65 78 s3aa-1.11 {. ex
0e20: 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f ecsql {SELECT ro
0e30: 77 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 wid FROM t1 WHER
0e40: 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 E content MATCH
0e50: 27 20 20 4f 4e 45 20 20 20 20 54 77 6f 20 20 20 ' ONE Two
0e60: 74 68 72 65 65 20 20 27 7d 0a 7d 20 7b 37 20 31 three '}.} {7 1
0e70: 35 20 32 33 20 33 31 7d 0a 0a 64 6f 5f 74 65 73 5 23 31}..do_tes
0e80: 74 20 66 74 73 33 61 61 2d 32 2e 31 20 7b 0a 20 t fts3aa-2.1 {.
0e90: 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 execsql {SELECT
0ea0: 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 57 rowid FROM t1 W
0eb0: 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 HERE content MAT
0ec0: 43 48 20 27 22 6f 6e 65 22 27 7d 0a 7d 20 7b 31 CH '"one"'}.} {1
0ed0: 20 33 20 35 20 37 20 39 20 31 31 20 31 33 20 31 3 5 7 9 11 13 1
0ee0: 35 20 31 37 20 31 39 20 32 31 20 32 33 20 32 35 5 17 19 21 23 25
0ef0: 20 32 37 20 32 39 20 33 31 7d 0a 64 6f 5f 74 65 27 29 31}.do_te
0f00: 73 74 20 66 74 73 33 61 61 2d 32 2e 32 20 7b 0a st fts3aa-2.2 {.
0f10: 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 execsql {SELEC
0f20: 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 T rowid FROM t1
0f30: 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 WHERE content MA
0f40: 54 43 48 20 27 22 6f 6e 65 20 74 77 6f 22 27 7d TCH '"one two"'}
0f50: 0a 7d 20 7b 33 20 37 20 31 31 20 31 35 20 31 39 .} {3 7 11 15 19
0f60: 20 32 33 20 32 37 20 33 31 7d 0a 64 6f 5f 74 65 23 27 31}.do_te
0f70: 73 74 20 66 74 73 33 61 61 2d 32 2e 33 20 7b 0a st fts3aa-2.3 {.
0f80: 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 execsql {SELEC
0f90: 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 T rowid FROM t1
0fa0: 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 WHERE content MA
0fb0: 54 43 48 20 27 22 74 77 6f 20 6f 6e 65 22 27 7d TCH '"two one"'}
0fc0: 0a 7d 20 7b 7d 0a 64 6f 5f 74 65 73 74 20 66 74 .} {}.do_test ft
0fd0: 73 33 61 61 2d 32 2e 34 20 7b 0a 20 20 65 78 65 s3aa-2.4 {. exe
0fe0: 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 csql {SELECT row
0ff0: 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 id FROM t1 WHERE
1000: 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 content MATCH '
1010: 22 6f 6e 65 20 74 77 6f 20 74 68 72 65 65 22 27 "one two three"'
1020: 7d 0a 7d 20 7b 37 20 31 35 20 32 33 20 33 31 7d }.} {7 15 23 31}
1030: 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d .do_test fts3aa-
1040: 32 2e 35 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 2.5 {. execsql
1050: 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 {SELECT rowid FR
1060: 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 OM t1 WHERE cont
1070: 65 6e 74 20 4d 41 54 43 48 20 27 22 6f 6e 65 20 ent MATCH '"one
1080: 74 68 72 65 65 20 74 77 6f 22 27 7d 0a 7d 20 7b three two"'}.} {
1090: 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 }.do_test fts3aa
10a0: 2d 32 2e 36 20 7b 0a 20 20 65 78 65 63 73 71 6c -2.6 {. execsql
10b0: 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 {SELECT rowid F
10c0: 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e ROM t1 WHERE con
10d0: 74 65 6e 74 20 4d 41 54 43 48 20 27 22 6f 6e 65 tent MATCH '"one
10e0: 20 74 77 6f 20 74 68 72 65 65 20 66 6f 75 72 22 two three four"
10f0: 27 7d 0a 7d 20 7b 31 35 20 33 31 7d 0a 64 6f 5f '}.} {15 31}.do_
1100: 74 65 73 74 20 66 74 73 33 61 61 2d 32 2e 37 20 test fts3aa-2.7
1110: 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c {. execsql {SEL
1120: 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 ECT rowid FROM t
1130: 31 20 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 1 WHERE content
1140: 4d 41 54 43 48 20 27 22 6f 6e 65 20 74 68 72 65 MATCH '"one thre
1150: 65 20 74 77 6f 20 66 6f 75 72 22 27 7d 0a 7d 20 e two four"'}.}
1160: 7b 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 {}.do_test fts3a
1170: 61 2d 32 2e 38 20 7b 0a 20 20 65 78 65 63 73 71 a-2.8 {. execsq
1180: 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 l {SELECT rowid
1190: 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f FROM t1 WHERE co
11a0: 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 22 6f 6e ntent MATCH '"on
11b0: 65 20 74 68 72 65 65 20 66 69 76 65 22 27 7d 0a e three five"'}.
11c0: 7d 20 7b 32 31 7d 0a 64 6f 5f 74 65 73 74 20 66 } {21}.do_test f
11d0: 74 73 33 61 61 2d 32 2e 39 20 7b 0a 20 20 65 78 ts3aa-2.9 {. ex
11e0: 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f ecsql {SELECT ro
11f0: 77 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 wid FROM t1 WHER
1200: 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 E content MATCH
1210: 27 22 6f 6e 65 20 74 68 72 65 65 22 20 66 69 76 '"one three" fiv
1220: 65 27 7d 0a 7d 20 7b 32 31 20 32 39 7d 0a 64 6f e'}.} {21 29}.do
1230: 5f 74 65 73 74 20 66 74 73 33 61 61 2d 32 2e 31 _test fts3aa-2.1
1240: 30 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b 53 0 {. execsql {S
1250: 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d ELECT rowid FROM
1260: 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 65 6e t1 WHERE conten
1270: 74 20 4d 41 54 43 48 20 27 66 69 76 65 20 22 6f t MATCH 'five "o
1280: 6e 65 20 74 68 72 65 65 22 27 7d 0a 7d 20 7b 32 ne three"'}.} {2
1290: 31 20 32 39 7d 0a 64 6f 5f 74 65 73 74 20 66 74 1 29}.do_test ft
12a0: 73 33 61 61 2d 32 2e 31 31 20 7b 0a 20 20 65 78 s3aa-2.11 {. ex
12b0: 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f ecsql {SELECT ro
12c0: 77 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 wid FROM t1 WHER
12d0: 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 E content MATCH
12e0: 27 66 69 76 65 20 22 6f 6e 65 20 74 68 72 65 65 'five "one three
12f0: 22 20 66 6f 75 72 27 7d 0a 7d 20 7b 32 39 7d 0a " four'}.} {29}.
1300: 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d 32 do_test fts3aa-2
1310: 2e 31 32 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 .12 {. execsql
1320: 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 {SELECT rowid FR
1330: 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 OM t1 WHERE cont
1340: 65 6e 74 20 4d 41 54 43 48 20 27 66 69 76 65 20 ent MATCH 'five
1350: 66 6f 75 72 20 22 6f 6e 65 20 74 68 72 65 65 22 four "one three"
1360: 27 7d 0a 7d 20 7b 32 39 7d 0a 64 6f 5f 74 65 73 '}.} {29}.do_tes
1370: 74 20 66 74 73 33 61 61 2d 32 2e 31 33 20 7b 0a t fts3aa-2.13 {.
1380: 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 execsql {SELEC
1390: 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 20 T rowid FROM t1
13a0: 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 4d 41 WHERE content MA
13b0: 54 43 48 20 27 22 6f 6e 65 20 74 68 72 65 65 22 TCH '"one three"
13c0: 20 66 6f 75 72 20 66 69 76 65 27 7d 0a 7d 20 7b four five'}.} {
13d0: 32 39 7d 0a 0a 64 6f 5f 74 65 73 74 20 66 74 73 29}..do_test fts
13e0: 33 61 61 2d 33 2e 31 20 7b 0a 20 20 65 78 65 63 3aa-3.1 {. exec
13f0: 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 sql {SELECT rowi
1400: 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 d FROM t1 WHERE
1410: 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 6f content MATCH 'o
1420: 6e 65 27 7d 0a 7d 20 7b 31 20 33 20 35 20 37 20 ne'}.} {1 3 5 7
1430: 39 20 31 31 20 31 33 20 31 35 20 31 37 20 31 39 9 11 13 15 17 19
1440: 20 32 31 20 32 33 20 32 35 20 32 37 20 32 39 20 21 23 25 27 29
1450: 33 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 31}.do_test fts3
1460: 61 61 2d 33 2e 32 20 7b 0a 20 20 65 78 65 63 73 aa-3.2 {. execs
1470: 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 ql {SELECT rowid
1480: 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 FROM t1 WHERE c
1490: 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 6f 6e ontent MATCH 'on
14a0: 65 20 2d 74 77 6f 27 7d 0a 7d 20 7b 31 20 35 20 e -two'}.} {1 5
14b0: 39 20 31 33 20 31 37 20 32 31 20 32 35 20 32 39 9 13 17 21 25 29
14c0: 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 }.do_test fts3aa
14d0: 2d 33 2e 33 20 7b 0a 20 20 65 78 65 63 73 71 6c -3.3 {. execsql
14e0: 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 {SELECT rowid F
14f0: 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e ROM t1 WHERE con
1500: 74 65 6e 74 20 4d 41 54 43 48 20 27 2d 74 77 6f tent MATCH '-two
1510: 20 6f 6e 65 27 7d 0a 7d 20 7b 31 20 35 20 39 20 one'}.} {1 5 9
1520: 31 33 20 31 37 20 32 31 20 32 35 20 32 39 7d 0a 13 17 21 25 29}.
1530: 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d .do_test fts3aa-
1540: 34 2e 31 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 4.1 {. execsql
1550: 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 {SELECT rowid FR
1560: 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 OM t1 WHERE cont
1570: 65 6e 74 20 4d 41 54 43 48 20 27 6f 6e 65 20 4f ent MATCH 'one O
1580: 52 20 74 77 6f 27 7d 0a 7d 20 7b 31 20 32 20 33 R two'}.} {1 2 3
1590: 20 35 20 36 20 37 20 39 20 31 30 20 31 31 20 31 5 6 7 9 10 11 1
15a0: 33 20 31 34 20 31 35 20 31 37 20 31 38 20 31 39 3 14 15 17 18 19
15b0: 20 32 31 20 32 32 20 32 33 20 32 35 20 32 36 20 21 22 23 25 26
15c0: 32 37 20 32 39 20 33 30 20 33 31 7d 0a 64 6f 5f 27 29 30 31}.do_
15d0: 74 65 73 74 20 66 74 73 33 61 61 2d 34 2e 32 20 test fts3aa-4.2
15e0: 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b 53 45 4c {. execsql {SEL
15f0: 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 ECT rowid FROM t
1600: 31 20 57 48 45 52 45 20 63 6f 6e 74 65 6e 74 20 1 WHERE content
1610: 4d 41 54 43 48 20 27 22 6f 6e 65 20 74 77 6f 22 MATCH '"one two"
1620: 20 4f 52 20 74 68 72 65 65 27 7d 0a 7d 20 7b 33 OR three'}.} {3
1630: 20 34 20 35 20 36 20 37 20 31 31 20 31 32 20 31 4 5 6 7 11 12 1
1640: 33 20 31 34 20 31 35 20 31 39 20 32 30 20 32 31 3 14 15 19 20 21
1650: 20 32 32 20 32 33 20 32 37 20 32 38 20 32 39 20 22 23 27 28 29
1660: 33 30 20 33 31 7d 0a 64 6f 5f 74 65 73 74 20 66 30 31}.do_test f
1670: 74 73 33 61 61 2d 34 2e 33 20 7b 0a 20 20 65 78 ts3aa-4.3 {. ex
1680: 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f ecsql {SELECT ro
1690: 77 69 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 wid FROM t1 WHER
16a0: 45 20 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 E content MATCH
16b0: 27 74 68 72 65 65 20 4f 52 20 22 6f 6e 65 20 74 'three OR "one t
16c0: 77 6f 22 27 7d 0a 7d 20 7b 33 20 34 20 35 20 36 wo"'}.} {3 4 5 6
16d0: 20 37 20 31 31 20 31 32 20 31 33 20 31 34 20 31 7 11 12 13 14 1
16e0: 35 20 31 39 20 32 30 20 32 31 20 32 32 20 32 33 5 19 20 21 22 23
16f0: 20 32 37 20 32 38 20 32 39 20 33 30 20 33 31 7d 27 28 29 30 31}
1700: 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d .do_test fts3aa-
1710: 34 2e 34 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 4.4 {. execsql
1720: 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 {SELECT rowid FR
1730: 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 OM t1 WHERE cont
1740: 65 6e 74 20 4d 41 54 43 48 20 27 6f 6e 65 20 74 ent MATCH 'one t
1750: 77 6f 20 4f 52 20 74 68 72 65 65 27 7d 0a 7d 20 wo OR three'}.}
1760: 7b 33 20 35 20 37 20 31 31 20 31 33 20 31 35 20 {3 5 7 11 13 15
1770: 31 39 20 32 31 20 32 33 20 32 37 20 32 39 20 33 19 21 23 27 29 3
1780: 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 61 1}.do_test fts3a
1790: 61 2d 34 2e 35 20 7b 0a 20 20 65 78 65 63 73 71 a-4.5 {. execsq
17a0: 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 20 l {SELECT rowid
17b0: 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 6f FROM t1 WHERE co
17c0: 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 74 68 72 ntent MATCH 'thr
17d0: 65 65 20 4f 52 20 74 77 6f 20 6f 6e 65 27 7d 0a ee OR two one'}.
17e0: 7d 20 7b 33 20 35 20 37 20 31 31 20 31 33 20 31 } {3 5 7 11 13 1
17f0: 35 20 31 39 20 32 31 20 32 33 20 32 37 20 32 39 5 19 21 23 27 29
1800: 20 33 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 31}.do_test fts
1810: 33 61 61 2d 34 2e 36 20 7b 0a 20 20 65 78 65 63 3aa-4.6 {. exec
1820: 73 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 sql {SELECT rowi
1830: 64 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 d FROM t1 WHERE
1840: 63 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 6f content MATCH 'o
1850: 6e 65 20 74 77 6f 20 4f 52 20 74 68 72 65 65 20 ne two OR three
1860: 4f 52 20 66 6f 75 72 27 7d 0a 7d 20 7b 33 20 35 OR four'}.} {3 5
1870: 20 37 20 39 20 31 31 20 31 33 20 31 35 20 31 39 7 9 11 13 15 19
1880: 20 32 31 20 32 33 20 32 35 20 32 37 20 32 39 20 21 23 25 27 29
1890: 33 31 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 31}.do_test fts3
18a0: 61 61 2d 34 2e 37 20 7b 0a 20 20 65 78 65 63 73 aa-4.7 {. execs
18b0: 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 ql {SELECT rowid
18c0: 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 63 FROM t1 WHERE c
18d0: 6f 6e 74 65 6e 74 20 4d 41 54 43 48 20 27 74 77 ontent MATCH 'tw
18e0: 6f 20 4f 52 20 74 68 72 65 65 20 4f 52 20 66 6f o OR three OR fo
18f0: 75 72 20 6f 6e 65 27 7d 0a 7d 20 7b 33 20 35 20 ur one'}.} {3 5
1900: 37 20 39 20 31 31 20 31 33 20 31 35 20 31 39 20 7 9 11 13 15 19
1910: 32 31 20 32 33 20 32 35 20 32 37 20 32 39 20 33 21 23 25 27 29 3
1920: 31 7d 0a 0a 23 20 54 65 73 74 20 74 68 65 20 61 1}..# Test the a
1930: 62 69 6c 69 74 79 20 74 6f 20 68 61 6e 64 6c 65 bility to handle
1940: 20 4e 55 4c 4c 20 63 6f 6e 74 65 6e 74 0a 23 0a NULL content.#.
1950: 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d 35 do_test fts3aa-5
1960: 2e 31 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b .1 {. execsql {
1970: 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28 63 INSERT INTO t1(c
1980: 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 28 4e ontent) VALUES(N
1990: 55 4c 4c 29 7d 0a 7d 20 7b 7d 0a 64 6f 5f 74 65 ULL)}.} {}.do_te
19a0: 73 74 20 66 74 73 33 61 61 2d 35 2e 32 20 7b 0a st fts3aa-5.2 {.
19b0: 20 20 73 65 74 20 72 6f 77 69 64 20 5b 64 62 20 set rowid [db
19c0: 6c 61 73 74 5f 69 6e 73 65 72 74 5f 72 6f 77 69 last_insert_rowi
19d0: 64 5d 0a 20 20 65 78 65 63 73 71 6c 20 7b 53 45 d]. execsql {SE
19e0: 4c 45 43 54 20 63 6f 6e 74 65 6e 74 20 46 52 4f LECT content FRO
19f0: 4d 20 74 31 20 57 48 45 52 45 20 72 6f 77 69 64 M t1 WHERE rowid
1a00: 3d 24 72 6f 77 69 64 7d 0a 7d 20 7b 7b 7d 7d 0a =$rowid}.} {{}}.
1a10: 64 6f 5f 74 65 73 74 20 66 74 73 33 61 61 2d 35 do_test fts3aa-5
1a20: 2e 33 20 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b .3 {. execsql {
1a30: 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f SELECT rowid FRO
1a40: 4d 20 74 31 20 57 48 45 52 45 20 63 6f 6e 74 65 M t1 WHERE conte
1a50: 6e 74 20 4d 41 54 43 48 20 4e 55 4c 4c 7d 0a 7d nt MATCH NULL}.}
1a60: 20 7b 7d 0a 0a 23 20 54 65 73 74 20 74 68 65 20 {}..# Test the
1a70: 61 62 69 6c 69 74 79 20 74 6f 20 68 61 6e 64 6c ability to handl
1a80: 65 20 6e 6f 6e 2d 70 6f 73 69 74 69 76 65 20 72 e non-positive r
1a90: 6f 77 69 64 73 0a 23 0a 64 6f 5f 74 65 73 74 20 owids.#.do_test
1aa0: 66 74 73 33 61 61 2d 36 2e 30 20 7b 0a 20 20 65 fts3aa-6.0 {. e
1ab0: 78 65 63 73 71 6c 20 7b 49 4e 53 45 52 54 20 49 xecsql {INSERT I
1ac0: 4e 54 4f 20 74 31 28 72 6f 77 69 64 2c 20 63 6f NTO t1(rowid, co
1ad0: 6e 74 65 6e 74 29 20 56 41 4c 55 45 53 28 30 2c ntent) VALUES(0,
1ae0: 20 27 66 6f 75 72 20 66 69 76 65 27 29 7d 0a 7d 'four five')}.}
1af0: 20 7b 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 {}.do_test fts3
1b00: 61 61 2d 36 2e 31 20 7b 0a 20 20 65 78 65 63 73 aa-6.1 {. execs
1b10: 71 6c 20 7b 53 45 4c 45 43 54 20 63 6f 6e 74 65 ql {SELECT conte
1b20: 6e 74 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 nt FROM t1 WHERE
1b30: 20 72 6f 77 69 64 20 3d 20 30 7d 0a 7d 20 7b 7b rowid = 0}.} {{
1b40: 66 6f 75 72 20 66 69 76 65 7d 7d 0a 64 6f 5f 74 four five}}.do_t
1b50: 65 73 74 20 66 74 73 33 61 61 2d 36 2e 32 20 7b est fts3aa-6.2 {
1b60: 0a 20 20 65 78 65 63 73 71 6c 20 7b 49 4e 53 45 . execsql {INSE
1b70: 52 54 20 49 4e 54 4f 20 74 31 28 72 6f 77 69 64 RT INTO t1(rowid
1b80: 2c 20 63 6f 6e 74 65 6e 74 29 20 56 41 4c 55 45 , content) VALUE
1b90: 53 28 2d 31 2c 20 27 74 68 72 65 65 20 66 6f 75 S(-1, 'three fou
1ba0: 72 27 29 7d 0a 7d 20 7b 7d 0a 64 6f 5f 74 65 73 r')}.} {}.do_tes
1bb0: 74 20 66 74 73 33 61 61 2d 36 2e 33 20 7b 0a 20 t fts3aa-6.3 {.
1bc0: 20 65 78 65 63 73 71 6c 20 7b 53 45 4c 45 43 54 execsql {SELECT
1bd0: 20 63 6f 6e 74 65 6e 74 20 46 52 4f 4d 20 74 31 content FROM t1
1be0: 20 57 48 45 52 45 20 72 6f 77 69 64 20 3d 20 2d WHERE rowid = -
1bf0: 31 7d 0a 7d 20 7b 7b 74 68 72 65 65 20 66 6f 75 1}.} {{three fou
1c00: 72 7d 7d 0a 64 6f 5f 74 65 73 74 20 66 74 73 33 r}}.do_test fts3
1c10: 61 61 2d 36 2e 34 20 7b 0a 20 20 65 78 65 63 73 aa-6.4 {. execs
1c20: 71 6c 20 7b 53 45 4c 45 43 54 20 72 6f 77 69 64 ql {SELECT rowid
1c30: 20 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 74 FROM t1 WHERE t
1c40: 31 20 4d 41 54 43 48 20 27 66 6f 75 72 27 7d 0a 1 MATCH 'four'}.
1c50: 7d 20 7b 2d 31 20 30 20 38 20 39 20 31 30 20 31 } {-1 0 8 9 10 1
1c60: 31 20 31 32 20 31 33 20 31 34 20 31 35 20 32 34 1 12 13 14 15 24
1c70: 20 32 35 20 32 36 20 32 37 20 32 38 20 32 39 20 25 26 27 28 29
1c80: 33 30 20 33 31 7d 0a 0a 23 20 54 65 73 74 20 63 30 31}..# Test c
1c90: 72 65 61 74 69 6f 6e 20 6f 66 20 46 54 53 33 20 reation of FTS3
1ca0: 61 6e 64 20 46 54 53 34 20 74 61 62 6c 65 73 20 and FTS4 tables
1cb0: 77 69 74 68 20 63 6f 6c 75 6d 6e 73 20 74 68 61 with columns tha
1cc0: 74 20 63 6f 6e 74 61 69 6e 0a 23 20 61 6e 20 22 t contain.# an "
1cd0: 3d 22 20 63 68 61 72 61 63 74 65 72 2e 0a 23 0a =" character..#.
1ce0: 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 do_execsql_test
1cf0: 66 74 73 33 61 61 2d 37 2e 31 20 7b 0a 20 20 43 fts3aa-7.1 {. C
1d00: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
1d10: 42 4c 45 20 74 32 20 55 53 49 4e 47 20 66 74 73 BLE t2 USING fts
1d20: 33 28 78 79 7a 3d 61 62 63 29 3b 0a 20 20 53 45 3(xyz=abc);. SE
1d30: 4c 45 43 54 20 78 79 7a 20 46 52 4f 4d 20 74 32 LECT xyz FROM t2
1d40: 3b 0a 7d 20 7b 7d 0a 64 6f 5f 63 61 74 63 68 73 ;.} {}.do_catchs
1d50: 71 6c 5f 74 65 73 74 20 66 74 73 33 61 61 2d 37 ql_test fts3aa-7
1d60: 2e 32 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 .2 {. CREATE VI
1d70: 52 54 55 41 4c 20 54 41 42 4c 45 20 74 33 20 55 RTUAL TABLE t3 U
1d80: 53 49 4e 47 20 66 74 73 34 28 78 79 7a 3d 61 62 SING fts4(xyz=ab
1d90: 63 29 3b 0a 7d 20 7b 31 20 7b 75 6e 72 65 63 6f c);.} {1 {unreco
1da0: 67 6e 69 7a 65 64 20 70 61 72 61 6d 65 74 65 72 gnized parameter
1db0: 3a 20 78 79 7a 3d 61 62 63 7d 7d 0a 64 6f 5f 63 : xyz=abc}}.do_c
1dc0: 61 74 63 68 73 71 6c 5f 74 65 73 74 20 66 74 73 atchsql_test fts
1dd0: 33 61 61 2d 37 2e 33 20 7b 0a 20 20 43 52 45 41 3aa-7.3 {. CREA
1de0: 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 TE VIRTUAL TABLE
1df0: 20 74 33 20 55 53 49 4e 47 20 66 74 73 34 28 78 t3 USING fts4(x
1e00: 79 7a 20 3d 20 61 62 63 29 3b 0a 7d 20 7b 31 20 yz = abc);.} {1
1e10: 7b 75 6e 72 65 63 6f 67 6e 69 7a 65 64 20 70 61 {unrecognized pa
1e20: 72 61 6d 65 74 65 72 3a 20 78 79 7a 20 3d 20 61 rameter: xyz = a
1e30: 62 63 7d 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c bc}}..do_execsql
1e40: 5f 74 65 73 74 20 66 74 73 33 61 61 2d 37 2e 34 _test fts3aa-7.4
1e50: 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 {. CREATE VIRT
1e60: 55 41 4c 20 54 41 42 4c 45 20 74 33 20 55 53 49 UAL TABLE t3 USI
1e70: 4e 47 20 66 74 73 33 28 74 6f 6b 65 6e 69 7a 65 NG fts3(tokenize
1e80: 3d 73 69 6d 70 6c 65 2c 20 74 6f 6b 65 6e 69 7a =simple, tokeniz
1e90: 65 3d 73 69 6d 70 6c 65 29 3b 0a 20 20 53 45 4c e=simple);. SEL
1ea0: 45 43 54 20 74 6f 6b 65 6e 69 7a 65 20 46 52 4f ECT tokenize FRO
1eb0: 4d 20 74 33 3b 0a 7d 20 7b 7d 0a 64 6f 5f 63 61 M t3;.} {}.do_ca
1ec0: 74 63 68 73 71 6c 5f 74 65 73 74 20 66 74 73 33 tchsql_test fts3
1ed0: 61 61 2d 37 2e 35 20 7b 0a 20 20 43 52 45 41 54 aa-7.5 {. CREAT
1ee0: 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 E VIRTUAL TABLE
1ef0: 74 34 20 55 53 49 4e 47 20 66 74 73 34 28 74 6f t4 USING fts4(to
1f00: 6b 65 6e 69 7a 65 3d 73 69 6d 70 6c 65 2c 20 74 kenize=simple, t
1f10: 6f 6b 65 6e 69 7a 65 3d 73 69 6d 70 6c 65 29 3b okenize=simple);
1f20: 0a 7d 20 7b 31 20 7b 75 6e 72 65 63 6f 67 6e 69 .} {1 {unrecogni
1f30: 7a 65 64 20 70 61 72 61 6d 65 74 65 72 3a 20 74 zed parameter: t
1f40: 6f 6b 65 6e 69 7a 65 3d 73 69 6d 70 6c 65 7d 7d okenize=simple}}
1f50: 0a 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 ..do_execsql_tes
1f60: 74 20 38 2e 30 20 7b 0a 20 20 43 52 45 41 54 45 t 8.0 {. CREATE
1f70: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 74 VIRTUAL TABLE t
1f80: 30 20 55 53 49 4e 47 20 66 74 73 34 28 6f 72 64 0 USING fts4(ord
1f90: 65 72 3d 64 65 73 63 29 3b 0a 20 20 42 45 47 49 er=desc);. BEGI
1fa0: 4e 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f N;. INSERT INTO
1fb0: 20 74 30 28 72 6f 77 69 64 2c 20 63 6f 6e 74 65 t0(rowid, conte
1fc0: 6e 74 29 20 56 41 4c 55 45 53 28 31 2c 20 27 61 nt) VALUES(1, 'a
1fd0: 62 63 27 29 3b 0a 20 20 55 50 44 41 54 45 20 74 bc');. UPDATE t
1fe0: 30 20 53 45 54 20 64 6f 63 69 64 3d 35 20 57 48 0 SET docid=5 WH
1ff0: 45 52 45 20 64 6f 63 69 64 3d 31 3b 0a 20 20 49 ERE docid=1;. I
2000: 4e 53 45 52 54 20 49 4e 54 4f 20 74 30 28 72 6f NSERT INTO t0(ro
2010: 77 69 64 2c 20 63 6f 6e 74 65 6e 74 29 20 56 41 wid, content) VA
2020: 4c 55 45 53 28 36 2c 20 27 61 62 63 27 29 3b 0a LUES(6, 'abc');.
2030: 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 }.do_execsql_tes
2040: 74 20 38 2e 31 20 7b 0a 20 20 53 45 4c 45 43 54 t 8.1 {. SELECT
2050: 20 64 6f 63 69 64 20 46 52 4f 4d 20 74 30 20 57 docid FROM t0 W
2060: 48 45 52 45 20 74 30 20 4d 41 54 43 48 20 27 61 HERE t0 MATCH 'a
2070: 62 63 27 3b 0a 7d 20 7b 36 20 35 7d 0a 64 6f 5f bc';.} {6 5}.do_
2080: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 38 2e 32 execsql_test 8.2
2090: 20 7b 0a 20 20 53 45 4c 45 43 54 20 64 6f 63 69 {. SELECT doci
20a0: 64 20 46 52 4f 4d 20 74 30 20 57 48 45 52 45 20 d FROM t0 WHERE
20b0: 74 30 20 4d 41 54 43 48 20 27 22 61 62 63 20 61 t0 MATCH '"abc a
20c0: 62 63 22 27 3b 0a 7d 20 7b 7d 0a 64 6f 5f 65 78 bc"';.} {}.do_ex
20d0: 65 63 73 71 6c 5f 74 65 73 74 20 38 2e 33 20 7b ecsql_test 8.3 {
20e0: 20 43 4f 4d 4d 49 54 20 7d 0a 64 6f 5f 65 78 65 COMMIT }.do_exe
20f0: 63 73 71 6c 5f 74 65 73 74 20 38 2e 34 20 7b 0a csql_test 8.4 {.
2100: 20 20 53 45 4c 45 43 54 20 64 6f 63 69 64 20 46 SELECT docid F
2110: 52 4f 4d 20 74 30 20 57 48 45 52 45 20 74 30 20 ROM t0 WHERE t0
2120: 4d 41 54 43 48 20 27 61 62 63 27 3b 0a 7d 20 7b MATCH 'abc';.} {
2130: 36 20 35 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 6 5}.do_execsql_
2140: 74 65 73 74 20 38 2e 35 20 7b 0a 20 20 53 45 4c test 8.5 {. SEL
2150: 45 43 54 20 64 6f 63 69 64 20 46 52 4f 4d 20 74 ECT docid FROM t
2160: 30 20 57 48 45 52 45 20 74 30 20 4d 41 54 43 48 0 WHERE t0 MATCH
2170: 20 27 22 61 62 63 20 61 62 63 22 27 3b 0a 7d 20 '"abc abc"';.}
2180: 7b 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 {}..do_execsql_t
2190: 65 73 74 20 39 2e 31 20 7b 0a 20 20 43 52 45 41 est 9.1 {. CREA
21a0: 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 TE VIRTUAL TABLE
21b0: 20 74 39 20 55 53 49 4e 47 20 66 74 73 34 28 61 t9 USING fts4(a
21c0: 2c 20 22 22 2c 20 27 2d 2d 2d 27 29 3b 0a 7d 0a , "", '---');.}.
21d0: 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 do_execsql_test
21e0: 39 2e 32 20 7b 0a 20 20 43 52 45 41 54 45 20 56 9.2 {. CREATE V
21f0: 49 52 54 55 41 4c 20 54 41 42 4c 45 20 74 31 30 IRTUAL TABLE t10
2200: 20 55 53 49 4e 47 20 66 74 73 33 28 3c 2c 20 62 USING fts3(<, b
2210: 2c 20 63 29 3b 0a 7d 0a 0a 66 69 6e 69 73 68 5f , c);.}..finish_
2220: 74 65 73 74 0a test.