/ Hex Artifact Content
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Artifact 00839031878f52391562594fdab0503e424ee071:


0000: 23 20 32 30 31 35 20 53 65 70 74 65 6d 62 65 72  # 2015 September
0010: 20 30 35 0a 23 0a 23 20 54 68 65 20 61 75 74 68   05.#.# The auth
0020: 6f 72 20 64 69 73 63 6c 61 69 6d 73 20 63 6f 70  or disclaims cop
0030: 79 72 69 67 68 74 20 74 6f 20 74 68 69 73 20 73  yright to this s
0040: 6f 75 72 63 65 20 63 6f 64 65 2e 20 20 49 6e 20  ource code.  In 
0050: 70 6c 61 63 65 20 6f 66 0a 23 20 61 20 6c 65 67  place of.# a leg
0060: 61 6c 20 6e 6f 74 69 63 65 2c 20 68 65 72 65 20  al notice, here 
0070: 69 73 20 61 20 62 6c 65 73 73 69 6e 67 3a 0a 23  is a blessing:.#
0080: 0a 23 20 20 20 20 4d 61 79 20 79 6f 75 20 64 6f  .#    May you do
0090: 20 67 6f 6f 64 20 61 6e 64 20 6e 6f 74 20 65 76   good and not ev
00a0: 69 6c 2e 0a 23 20 20 20 20 4d 61 79 20 79 6f 75  il..#    May you
00b0: 20 66 69 6e 64 20 66 6f 72 67 69 76 65 6e 65 73   find forgivenes
00c0: 73 20 66 6f 72 20 79 6f 75 72 73 65 6c 66 20 61  s for yourself a
00d0: 6e 64 20 66 6f 72 67 69 76 65 20 6f 74 68 65 72  nd forgive other
00e0: 73 2e 0a 23 20 20 20 20 4d 61 79 20 79 6f 75 20  s..#    May you 
00f0: 73 68 61 72 65 20 66 72 65 65 6c 79 2c 20 6e 65  share freely, ne
0100: 76 65 72 20 74 61 6b 69 6e 67 20 6d 6f 72 65 20  ver taking more 
0110: 74 68 61 6e 20 79 6f 75 20 67 69 76 65 2e 0a 23  than you give..#
0120: 0a 23 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 2a 0a 23 0a 0a 73  ***********.#..s
0170: 6f 75 72 63 65 20 5b 66 69 6c 65 20 6a 6f 69 6e  ource [file join
0180: 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b   [file dirname [
0190: 69 6e 66 6f 20 73 63 72 69 70 74 5d 5d 20 66 74  info script]] ft
01a0: 73 35 5f 63 6f 6d 6d 6f 6e 2e 74 63 6c 5d 0a 73  s5_common.tcl].s
01b0: 65 74 20 74 65 73 74 70 72 65 66 69 78 20 66 74  et testprefix ft
01c0: 73 35 73 69 6d 70 6c 65 32 0a 0a 23 20 49 66 20  s5simple2..# If 
01d0: 53 51 4c 49 54 45 5f 45 4e 41 42 4c 45 5f 46 54  SQLITE_ENABLE_FT
01e0: 53 35 20 69 73 20 64 65 66 69 6e 65 64 2c 20 6f  S5 is defined, o
01f0: 6d 69 74 20 74 68 69 73 20 66 69 6c 65 2e 0a 69  mit this file..i
0200: 66 63 61 70 61 62 6c 65 20 21 66 74 73 35 20 7b  fcapable !fts5 {
0210: 0a 20 20 66 69 6e 69 73 68 5f 74 65 73 74 0a 20  .  finish_test. 
0220: 20 72 65 74 75 72 6e 0a 7d 0a 0a 64 6f 5f 65 78   return.}..do_ex
0230: 65 63 73 71 6c 5f 74 65 73 74 20 31 2e 30 20 7b  ecsql_test 1.0 {
0240: 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41  .  CREATE VIRTUA
0250: 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e 47  L TABLE t1 USING
0260: 20 66 74 73 35 28 61 2c 20 64 65 74 61 69 6c 3d   fts5(a, detail=
0270: 6e 6f 6e 65 29 3b 0a 20 20 49 4e 53 45 52 54 20  none);.  INSERT 
0280: 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27  INTO t1 VALUES('
0290: 61 20 62 20 63 27 29 3b 0a 7d 0a 64 6f 5f 65 78  a b c');.}.do_ex
02a0: 65 63 73 71 6c 5f 74 65 73 74 20 31 2e 31 20 7b  ecsql_test 1.1 {
02b0: 0a 20 20 53 45 4c 45 43 54 20 72 6f 77 69 64 20  .  SELECT rowid 
02c0: 46 52 4f 4d 20 74 31 28 27 63 20 61 20 62 27 29  FROM t1('c a b')
02d0: 0a 7d 20 7b 31 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d  .} {1}..#-------
02e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0320: 2d 2d 0a 23 0a 72 65 73 65 74 5f 64 62 0a 64 6f  --.#.reset_db.do
0330: 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 32 2e  _execsql_test 2.
0340: 30 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52  0 {.  CREATE VIR
0350: 54 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53  TUAL TABLE t1 US
0360: 49 4e 47 20 66 74 73 35 28 61 2c 20 64 65 74 61  ING fts5(a, deta
0370: 69 6c 3d 6e 6f 6e 65 29 3b 0a 20 20 42 45 47 49  il=none);.  BEGI
0380: 4e 3b 0a 20 20 20 20 49 4e 53 45 52 54 20 49 4e  N;.    INSERT IN
0390: 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27 62 20  TO t1 VALUES('b 
03a0: 63 20 64 27 29 3b 0a 20 20 20 20 49 4e 53 45 52  c d');.    INSER
03b0: 54 20 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53  T INTO t1 VALUES
03c0: 28 27 62 20 63 20 64 27 29 3b 0a 20 20 43 4f 4d  ('b c d');.  COM
03d0: 4d 49 54 3b 0a 7d 0a 64 6f 5f 65 78 65 63 73 71  MIT;.}.do_execsq
03e0: 6c 5f 74 65 73 74 20 32 2e 31 20 7b 0a 20 20 53  l_test 2.1 {.  S
03f0: 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d  ELECT rowid FROM
0400: 20 74 31 28 27 62 20 63 20 64 27 29 0a 7d 20 7b   t1('b c d').} {
0410: 31 20 32 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d  1 2}..#---------
0420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0430: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0450: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0460: 0a 23 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65  .#.reset_db.do_e
0470: 78 65 63 73 71 6c 5f 74 65 73 74 20 33 2e 30 20  xecsql_test 3.0 
0480: 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55  {.  CREATE VIRTU
0490: 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e  AL TABLE t1 USIN
04a0: 47 20 66 74 73 35 28 61 2c 20 64 65 74 61 69 6c  G fts5(a, detail
04b0: 3d 6e 6f 6e 65 29 3b 0a 20 20 42 45 47 49 4e 3b  =none);.  BEGIN;
04c0: 0a 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f  .    INSERT INTO
04d0: 20 74 31 20 56 41 4c 55 45 53 28 27 62 20 63 20   t1 VALUES('b c 
04e0: 64 27 29 3b 0a 20 20 20 20 49 4e 53 45 52 54 20  d');.    INSERT 
04f0: 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27  INTO t1 VALUES('
0500: 62 20 63 20 64 27 29 3b 0a 7d 0a 64 6f 5f 65 78  b c d');.}.do_ex
0510: 65 63 73 71 6c 5f 74 65 73 74 20 33 2e 31 20 7b  ecsql_test 3.1 {
0520: 0a 20 20 53 45 4c 45 43 54 20 72 6f 77 69 64 20  .  SELECT rowid 
0530: 46 52 4f 4d 20 74 31 28 27 62 20 63 20 64 27 29  FROM t1('b c d')
0540: 3b 20 43 4f 4d 4d 49 54 3b 0a 7d 20 7b 31 20 32  ; COMMIT;.} {1 2
0550: 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..#------------
0560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0580: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0590: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a  -------------.#.
05a0: 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65 63  reset_db.do_exec
05b0: 73 71 6c 5f 74 65 73 74 20 34 2e 30 20 7b 0a 20  sql_test 4.0 {. 
05c0: 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20   CREATE VIRTUAL 
05d0: 54 41 42 4c 45 20 74 31 20 55 53 49 4e 47 20 66  TABLE t1 USING f
05e0: 74 73 35 28 61 2c 20 64 65 74 61 69 6c 3d 6e 6f  ts5(a, detail=no
05f0: 6e 65 29 3b 0a 20 20 42 45 47 49 4e 3b 0a 20 20  ne);.  BEGIN;.  
0600: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31    INSERT INTO t1
0610: 20 56 41 4c 55 45 53 28 27 61 31 20 62 31 20 63   VALUES('a1 b1 c
0620: 31 27 29 3b 0a 20 20 20 20 49 4e 53 45 52 54 20  1');.    INSERT 
0630: 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27  INTO t1 VALUES('
0640: 61 32 20 62 32 20 63 32 27 29 3b 0a 20 20 20 20  a2 b2 c2');.    
0650: 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 20 56  INSERT INTO t1 V
0660: 41 4c 55 45 53 28 27 61 33 20 62 33 20 63 33 27  ALUES('a3 b3 c3'
0670: 29 3b 0a 20 20 43 4f 4d 4d 49 54 3b 0a 7d 0a 64  );.  COMMIT;.}.d
0680: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 34  o_execsql_test 4
0690: 2e 31 20 7b 0a 20 20 53 45 4c 45 43 54 20 72 6f  .1 {.  SELECT ro
06a0: 77 69 64 20 46 52 4f 4d 20 74 31 28 27 62 2a 27  wid FROM t1('b*'
06b0: 29 3b 0a 7d 20 7b 31 20 32 20 33 7d 0a 0a 0a 23  );.} {1 2 3}...#
06c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
06d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
06e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
06f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a 72 65 73 65  ---------.#.rese
0710: 74 5f 64 62 0a 64 6f 5f 65 78 65 63 73 71 6c 5f  t_db.do_execsql_
0720: 74 65 73 74 20 35 2e 30 20 7b 0a 20 20 43 52 45  test 5.0 {.  CRE
0730: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c  ATE VIRTUAL TABL
0740: 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35 28  E t1 USING fts5(
0750: 61 2c 20 64 65 74 61 69 6c 3d 6e 6f 6e 65 29 3b  a, detail=none);
0760: 0a 20 20 42 45 47 49 4e 3b 0a 20 20 49 4e 53 45  .  BEGIN;.  INSE
0770: 52 54 20 49 4e 54 4f 20 74 31 20 56 41 4c 55 45  RT INTO t1 VALUE
0780: 53 28 27 61 31 20 62 31 20 63 31 27 29 3b 0a 20  S('a1 b1 c1');. 
0790: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 20   INSERT INTO t1 
07a0: 56 41 4c 55 45 53 28 27 61 32 20 62 32 20 63 32  VALUES('a2 b2 c2
07b0: 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54  ');.  INSERT INT
07c0: 4f 20 74 31 20 56 41 4c 55 45 53 28 27 61 31 20  O t1 VALUES('a1 
07d0: 62 31 20 63 31 27 29 3b 0a 20 20 43 4f 4d 4d 49  b1 c1');.  COMMI
07e0: 54 3b 0a 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f  T;.}.do_execsql_
07f0: 74 65 73 74 20 35 2e 31 20 7b 20 53 45 4c 45 43  test 5.1 { SELEC
0800: 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28  T rowid FROM t1(
0810: 27 62 2a 27 29 20 7d 20 7b 31 20 32 20 33 7d 0a  'b*') } {1 2 3}.
0820: 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .#--------------
0830: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a 72 65  -----------.#.re
0870: 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65 63 73 71  set_db.do_execsq
0880: 6c 5f 74 65 73 74 20 36 2e 30 20 7b 0a 20 20 43  l_test 6.0 {.  C
0890: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
08a0: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73  BLE t1 USING fts
08b0: 35 28 61 2c 20 64 65 74 61 69 6c 3d 66 75 6c 6c  5(a, detail=full
08c0: 29 3b 0a 20 20 42 45 47 49 4e 3b 0a 20 20 49 4e  );.  BEGIN;.  IN
08d0: 53 45 52 54 20 49 4e 54 4f 20 74 31 20 56 41 4c  SERT INTO t1 VAL
08e0: 55 45 53 28 27 61 31 20 62 31 20 63 31 27 29 3b  UES('a1 b1 c1');
08f0: 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74  .  INSERT INTO t
0900: 31 20 56 41 4c 55 45 53 28 27 61 31 20 62 31 20  1 VALUES('a1 b1 
0910: 63 31 27 29 3b 0a 20 20 49 4e 53 45 52 54 20 49  c1');.  INSERT I
0920: 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27 61  NTO t1 VALUES('a
0930: 31 20 62 31 20 63 31 27 29 3b 0a 20 20 43 4f 4d  1 b1 c1');.  COM
0940: 4d 49 54 3b 0a 7d 0a 0a 64 6f 5f 65 78 65 63 73  MIT;.}..do_execs
0950: 71 6c 5f 74 65 73 74 20 36 2e 31 20 7b 20 53 45  ql_test 6.1 { SE
0960: 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20  LECT rowid FROM 
0970: 74 31 28 27 61 31 27 29 20 4f 52 44 45 52 20 42  t1('a1') ORDER B
0980: 59 20 72 6f 77 69 64 20 44 45 53 43 20 7d 20 7b  Y rowid DESC } {
0990: 33 20 32 20 31 7d 0a 64 6f 5f 65 78 65 63 73 71  3 2 1}.do_execsq
09a0: 6c 5f 74 65 73 74 20 36 2e 32 20 7b 20 53 45 4c  l_test 6.2 { SEL
09b0: 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74  ECT rowid FROM t
09c0: 31 28 27 62 31 27 29 20 4f 52 44 45 52 20 42 59  1('b1') ORDER BY
09d0: 20 72 6f 77 69 64 20 44 45 53 43 20 7d 20 7b 33   rowid DESC } {3
09e0: 20 32 20 31 7d 0a 64 6f 5f 65 78 65 63 73 71 6c   2 1}.do_execsql
09f0: 5f 74 65 73 74 20 36 2e 33 20 7b 20 53 45 4c 45  _test 6.3 { SELE
0a00: 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31  CT rowid FROM t1
0a10: 28 27 63 31 27 29 20 4f 52 44 45 52 20 42 59 20  ('c1') ORDER BY 
0a20: 72 6f 77 69 64 20 44 45 53 43 20 7d 20 7b 33 20  rowid DESC } {3 
0a30: 32 20 31 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d  2 1}..#---------
0a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a80: 0a 23 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65  .#.reset_db.do_e
0a90: 78 65 63 73 71 6c 5f 74 65 73 74 20 37 2e 30 20  xecsql_test 7.0 
0aa0: 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55  {.  CREATE VIRTU
0ab0: 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e  AL TABLE t1 USIN
0ac0: 47 20 66 74 73 35 28 61 2c 20 64 65 74 61 69 6c  G fts5(a, detail
0ad0: 3d 6e 6f 6e 65 29 3b 0a 20 20 42 45 47 49 4e 3b  =none);.  BEGIN;
0ae0: 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74  .  INSERT INTO t
0af0: 31 20 56 41 4c 55 45 53 28 27 61 31 20 62 31 27  1 VALUES('a1 b1'
0b00: 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f  );.  INSERT INTO
0b10: 20 74 31 20 56 41 4c 55 45 53 28 27 61 31 20 62   t1 VALUES('a1 b
0b20: 32 27 29 3b 0a 20 20 43 4f 4d 4d 49 54 3b 0a 7d  2');.  COMMIT;.}
0b30: 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74  .do_execsql_test
0b40: 20 37 2e 31 20 7b 20 53 45 4c 45 43 54 20 72 6f   7.1 { SELECT ro
0b50: 77 69 64 20 46 52 4f 4d 20 74 31 28 27 62 2a 27  wid FROM t1('b*'
0b60: 29 20 4f 52 44 45 52 20 42 59 20 72 6f 77 69 64  ) ORDER BY rowid
0b70: 20 44 45 53 43 20 7d 20 7b 32 20 31 7d 0a 64 6f   DESC } {2 1}.do
0b80: 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 37 2e  _execsql_test 7.
0b90: 32 20 7b 20 53 45 4c 45 43 54 20 72 6f 77 69 64  2 { SELECT rowid
0ba0: 20 46 52 4f 4d 20 74 31 28 27 61 31 27 29 20 4f   FROM t1('a1') O
0bb0: 52 44 45 52 20 42 59 20 72 6f 77 69 64 20 44 45  RDER BY rowid DE
0bc0: 53 43 20 7d 20 7b 32 20 31 7d 0a 0a 23 2d 2d 2d  SC } {2 1}..#---
0bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0bf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0c00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0c10: 2d 2d 2d 2d 2d 2d 0a 23 0a 72 65 73 65 74 5f 64  ------.#.reset_d
0c20: 62 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73  b.do_execsql_tes
0c30: 74 20 38 2e 30 20 7b 0a 20 20 43 52 45 41 54 45  t 8.0 {.  CREATE
0c40: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 74   VIRTUAL TABLE t
0c50: 31 20 55 53 49 4e 47 20 66 74 73 35 28 61 2c 20  1 USING fts5(a, 
0c60: 64 65 74 61 69 6c 3d 6e 6f 6e 65 29 3b 0a 20 20  detail=none);.  
0c70: 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 20 56  INSERT INTO t1 V
0c80: 41 4c 55 45 53 28 27 61 31 20 62 31 20 63 31 27  ALUES('a1 b1 c1'
0c90: 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f  );.  INSERT INTO
0ca0: 20 74 31 20 56 41 4c 55 45 53 28 27 61 32 20 62   t1 VALUES('a2 b
0cb0: 32 20 63 32 27 29 3b 0a 20 20 49 4e 53 45 52 54  2 c2');.  INSERT
0cc0: 20 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28   INTO t1 VALUES(
0cd0: 27 61 31 20 62 31 20 63 31 27 29 3b 0a 7d 0a 64  'a1 b1 c1');.}.d
0ce0: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 38  o_execsql_test 8
0cf0: 2e 30 2e 31 20 7b 20 53 45 4c 45 43 54 20 72 6f  .0.1 { SELECT ro
0d00: 77 69 64 20 46 52 4f 4d 20 74 31 28 27 62 2a 27  wid FROM t1('b*'
0d10: 29 20 7d 20 7b 31 20 32 20 33 7d 0a 64 6f 5f 65  ) } {1 2 3}.do_e
0d20: 78 65 63 73 71 6c 5f 74 65 73 74 20 38 2e 30 2e  xecsql_test 8.0.
0d30: 32 20 7b 20 53 45 4c 45 43 54 20 72 6f 77 69 64  2 { SELECT rowid
0d40: 20 46 52 4f 4d 20 74 31 28 27 61 31 27 29 20 7d   FROM t1('a1') }
0d50: 20 7b 31 20 33 7d 0a 64 6f 5f 65 78 65 63 73 71   {1 3}.do_execsq
0d60: 6c 5f 74 65 73 74 20 38 2e 30 2e 33 20 7b 20 53  l_test 8.0.3 { S
0d70: 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d  ELECT rowid FROM
0d80: 20 74 31 28 27 63 32 27 29 20 7d 20 7b 32 7d 0a   t1('c2') } {2}.
0d90: 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74  .do_execsql_test
0da0: 20 38 2e 30 2e 34 20 7b 20 53 45 4c 45 43 54 20   8.0.4 { SELECT 
0db0: 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27 62  rowid FROM t1('b
0dc0: 2a 27 29 20 4f 52 44 45 52 20 42 59 20 72 6f 77  *') ORDER BY row
0dd0: 69 64 20 44 45 53 43 20 7d 20 7b 33 20 32 20 31  id DESC } {3 2 1
0de0: 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73  }.do_execsql_tes
0df0: 74 20 38 2e 30 2e 35 20 7b 20 53 45 4c 45 43 54  t 8.0.5 { SELECT
0e00: 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27   rowid FROM t1('
0e10: 61 31 27 29 20 4f 52 44 45 52 20 42 59 20 72 6f  a1') ORDER BY ro
0e20: 77 69 64 20 44 45 53 43 20 7d 20 7b 33 20 31 7d  wid DESC } {3 1}
0e30: 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74  .do_execsql_test
0e40: 20 38 2e 30 2e 38 20 7b 20 53 45 4c 45 43 54 20   8.0.8 { SELECT 
0e50: 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27 63  rowid FROM t1('c
0e60: 32 27 29 20 4f 52 44 45 52 20 42 59 20 72 6f 77  2') ORDER BY row
0e70: 69 64 20 44 45 53 43 20 7d 20 7b 32 7d 0a 0a 64  id DESC } {2}..d
0e80: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 38  o_execsql_test 8
0e90: 2e 31 2e 30 20 7b 20 49 4e 53 45 52 54 20 49 4e  .1.0 { INSERT IN
0ea0: 54 4f 20 74 31 28 74 31 29 20 56 41 4c 55 45 53  TO t1(t1) VALUES
0eb0: 28 27 6f 70 74 69 6d 69 7a 65 27 29 20 7d 0a 0a  ('optimize') }..
0ec0: 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20  do_execsql_test 
0ed0: 38 2e 31 2e 31 20 7b 20 53 45 4c 45 43 54 20 72  8.1.1 { SELECT r
0ee0: 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27 62 2a  owid FROM t1('b*
0ef0: 27 29 20 7d 20 7b 31 20 32 20 33 7d 0a 64 6f 5f  ') } {1 2 3}.do_
0f00: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 38 2e 31  execsql_test 8.1
0f10: 2e 32 20 7b 20 53 45 4c 45 43 54 20 72 6f 77 69  .2 { SELECT rowi
0f20: 64 20 46 52 4f 4d 20 74 31 28 27 61 31 27 29 20  d FROM t1('a1') 
0f30: 7d 20 7b 31 20 33 7d 0a 64 6f 5f 65 78 65 63 73  } {1 3}.do_execs
0f40: 71 6c 5f 74 65 73 74 20 38 2e 31 2e 33 20 7b 20  ql_test 8.1.3 { 
0f50: 53 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f  SELECT rowid FRO
0f60: 4d 20 74 31 28 27 63 32 27 29 20 7d 20 7b 32 7d  M t1('c2') } {2}
0f70: 0a 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73  ..do_execsql_tes
0f80: 74 20 38 2e 32 2e 31 20 7b 20 53 45 4c 45 43 54  t 8.2.1 { SELECT
0f90: 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27   rowid FROM t1('
0fa0: 62 2a 27 29 20 4f 52 44 45 52 20 42 59 20 72 6f  b*') ORDER BY ro
0fb0: 77 69 64 20 44 45 53 43 7d 20 7b 33 20 32 20 31  wid DESC} {3 2 1
0fc0: 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73  }.do_execsql_tes
0fd0: 74 20 38 2e 32 2e 32 20 7b 20 53 45 4c 45 43 54  t 8.2.2 { SELECT
0fe0: 20 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27   rowid FROM t1('
0ff0: 61 31 27 29 20 4f 52 44 45 52 20 42 59 20 72 6f  a1') ORDER BY ro
1000: 77 69 64 20 44 45 53 43 7d 20 7b 33 20 31 7d 0a  wid DESC} {3 1}.
1010: 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20  do_execsql_test 
1020: 38 2e 32 2e 33 20 7b 20 53 45 4c 45 43 54 20 72  8.2.3 { SELECT r
1030: 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27 63 32  owid FROM t1('c2
1040: 27 29 20 4f 52 44 45 52 20 42 59 20 72 6f 77 69  ') ORDER BY rowi
1050: 64 20 44 45 53 43 7d 20 7b 32 7d 0a 0a 23 2d 2d  d DESC} {2}..#--
1060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10a0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a 72 65 73 65 74  --------.#.reset
10b0: 5f 64 62 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74  _db.do_execsql_t
10c0: 65 73 74 20 39 2e 30 2e 30 20 7b 0a 20 20 43 52  est 9.0.0 {.  CR
10d0: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42  EATE VIRTUAL TAB
10e0: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35  LE t1 USING fts5
10f0: 28 61 2c 20 64 65 74 61 69 6c 3d 6e 6f 6e 65 29  (a, detail=none)
1100: 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20  ;.  INSERT INTO 
1110: 74 31 20 56 41 4c 55 45 53 28 27 61 31 20 62 31  t1 VALUES('a1 b1
1120: 20 63 31 27 29 3b 0a 20 20 49 4e 53 45 52 54 20   c1');.  INSERT 
1130: 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27  INTO t1 VALUES('
1140: 61 32 20 62 32 20 63 32 27 29 3b 0a 20 20 49 4e  a2 b2 c2');.  IN
1150: 53 45 52 54 20 49 4e 54 4f 20 74 31 20 56 41 4c  SERT INTO t1 VAL
1160: 55 45 53 28 27 61 31 20 62 31 20 63 31 27 29 3b  UES('a1 b1 c1');
1170: 0a 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65  .}.do_execsql_te
1180: 73 74 20 39 2e 30 2e 31 20 7b 0a 20 20 49 4e 53  st 9.0.1 {.  INS
1190: 45 52 54 20 49 4e 54 4f 20 74 31 28 74 31 29 20  ERT INTO t1(t1) 
11a0: 56 41 4c 55 45 53 28 27 69 6e 74 65 67 72 69 74  VALUES('integrit
11b0: 79 2d 63 68 65 63 6b 27 29 3b 0a 7d 20 7b 7d 0a  y-check');.} {}.
11c0: 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65  .reset_db.do_exe
11d0: 63 73 71 6c 5f 74 65 73 74 20 39 2e 31 2e 30 20  csql_test 9.1.0 
11e0: 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55  {.  CREATE VIRTU
11f0: 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e  AL TABLE t1 USIN
1200: 47 20 66 74 73 35 28 61 2c 20 62 2c 20 64 65 74  G fts5(a, b, det
1210: 61 69 6c 3d 6e 6f 6e 65 29 3b 0a 20 20 49 4e 53  ail=none);.  INS
1220: 45 52 54 20 49 4e 54 4f 20 74 31 20 56 41 4c 55  ERT INTO t1 VALU
1230: 45 53 28 27 61 31 20 62 31 20 63 31 27 2c 20 27  ES('a1 b1 c1', '
1240: 78 20 79 20 7a 27 29 3b 0a 20 20 49 4e 53 45 52  x y z');.  INSER
1250: 54 20 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53  T INTO t1 VALUES
1260: 28 27 61 32 20 62 32 20 63 32 27 2c 20 27 31 20  ('a2 b2 c2', '1 
1270: 32 20 33 27 29 3b 0a 20 20 49 4e 53 45 52 54 20  2 3');.  INSERT 
1280: 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28 27  INTO t1 VALUES('
1290: 61 31 20 62 31 20 63 31 27 2c 20 27 78 20 32 20  a1 b1 c1', 'x 2 
12a0: 7a 27 29 3b 0a 7d 0a 64 6f 5f 65 78 65 63 73 71  z');.}.do_execsq
12b0: 6c 5f 74 65 73 74 20 39 2e 32 2e 31 20 7b 0a 20  l_test 9.2.1 {. 
12c0: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28   INSERT INTO t1(
12d0: 74 31 29 20 56 41 4c 55 45 53 28 27 69 6e 74 65  t1) VALUES('inte
12e0: 67 72 69 74 79 2d 63 68 65 63 6b 27 29 3b 0a 7d  grity-check');.}
12f0: 20 7b 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   {}..#----------
1300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1340: 0a 23 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65  .#.reset_db.do_e
1350: 78 65 63 73 71 6c 5f 74 65 73 74 20 31 30 2e 30  xecsql_test 10.0
1360: 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54   {.  CREATE VIRT
1370: 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49  UAL TABLE t1 USI
1380: 4e 47 20 66 74 73 35 28 61 2c 20 64 65 74 61 69  NG fts5(a, detai
1390: 6c 3d 6e 6f 6e 65 29 3b 0a 20 20 49 4e 53 45 52  l=none);.  INSER
13a0: 54 20 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53  T INTO t1 VALUES
13b0: 28 27 62 31 27 29 3b 0a 20 20 49 4e 53 45 52 54  ('b1');.  INSERT
13c0: 20 49 4e 54 4f 20 74 31 20 56 41 4c 55 45 53 28   INTO t1 VALUES(
13d0: 27 62 31 27 29 3b 0a 20 20 44 45 4c 45 54 45 20  'b1');.  DELETE 
13e0: 46 52 4f 4d 20 74 31 20 57 48 45 52 45 20 72 6f  FROM t1 WHERE ro
13f0: 77 69 64 3d 31 3b 0a 7d 0a 0a 64 6f 5f 65 78 65  wid=1;.}..do_exe
1400: 63 73 71 6c 5f 74 65 73 74 20 31 30 2e 31 20 7b  csql_test 10.1 {
1410: 0a 20 20 53 45 4c 45 43 54 20 72 6f 77 69 64 20  .  SELECT rowid 
1420: 46 52 4f 4d 20 74 31 28 27 62 31 27 29 3b 0a 7d  FROM t1('b1');.}
1430: 20 7b 32 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c   {2}..do_execsql
1440: 5f 74 65 73 74 20 31 30 2e 32 20 7b 0a 20 20 53  _test 10.2 {.  S
1450: 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d  ELECT rowid FROM
1460: 20 74 31 28 27 62 31 27 29 20 4f 52 44 45 52 20   t1('b1') ORDER 
1470: 42 59 20 72 6f 77 69 64 20 44 45 53 43 3b 0a 7d  BY rowid DESC;.}
1480: 20 7b 32 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c   {2}..do_execsql
1490: 5f 74 65 73 74 20 31 30 2e 33 20 7b 0a 20 20 49  _test 10.3 {.  I
14a0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28 74 31  NSERT INTO t1(t1
14b0: 29 20 56 41 4c 55 45 53 28 27 69 6e 74 65 67 72  ) VALUES('integr
14c0: 69 74 79 2d 63 68 65 63 6b 27 29 3b 0a 7d 20 7b  ity-check');.} {
14d0: 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..#------------
14e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
1520: 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65  .reset_db.do_exe
1530: 63 73 71 6c 5f 74 65 73 74 20 31 31 2e 31 20 7b  csql_test 11.1 {
1540: 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41  .  CREATE VIRTUA
1550: 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e 47  L TABLE t1 USING
1560: 20 66 74 73 35 28 78 2c 20 79 2c 20 64 65 74 61   fts5(x, y, deta
1570: 69 6c 3d 6e 6f 6e 65 29 3b 0a 20 20 49 4e 53 45  il=none);.  INSE
1580: 52 54 20 49 4e 54 4f 20 74 31 28 74 31 2c 20 72  RT INTO t1(t1, r
1590: 61 6e 6b 29 20 56 41 4c 55 45 53 28 27 70 67 73  ank) VALUES('pgs
15a0: 7a 27 2c 20 33 32 29 3b 0a 20 20 57 49 54 48 20  z', 32);.  WITH 
15b0: 64 28 78 2c 79 29 20 41 53 20 28 0a 20 20 20 20  d(x,y) AS (.    
15c0: 53 45 4c 45 43 54 20 4e 55 4c 4c 2c 20 27 78 79  SELECT NULL, 'xy
15d0: 7a 27 20 55 4e 49 4f 4e 20 41 4c 4c 20 53 45 4c  z' UNION ALL SEL
15e0: 45 43 54 20 4e 55 4c 4c 2c 20 27 78 79 7a 27 20  ECT NULL, 'xyz' 
15f0: 46 52 4f 4d 20 64 0a 20 20 29 0a 20 20 49 4e 53  FROM d.  ).  INS
1600: 45 52 54 20 49 4e 54 4f 20 74 31 20 53 45 4c 45  ERT INTO t1 SELE
1610: 43 54 20 2a 20 46 52 4f 4d 20 64 20 4c 49 4d 49  CT * FROM d LIMI
1620: 54 20 32 33 3b 0a 7d 0a 0a 23 64 62 20 65 76 61  T 23;.}..#db eva
1630: 6c 20 7b 20 53 45 4c 45 43 54 20 72 6f 77 69 64  l { SELECT rowid
1640: 20 41 53 20 72 2c 20 71 75 6f 74 65 28 62 6c 6f   AS r, quote(blo
1650: 63 6b 29 20 41 53 20 62 20 46 52 4f 4d 20 74 31  ck) AS b FROM t1
1660: 5f 64 61 74 61 20 7d 20 7b 20 70 75 74 73 20 22  _data } { puts "
1670: 24 72 3a 20 24 62 22 20 7d 0a 64 6f 5f 65 78 65  $r: $b" }.do_exe
1680: 63 73 71 6c 5f 74 65 73 74 20 31 31 2e 32 20 7b  csql_test 11.2 {
1690: 0a 20 20 53 45 4c 45 43 54 20 72 6f 77 69 64 20  .  SELECT rowid 
16a0: 46 52 4f 4d 20 74 31 3b 0a 7d 20 7b 31 20 32 20  FROM t1;.} {1 2 
16b0: 33 20 34 20 35 20 36 20 37 20 38 20 39 20 31 30  3 4 5 6 7 8 9 10
16c0: 20 31 31 20 31 32 20 31 33 20 31 34 20 31 35 20   11 12 13 14 15 
16d0: 31 36 20 31 37 20 31 38 20 31 39 20 32 30 20 32  16 17 18 19 20 2
16e0: 31 20 32 32 20 32 33 7d 0a 0a 64 6f 5f 65 78 65  1 22 23}..do_exe
16f0: 63 73 71 6c 5f 74 65 73 74 20 31 31 2e 33 20 7b  csql_test 11.3 {
1700: 0a 20 20 53 45 4c 45 43 54 20 72 6f 77 69 64 20  .  SELECT rowid 
1710: 46 52 4f 4d 20 74 31 28 27 78 79 7a 27 29 3b 0a  FROM t1('xyz');.
1720: 7d 20 7b 31 20 32 20 33 20 34 20 35 20 36 20 37  } {1 2 3 4 5 6 7
1730: 20 38 20 39 20 31 30 20 31 31 20 31 32 20 31 33   8 9 10 11 12 13
1740: 20 31 34 20 31 35 20 31 36 20 31 37 20 31 38 20   14 15 16 17 18 
1750: 31 39 20 32 30 20 32 31 20 32 32 20 32 33 7d 0a  19 20 21 22 23}.
1760: 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74  .do_execsql_test
1770: 20 31 31 2e 34 20 7b 0a 20 20 49 4e 53 45 52 54   11.4 {.  INSERT
1780: 20 49 4e 54 4f 20 74 31 28 74 31 29 20 56 41 4c   INTO t1(t1) VAL
1790: 55 45 53 28 27 69 6e 74 65 67 72 69 74 79 2d 63  UES('integrity-c
17a0: 68 65 63 6b 27 29 3b 0a 7d 0a 0a 23 2d 2d 2d 2d  heck');.}..#----
17b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17f0: 2d 2d 2d 2d 2d 0a 23 0a 72 65 73 65 74 5f 64 62  -----.#.reset_db
1800: 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74  .do_execsql_test
1810: 20 31 32 2e 30 20 7b 0a 20 20 43 52 45 41 54 45   12.0 {.  CREATE
1820: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 79   VIRTUAL TABLE y
1830: 79 20 55 53 49 4e 47 20 66 74 73 35 28 78 2c 20  y USING fts5(x, 
1840: 64 65 74 61 69 6c 3d 6e 6f 6e 65 29 3b 0a 20 20  detail=none);.  
1850: 49 4e 53 45 52 54 20 49 4e 54 4f 20 79 79 20 56  INSERT INTO yy V
1860: 41 4c 55 45 53 28 27 69 6e 20 69 66 27 29 3b 0a  ALUES('in if');.
1870: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 79 79    INSERT INTO yy
1880: 20 56 41 4c 55 45 53 28 27 69 66 27 29 3b 0a 7d   VALUES('if');.}
1890: 20 7b 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c 5f   {}..do_execsql_
18a0: 74 65 73 74 20 31 32 2e 31 20 7b 0a 20 20 53 45  test 12.1 {.  SE
18b0: 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d 20  LECT rowid FROM 
18c0: 79 79 28 27 69 2a 27 29 3b 0a 7d 20 7b 31 20 32  yy('i*');.} {1 2
18d0: 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..#------------
18e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a  -------------.#.
1920: 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65 63  reset_db.do_exec
1930: 73 71 6c 5f 74 65 73 74 20 31 33 2e 30 20 7b 0a  sql_test 13.0 {.
1940: 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c    CREATE VIRTUAL
1950: 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e 47 20   TABLE t1 USING 
1960: 66 74 73 35 28 61 2c 20 70 72 65 66 69 78 3d 31  fts5(a, prefix=1
1970: 2c 20 64 65 74 61 69 6c 3d 6e 6f 6e 65 29 3b 0a  , detail=none);.
1980: 7d 20 7b 7d 0a 66 6f 72 65 61 63 68 20 7b 72 6f  } {}.foreach {ro
1990: 77 69 64 20 61 7d 20 7b 0a 20 20 30 20 20 20 7b  wid a} {.  0   {
19a0: 66 7d 0a 20 20 31 20 20 20 7b 75 7d 0a 20 20 32  f}.  1   {u}.  2
19b0: 20 20 20 7b 6b 7d 0a 20 20 33 20 20 20 7b 61 7d     {k}.  3   {a}
19c0: 0a 20 20 34 20 20 20 7b 61 7d 0a 20 20 35 20 20  .  4   {a}.  5  
19d0: 20 7b 75 7d 0a 20 20 36 20 20 20 7b 75 7d 0a 20   {u}.  6   {u}. 
19e0: 20 37 20 20 20 7b 75 7d 0a 20 20 38 20 20 20 7b   7   {u}.  8   {
19f0: 66 7d 0a 20 20 39 20 20 20 7b 66 7d 0a 20 20 31  f}.  9   {f}.  1
1a00: 30 20 20 7b 61 7d 0a 20 20 31 31 20 20 7b 70 7d  0  {a}.  11  {p}
1a10: 0a 20 20 31 32 20 20 7b 66 7d 0a 20 20 31 33 20  .  12  {f}.  13 
1a20: 20 7b 75 7d 0a 20 20 31 34 20 20 7b 61 7d 0a 20   {u}.  14  {a}. 
1a30: 20 31 35 20 20 7b 61 7d 0a 7d 20 7b 0a 20 20 64   15  {a}.} {.  d
1a40: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31  o_execsql_test 1
1a50: 33 2e 31 2e 24 72 6f 77 69 64 20 7b 0a 20 20 20  3.1.$rowid {.   
1a60: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 31 28   INSERT INTO t1(
1a70: 72 6f 77 69 64 2c 20 61 29 20 56 41 4c 55 45 53  rowid, a) VALUES
1a80: 28 24 72 6f 77 69 64 2c 20 24 61 29 3b 0a 20 20  ($rowid, $a);.  
1a90: 7d 0a 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }.}..#----------
1aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ac0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ad0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
1ae0: 23 0a 72 65 73 65 74 5f 64 62 0a 66 74 73 35 5f  #.reset_db.fts5_
1af0: 61 75 78 5f 74 65 73 74 5f 66 75 6e 63 74 69 6f  aux_test_functio
1b00: 6e 73 20 64 62 0a 64 6f 5f 65 78 65 63 73 71 6c  ns db.do_execsql
1b10: 5f 74 65 73 74 20 31 34 2e 30 20 7b 0a 20 20 43  _test 14.0 {.  C
1b20: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
1b30: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73  BLE t1 USING fts
1b40: 35 28 61 2c 20 64 65 74 61 69 6c 3d 6e 6f 6e 65  5(a, detail=none
1b50: 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f  );.  INSERT INTO
1b60: 20 74 31 20 56 41 4c 55 45 53 28 27 61 20 62 20   t1 VALUES('a b 
1b70: 63 20 64 27 29 3b 0a 7d 20 7b 7d 0a 0a 64 6f 5f  c d');.} {}..do_
1b80: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31 34 2e  execsql_test 14.
1b90: 31 20 7b 0a 20 20 53 45 4c 45 43 54 20 66 74 73  1 {.  SELECT fts
1ba0: 35 5f 74 65 73 74 5f 70 6f 73 6c 69 73 74 28 74  5_test_poslist(t
1bb0: 31 29 20 46 52 4f 4d 20 74 31 28 27 62 27 29 20  1) FROM t1('b') 
1bc0: 4f 52 44 45 52 20 42 59 20 72 61 6e 6b 3b 0a 7d  ORDER BY rank;.}
1bd0: 20 7b 30 2e 30 2e 31 7d 0a 0a 23 2d 2d 2d 2d 2d   {0.0.1}..#-----
1be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1bf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c20: 2d 2d 2d 2d 0a 23 0a 72 65 73 65 74 5f 64 62 0a  ----.#.reset_db.
1c30: 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20  do_execsql_test 
1c40: 31 35 2e 31 20 7b 0a 20 20 43 52 45 41 54 45 20  15.1 {.  CREATE 
1c50: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 74 31  VIRTUAL TABLE t1
1c60: 20 55 53 49 4e 47 20 66 74 73 35 28 78 2c 20 64   USING fts5(x, d
1c70: 65 74 61 69 6c 3d 6e 6f 6e 65 29 3b 0a 20 20 42  etail=none);.  B
1c80: 45 47 49 4e 3b 0a 20 20 20 20 49 4e 53 45 52 54  EGIN;.    INSERT
1c90: 20 49 4e 54 4f 20 74 31 28 72 6f 77 69 64 2c 20   INTO t1(rowid, 
1ca0: 78 29 20 56 41 4c 55 45 53 28 31 2c 20 27 73 71  x) VALUES(1, 'sq
1cb0: 6c 69 74 65 27 29 3b 0a 20 20 20 20 49 4e 53 45  lite');.    INSE
1cc0: 52 54 20 49 4e 54 4f 20 74 31 28 72 6f 77 69 64  RT INTO t1(rowid
1cd0: 2c 20 78 29 20 56 41 4c 55 45 53 28 32 2c 20 27  , x) VALUES(2, '
1ce0: 73 71 6c 69 74 65 27 29 3b 20 0a 20 20 43 4f 4d  sqlite'); .  COM
1cf0: 4d 49 54 3b 0a 7d 20 7b 7d 0a 0a 64 6f 5f 74 65  MIT;.} {}..do_te
1d00: 73 74 20 31 35 2e 31 20 7b 0a 20 20 65 78 65 63  st 15.1 {.  exec
1d10: 73 71 6c 20 7b 20 49 4e 53 45 52 54 20 49 4e 54  sql { INSERT INT
1d20: 4f 20 74 31 28 74 31 29 20 56 41 4c 55 45 53 28  O t1(t1) VALUES(
1d30: 27 69 6e 74 65 67 72 69 74 79 2d 63 68 65 63 6b  'integrity-check
1d40: 27 29 20 7d 0a 7d 20 7b 7d 0a 0a 64 6f 5f 74 65  ') }.} {}..do_te
1d50: 73 74 20 31 35 2e 32 20 7b 0a 20 20 65 78 65 63  st 15.2 {.  exec
1d60: 73 71 6c 20 7b 20 44 45 4c 45 54 45 20 46 52 4f  sql { DELETE FRO
1d70: 4d 20 74 31 20 7d 0a 7d 20 7b 7d 0a 0a 64 6f 5f  M t1 }.} {}..do_
1d80: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31 35 2e  execsql_test 15.
1d90: 33 2e 31 20 7b 0a 20 20 53 45 4c 45 43 54 20 72  3.1 {.  SELECT r
1da0: 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27 73 71  owid FROM t1('sq
1db0: 6c 69 74 65 27 29 3b 0a 7d 20 7b 7d 0a 0a 64 6f  lite');.} {}..do
1dc0: 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31 35  _execsql_test 15
1dd0: 2e 33 2e 32 20 7b 0a 20 20 53 45 4c 45 43 54 20  .3.2 {.  SELECT 
1de0: 72 6f 77 69 64 20 46 52 4f 4d 20 74 31 28 27 73  rowid FROM t1('s
1df0: 71 6c 69 74 65 27 29 20 4f 52 44 45 52 20 42 59  qlite') ORDER BY
1e00: 20 72 6f 77 69 64 20 44 45 53 43 3b 0a 7d 20 7b   rowid DESC;.} {
1e10: 7d 0a 0a 64 6f 5f 74 65 73 74 20 31 35 2e 34 20  }..do_test 15.4 
1e20: 7b 0a 20 20 65 78 65 63 73 71 6c 20 7b 20 49 4e  {.  execsql { IN
1e30: 53 45 52 54 20 49 4e 54 4f 20 74 31 28 74 31 29  SERT INTO t1(t1)
1e40: 20 56 41 4c 55 45 53 28 27 69 6e 74 65 67 72 69   VALUES('integri
1e50: 74 79 2d 63 68 65 63 6b 27 29 20 7d 0a 7d 20 7b  ty-check') }.} {
1e60: 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..#------------
1e70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a  -------------.#.
1eb0: 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65 63  reset_db.do_exec
1ec0: 73 71 6c 5f 74 65 73 74 20 31 36 2e 30 20 7b 0a  sql_test 16.0 {.
1ed0: 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c    CREATE VIRTUAL
1ee0: 20 54 41 42 4c 45 20 74 32 20 55 53 49 4e 47 20   TABLE t2 USING 
1ef0: 66 74 73 35 28 78 2c 20 64 65 74 61 69 6c 3d 6e  fts5(x, detail=n
1f00: 6f 6e 65 29 3b 0a 20 20 42 45 47 49 4e 3b 0a 20  one);.  BEGIN;. 
1f10: 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74     INSERT INTO t
1f20: 32 28 72 6f 77 69 64 2c 20 78 29 20 56 41 4c 55  2(rowid, x) VALU
1f30: 45 53 28 31 2c 20 27 61 20 62 20 63 27 29 3b 0a  ES(1, 'a b c');.
1f40: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20      INSERT INTO 
1f50: 74 32 28 72 6f 77 69 64 2c 20 78 29 20 56 41 4c  t2(rowid, x) VAL
1f60: 55 45 53 28 34 35 36 2c 20 27 61 20 62 20 63 27  UES(456, 'a b c'
1f70: 29 3b 0a 20 20 20 20 49 4e 53 45 52 54 20 49 4e  );.    INSERT IN
1f80: 54 4f 20 74 32 28 72 6f 77 69 64 2c 20 78 29 20  TO t2(rowid, x) 
1f90: 56 41 4c 55 45 53 28 31 30 30 30 2c 20 27 61 20  VALUES(1000, 'a 
1fa0: 62 20 63 27 29 3b 0a 20 20 43 4f 4d 4d 49 54 3b  b c');.  COMMIT;
1fb0: 0a 20 20 55 50 44 41 54 45 20 74 32 20 53 45 54  .  UPDATE t2 SET
1fc0: 20 78 3d 78 3b 0a 7d 0a 0a 64 6f 5f 65 78 65 63   x=x;.}..do_exec
1fd0: 73 71 6c 5f 74 65 73 74 20 31 36 2e 31 20 7b 0a  sql_test 16.1 {.
1fe0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 32    INSERT INTO t2
1ff0: 28 74 32 29 20 56 41 4c 55 45 53 28 27 69 6e 74  (t2) VALUES('int
2000: 65 67 72 69 74 79 2d 63 68 65 63 6b 27 29 3b 0a  egrity-check');.
2010: 7d 20 7b 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c  } {}..do_execsql
2020: 5f 74 65 73 74 20 31 36 2e 32 20 7b 0a 20 20 53  _test 16.2 {.  S
2030: 45 4c 45 43 54 20 72 6f 77 69 64 20 46 52 4f 4d  ELECT rowid FROM
2040: 20 74 32 28 27 62 27 29 20 4f 52 44 45 52 20 42   t2('b') ORDER B
2050: 59 20 72 6f 77 69 64 20 44 45 53 43 0a 7d 20 7b  Y rowid DESC.} {
2060: 31 30 30 30 20 34 35 36 20 31 7d 0a 0a 0a 23 2d  1000 456 1}...#-
2070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20b0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 0a 72 65 73 65 74  --------.#.reset
20c0: 5f 64 62 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74  _db.do_execsql_t
20d0: 65 73 74 20 31 36 2e 30 20 7b 0a 20 20 43 52 45  est 16.0 {.  CRE
20e0: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c  ATE VIRTUAL TABL
20f0: 45 20 74 32 20 55 53 49 4e 47 20 66 74 73 35 28  E t2 USING fts5(
2100: 78 2c 20 64 65 74 61 69 6c 3d 6e 6f 6e 65 29 3b  x, detail=none);
2110: 0a 20 20 42 45 47 49 4e 3b 0a 20 20 20 20 49 4e  .  BEGIN;.    IN
2120: 53 45 52 54 20 49 4e 54 4f 20 74 32 28 72 6f 77  SERT INTO t2(row
2130: 69 64 2c 20 78 29 20 56 41 4c 55 45 53 28 31 2c  id, x) VALUES(1,
2140: 20 27 61 20 62 20 63 27 29 3b 0a 20 20 20 20 49   'a b c');.    I
2150: 4e 53 45 52 54 20 49 4e 54 4f 20 74 32 28 72 6f  NSERT INTO t2(ro
2160: 77 69 64 2c 20 78 29 20 56 41 4c 55 45 53 28 34  wid, x) VALUES(4
2170: 35 36 2c 20 27 61 20 62 20 63 27 29 3b 0a 20 20  56, 'a b c');.  
2180: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 32    INSERT INTO t2
2190: 28 72 6f 77 69 64 2c 20 78 29 20 56 41 4c 55 45  (rowid, x) VALUE
21a0: 53 28 31 30 30 30 2c 20 27 61 20 62 20 63 27 29  S(1000, 'a b c')
21b0: 3b 0a 20 20 43 4f 4d 4d 49 54 3b 0a 20 20 55 50  ;.  COMMIT;.  UP
21c0: 44 41 54 45 20 74 32 20 53 45 54 20 78 3d 78 3b  DATE t2 SET x=x;
21d0: 0a 20 20 44 45 4c 45 54 45 20 46 52 4f 4d 20 74  .  DELETE FROM t
21e0: 32 3b 0a 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d  2;.}..#---------
21f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2200: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2230: 0a 23 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65  .#.reset_db.do_e
2240: 78 65 63 73 71 6c 5f 74 65 73 74 20 31 37 2e 30  xecsql_test 17.0
2250: 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54   {.  CREATE VIRT
2260: 55 41 4c 20 54 41 42 4c 45 20 74 32 20 55 53 49  UAL TABLE t2 USI
2270: 4e 47 20 66 74 73 35 28 78 2c 20 79 29 3b 0a 20  NG fts5(x, y);. 
2280: 20 42 45 47 49 4e 3b 0a 20 20 20 20 49 4e 53 45   BEGIN;.    INSE
2290: 52 54 20 49 4e 54 4f 20 74 32 20 56 41 4c 55 45  RT INTO t2 VALUE
22a0: 53 28 27 61 20 61 61 20 61 61 61 27 2c 20 27 62  S('a aa aaa', 'b
22b0: 20 62 62 20 62 62 62 27 29 3b 0a 20 20 20 20 49   bb bbb');.    I
22c0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 32 20 56 41  NSERT INTO t2 VA
22d0: 4c 55 45 53 28 27 61 20 61 61 20 61 61 61 27 2c  LUES('a aa aaa',
22e0: 20 27 62 20 62 62 20 62 62 62 27 29 3b 0a 20 20   'b bb bbb');.  
22f0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 32    INSERT INTO t2
2300: 20 56 41 4c 55 45 53 28 27 61 20 61 61 20 61 61   VALUES('a aa aa
2310: 61 27 2c 20 27 62 20 62 62 20 62 62 62 27 29 3b  a', 'b bb bbb');
2320: 0a 20 20 43 4f 4d 4d 49 54 3b 0a 7d 0a 64 6f 5f  .  COMMIT;.}.do_
2330: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31 37 2e  execsql_test 17.
2340: 31 20 7b 20 53 45 4c 45 43 54 20 2a 20 46 52 4f  1 { SELECT * FRO
2350: 4d 20 74 32 28 27 79 3a 61 2a 27 29 20 57 48 45  M t2('y:a*') WHE
2360: 52 45 20 72 6f 77 69 64 20 42 45 54 57 45 45 4e  RE rowid BETWEEN
2370: 20 31 30 20 41 4e 44 20 32 30 20 7d 0a 64 6f 5f   10 AND 20 }.do_
2380: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31 37 2e  execsql_test 17.
2390: 32 20 7b 0a 20 20 42 45 47 49 4e 3b 0a 20 20 20  2 {.  BEGIN;.   
23a0: 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 32 20   INSERT INTO t2 
23b0: 56 41 4c 55 45 53 28 27 61 20 61 61 20 61 61 61  VALUES('a aa aaa
23c0: 27 2c 20 27 62 20 62 62 20 62 62 62 27 29 3b 0a  ', 'b bb bbb');.
23d0: 20 20 20 20 53 45 4c 45 43 54 20 2a 20 46 52 4f      SELECT * FRO
23e0: 4d 20 74 32 28 27 79 3a 61 2a 27 29 20 57 48 45  M t2('y:a*') WHE
23f0: 52 45 20 72 6f 77 69 64 20 42 45 54 57 45 45 4e  RE rowid BETWEEN
2400: 20 31 30 20 41 4e 44 20 32 30 20 3b 0a 7d 0a 64   10 AND 20 ;.}.d
2410: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 31  o_execsql_test 1
2420: 37 2e 33 20 7b 0a 20 20 43 4f 4d 4d 49 54 0a 7d  7.3 {.  COMMIT.}
2430: 0a 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78  ..reset_db.do_ex
2440: 65 63 73 71 6c 5f 74 65 73 74 20 31 37 2e 34 20  ecsql_test 17.4 
2450: 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55  {.  CREATE VIRTU
2460: 41 4c 20 54 41 42 4c 45 20 74 32 20 55 53 49 4e  AL TABLE t2 USIN
2470: 47 20 66 74 73 35 28 78 2c 20 79 29 3b 0a 20 20  G fts5(x, y);.  
2480: 42 45 47 49 4e 3b 0a 20 20 20 20 49 4e 53 45 52  BEGIN;.    INSER
2490: 54 20 49 4e 54 4f 20 74 32 20 56 41 4c 55 45 53  T INTO t2 VALUES
24a0: 28 27 61 20 61 61 20 61 61 61 27 2c 20 27 62 20  ('a aa aaa', 'b 
24b0: 62 62 20 62 62 62 27 29 3b 0a 20 20 20 20 49 4e  bb bbb');.    IN
24c0: 53 45 52 54 20 49 4e 54 4f 20 74 32 20 56 41 4c  SERT INTO t2 VAL
24d0: 55 45 53 28 27 61 20 61 61 20 61 61 61 27 2c 20  UES('a aa aaa', 
24e0: 27 62 20 62 62 20 62 62 62 27 29 3b 0a 20 20 20  'b bb bbb');.   
24f0: 20 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74   SELECT * FROM t
2500: 32 28 27 79 3a 61 2a 27 29 20 57 48 45 52 45 20  2('y:a*') WHERE 
2510: 72 6f 77 69 64 3e 36 36 3b 0a 7d 0a 64 6f 5f 65  rowid>66;.}.do_e
2520: 78 65 63 73 71 6c 5f 74 65 73 74 20 31 37 2e 35  xecsql_test 17.5
2530: 20 7b 20 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d   { SELECT * FROM
2540: 20 74 32 28 27 78 3a 62 2a 20 4f 52 20 79 3a 61   t2('x:b* OR y:a
2550: 2a 27 29 20 7d 0a 64 6f 5f 65 78 65 63 73 71 6c  *') }.do_execsql
2560: 5f 74 65 73 74 20 31 37 2e 35 20 7b 20 43 4f 4d  _test 17.5 { COM
2570: 4d 49 54 20 3b 20 53 45 4c 45 43 54 20 2a 20 46  MIT ; SELECT * F
2580: 52 4f 4d 20 74 32 28 27 78 3a 62 2a 20 4f 52 20  ROM t2('x:b* OR 
2590: 79 3a 61 2a 27 29 20 7d 0a 64 6f 5f 65 78 65 63  y:a*') }.do_exec
25a0: 73 71 6c 5f 74 65 73 74 20 31 37 2e 36 20 7b 20  sql_test 17.6 { 
25b0: 0a 20 20 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  .  SELECT * FROM
25c0: 20 74 32 28 27 78 3a 62 2a 20 4f 52 20 79 3a 61   t2('x:b* OR y:a
25d0: 2a 27 29 20 57 48 45 52 45 20 72 6f 77 69 64 3e  *') WHERE rowid>
25e0: 35 35 0a 7d 0a 0a 23 64 62 20 65 76 61 6c 20 7b  55.}..#db eval {
25f0: 53 45 4c 45 43 54 20 72 6f 77 69 64 2c 20 66 74  SELECT rowid, ft
2600: 73 35 5f 64 65 63 6f 64 65 5f 6e 6f 6e 65 28 72  s5_decode_none(r
2610: 6f 77 69 64 2c 20 62 6c 6f 63 6b 29 20 61 53 20  owid, block) aS 
2620: 72 20 46 52 4f 4d 20 74 32 5f 64 61 74 61 7d 20  r FROM t2_data} 
2630: 7b 70 75 74 73 20 24 72 7d 0a 20 20 0a 66 69 6e  {puts $r}.  .fin
2640: 69 73 68 5f 74 65 73 74 0a 0a                    ish_test..