/ Hex Artifact Content
Login

Artifact 60094712debc59286c59aef0e6cf511c37d866802776a825ce437d26afe0817f:


0000: 23 20 32 30 31 35 20 4a 61 6e 20 31 33 0a 23 0a  # 2015 Jan 13.#.
0010: 23 20 54 68 65 20 61 75 74 68 6f 72 20 64 69 73  # The author dis
0020: 63 6c 61 69 6d 73 20 63 6f 70 79 72 69 67 68 74  claims copyright
0030: 20 74 6f 20 74 68 69 73 20 73 6f 75 72 63 65 20   to this source 
0040: 63 6f 64 65 2e 20 20 49 6e 20 70 6c 61 63 65 20  code.  In place 
0050: 6f 66 0a 23 20 61 20 6c 65 67 61 6c 20 6e 6f 74  of.# a legal not
0060: 69 63 65 2c 20 68 65 72 65 20 69 73 20 61 20 62  ice, here is a b
0070: 6c 65 73 73 69 6e 67 3a 0a 23 0a 23 20 20 20 20  lessing:.#.#    
0080: 4d 61 79 20 79 6f 75 20 64 6f 20 67 6f 6f 64 20  May you do good 
0090: 61 6e 64 20 6e 6f 74 20 65 76 69 6c 2e 0a 23 20  and not evil..# 
00a0: 20 20 20 4d 61 79 20 79 6f 75 20 66 69 6e 64 20     May you find 
00b0: 66 6f 72 67 69 76 65 6e 65 73 73 20 66 6f 72 20  forgiveness for 
00c0: 79 6f 75 72 73 65 6c 66 20 61 6e 64 20 66 6f 72  yourself and for
00d0: 67 69 76 65 20 6f 74 68 65 72 73 2e 0a 23 20 20  give others..#  
00e0: 20 20 4d 61 79 20 79 6f 75 20 73 68 61 72 65 20    May you share 
00f0: 66 72 65 65 6c 79 2c 20 6e 65 76 65 72 20 74 61  freely, never ta
0100: 6b 69 6e 67 20 6d 6f 72 65 20 74 68 61 6e 20 79  king more than y
0110: 6f 75 20 67 69 76 65 2e 0a 23 0a 23 2a 2a 2a 2a  ou give..#.#****
0120: 2a 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 0a 23 0a 23 20 54 68 69 73 20 66 69 6c  ***.#.# This fil
0170: 65 20 66 6f 63 75 73 65 73 20 6f 6e 20 74 68 65  e focuses on the
0180: 20 63 6f 64 65 20 69 6e 20 66 74 73 35 5f 63 6f   code in fts5_co
0190: 6e 66 69 67 2e 63 2c 20 77 68 69 63 68 20 69 73  nfig.c, which is
01a0: 20 6c 61 72 67 65 6c 79 20 63 6f 6e 63 65 72 6e   largely concern
01b0: 65 64 0a 23 20 77 69 74 68 20 70 61 72 73 69 6e  ed.# with parsin
01c0: 67 20 74 68 65 20 76 61 72 69 6f 75 73 20 63 6f  g the various co
01d0: 6e 66 69 67 75 72 61 74 69 6f 6e 20 61 6e 64 20  nfiguration and 
01e0: 43 52 45 41 54 45 20 54 41 42 4c 45 20 6f 70 74  CREATE TABLE opt
01f0: 69 6f 6e 73 2e 0a 23 0a 0a 73 6f 75 72 63 65 20  ions..#..source 
0200: 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 66 69 6c 65  [file join [file
0210: 20 64 69 72 6e 61 6d 65 20 5b 69 6e 66 6f 20 73   dirname [info s
0220: 63 72 69 70 74 5d 5d 20 66 74 73 35 5f 63 6f 6d  cript]] fts5_com
0230: 6d 6f 6e 2e 74 63 6c 5d 0a 73 65 74 20 74 65 73  mon.tcl].set tes
0240: 74 70 72 65 66 69 78 20 66 74 73 35 63 6f 6e 66  tprefix fts5conf
0250: 69 67 0a 0a 23 20 49 66 20 53 51 4c 49 54 45 5f  ig..# If SQLITE_
0260: 45 4e 41 42 4c 45 5f 46 54 53 35 20 69 73 20 64  ENABLE_FTS5 is d
0270: 65 66 69 6e 65 64 2c 20 6f 6d 69 74 20 74 68 69  efined, omit thi
0280: 73 20 66 69 6c 65 2e 0a 69 66 63 61 70 61 62 6c  s file..ifcapabl
0290: 65 20 21 66 74 73 35 20 7b 0a 20 20 66 69 6e 69  e !fts5 {.  fini
02a0: 73 68 5f 74 65 73 74 0a 20 20 72 65 74 75 72 6e  sh_test.  return
02b0: 0a 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}..#-----------
02c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
02d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 23  --------------.#
0300: 20 54 72 79 20 64 69 66 66 65 72 65 6e 74 20 74   Try different t
0310: 79 70 65 73 20 6f 66 20 71 75 6f 74 65 20 63 68  ypes of quote ch
0320: 61 72 61 63 74 65 72 73 2e 0a 23 0a 64 6f 5f 65  aracters..#.do_e
0330: 78 65 63 73 71 6c 5f 74 65 73 74 20 31 2e 30 20  xecsql_test 1.0 
0340: 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55  {.  CREATE VIRTU
0350: 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 4e  AL TABLE t1 USIN
0360: 47 20 66 74 73 35 28 27 61 27 2c 20 22 62 22 2c  G fts5('a', "b",
0370: 20 5b 63 5d 2c 20 60 64 60 29 3b 0a 20 20 50 52   [c], `d`);.  PR
0380: 41 47 4d 41 20 74 61 62 6c 65 5f 69 6e 66 6f 20  AGMA table_info 
0390: 3d 20 74 31 3b 0a 7d 20 7b 0a 20 20 30 20 61 20  = t1;.} {.  0 a 
03a0: 7b 7d 20 30 20 7b 7d 20 30 20 0a 20 20 31 20 62  {} 0 {} 0 .  1 b
03b0: 20 7b 7d 20 30 20 7b 7d 20 30 20 0a 20 20 32 20   {} 0 {} 0 .  2 
03c0: 63 20 7b 7d 20 30 20 7b 7d 20 30 20 0a 20 20 33  c {} 0 {} 0 .  3
03d0: 20 64 20 7b 7d 20 30 20 7b 7d 20 30 0a 7d 0a 0a   d {} 0 {} 0.}..
03e0: 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  #---------------
03f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0410: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 53 79 6e  ----------.# Syn
0430: 74 61 78 20 65 72 72 6f 72 73 20 69 6e 20 74 68  tax errors in th
0440: 65 20 70 72 65 66 69 78 3d 20 6f 70 74 69 6f 6e  e prefix= option
0450: 2e 0a 23 0a 66 6f 72 65 61 63 68 20 7b 74 6e 20  ..#.foreach {tn 
0460: 6f 70 74 7d 20 7b 0a 20 20 31 20 7b 70 72 65 66  opt} {.  1 {pref
0470: 69 78 3d 78 7d 20 20 0a 20 20 32 20 7b 70 72 65  ix=x}  .  2 {pre
0480: 66 69 78 3d 27 78 27 7d 0a 20 20 33 20 7b 70 72  fix='x'}.  3 {pr
0490: 65 66 69 78 3d 27 24 27 7d 0a 20 20 34 20 7b 70  efix='$'}.  4 {p
04a0: 72 65 66 69 78 3d 27 31 2c 32 2c 27 7d 0a 20 20  refix='1,2,'}.  
04b0: 35 20 7b 70 72 65 66 69 78 3d 27 2c 31 27 7d 0a  5 {prefix=',1'}.
04c0: 20 20 36 20 7b 70 72 65 66 69 78 3d 27 31 2c 32    6 {prefix='1,2
04d0: 2c 33 2e 2e 2e 27 7d 0a 20 20 37 20 7b 70 72 65  ,3...'}.  7 {pre
04e0: 66 69 78 3d 27 31 2c 32 2c 33 78 79 7a 27 7d 0a  fix='1,2,3xyz'}.
04f0: 7d 20 7b 0a 20 20 73 65 74 20 72 65 73 20 5b 6c  } {.  set res [l
0500: 69 73 74 20 31 20 7b 6d 61 6c 66 6f 72 6d 65 64  ist 1 {malformed
0510: 20 70 72 65 66 69 78 3d 2e 2e 2e 20 64 69 72 65   prefix=... dire
0520: 63 74 69 76 65 7d 5d 0a 20 20 64 6f 5f 63 61 74  ctive}].  do_cat
0530: 63 68 73 71 6c 5f 74 65 73 74 20 32 2e 24 74 6e  chsql_test 2.$tn
0540: 20 22 43 52 45 41 54 45 20 56 49 52 54 55 41 4c   "CREATE VIRTUAL
0550: 20 54 41 42 4c 45 20 66 31 20 55 53 49 4e 47 20   TABLE f1 USING 
0560: 66 74 73 35 28 78 2c 20 24 6f 70 74 29 22 20 24  fts5(x, $opt)" $
0570: 72 65 73 0a 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d  res.}..#--------
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 2d 2d 2d  ----------------
05a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
05b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
05c0: 2d 0a 23 20 53 79 6e 74 61 78 20 65 72 72 6f 72  -.# Syntax error
05d0: 73 20 69 6e 20 74 68 65 20 27 72 61 6e 6b 27 20  s in the 'rank' 
05e0: 6f 70 74 69 6f 6e 2e 0a 23 0a 66 6f 72 65 61 63  option..#.foreac
05f0: 68 20 7b 74 6e 20 76 61 6c 7d 20 7b 0a 20 20 31  h {tn val} {.  1
0600: 20 22 66 31 28 78 79 7a 29 22 0a 20 20 32 20 22   "f1(xyz)".  2 "
0610: 66 31 28 7a 79 78 29 22 0a 20 20 33 20 22 66 31  f1(zyx)".  3 "f1
0620: 28 6e 7a 7a 29 22 0a 20 20 34 20 22 66 31 28 78  (nzz)".  4 "f1(x
0630: 27 21 21 27 29 22 0a 20 20 35 20 22 66 31 28 78  '!!')".  5 "f1(x
0640: 27 3a 3b 27 29 22 0a 20 20 36 20 22 66 31 28 78  ':;')".  6 "f1(x
0650: 27 5b 5d 27 29 22 0a 20 20 37 20 22 66 31 28 78  '[]')".  7 "f1(x
0660: 27 7b 7d 27 29 22 0a 20 20 38 20 22 66 31 28 27  '{}')".  8 "f1('
0670: 61 62 63 29 22 0a 7d 20 7b 0a 20 20 64 6f 5f 63  abc)".} {.  do_c
0680: 61 74 63 68 73 71 6c 5f 74 65 73 74 20 33 2e 24  atchsql_test 3.$
0690: 74 6e 20 7b 0a 20 20 20 20 49 4e 53 45 52 54 20  tn {.    INSERT 
06a0: 49 4e 54 4f 20 74 31 28 74 31 2c 20 72 61 6e 6b  INTO t1(t1, rank
06b0: 29 20 56 41 4c 55 45 53 28 27 72 61 6e 6b 27 2c  ) VALUES('rank',
06c0: 20 24 76 61 6c 29 3b 0a 20 20 7d 20 7b 31 20 7b   $val);.  } {1 {
06d0: 53 51 4c 20 6c 6f 67 69 63 20 65 72 72 6f 72 7d  SQL logic error}
06e0: 7d 0a 7d 0a 0a 23 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 2d 2d 2d 2d 2d 2d 2d  ----------------
0710: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0720: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
0730: 23 20 54 68 65 20 70 61 72 73 69 6e 67 20 6f 66  # The parsing of
0740: 20 53 51 4c 20 6c 69 74 65 72 61 6c 73 20 73 70   SQL literals sp
0750: 65 63 69 66 69 65 64 20 61 73 20 70 61 72 74 20  ecified as part 
0760: 6f 66 20 27 72 61 6e 6b 27 20 6f 70 74 69 6f 6e  of 'rank' option
0770: 73 2e 0a 23 0a 64 6f 5f 65 78 65 63 73 71 6c 5f  s..#.do_execsql_
0780: 74 65 73 74 20 34 2e 30 20 7b 0a 20 20 43 52 45  test 4.0 {.  CRE
0790: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c  ATE VIRTUAL TABL
07a0: 45 20 7a 7a 7a 20 55 53 49 4e 47 20 66 74 73 35  E zzz USING fts5
07b0: 28 6f 6e 65 29 3b 0a 20 20 49 4e 53 45 52 54 20  (one);.  INSERT 
07c0: 49 4e 54 4f 20 7a 7a 7a 20 56 41 4c 55 45 53 28  INTO zzz VALUES(
07d0: 27 61 20 62 20 63 27 29 3b 0a 7d 0a 70 72 6f 63  'a b c');.}.proc
07e0: 20 66 69 72 73 74 20 7b 63 6d 64 20 41 7d 20 7b   first {cmd A} {
07f0: 20 72 65 74 75 72 6e 20 24 41 20 7d 0a 73 71 6c   return $A }.sql
0800: 69 74 65 33 5f 66 74 73 35 5f 63 72 65 61 74 65  ite3_fts5_create
0810: 5f 66 75 6e 63 74 69 6f 6e 20 64 62 20 66 69 72  _function db fir
0820: 73 74 20 66 69 72 73 74 0a 0a 66 6f 72 65 61 63  st first..foreac
0830: 68 20 7b 74 6e 20 61 72 67 7d 20 7b 0a 20 20 31  h {tn arg} {.  1
0840: 20 22 31 32 33 22 0a 20 20 32 20 22 27 30 31 32   "123".  2 "'012
0850: 33 34 35 36 37 38 39 30 41 42 43 44 45 46 27 22  34567890ABCDEF'"
0860: 0a 20 20 33 20 22 78 27 30 31 32 33 27 22 0a 20  .  3 "x'0123'". 
0870: 20 34 20 22 78 27 41 42 43 44 27 22 0a 20 20 35   4 "x'ABCD'".  5
0880: 20 22 78 27 30 31 32 33 34 35 36 37 38 39 41 42   "x'0123456789AB
0890: 43 44 45 46 27 22 0a 20 20 36 20 22 78 27 30 31  CDEF'".  6 "x'01
08a0: 32 33 34 35 36 37 38 39 61 62 63 64 65 66 27 22  23456789abcdef'"
08b0: 0a 20 20 37 20 22 32 32 2e 35 22 0a 20 20 38 20  .  7 "22.5".  8 
08c0: 22 2d 39 31 2e 35 22 0a 20 20 39 20 22 2d 2e 35  "-91.5".  9 "-.5
08d0: 22 0a 20 20 31 30 20 22 27 27 27 27 22 0a 20 20  ".  10 "''''".  
08e0: 31 31 20 22 2b 2e 35 22 0a 7d 20 7b 0a 20 20 73  11 "+.5".} {.  s
08f0: 65 74 20 66 75 6e 63 20 5b 73 74 72 69 6e 67 20  et func [string 
0900: 6d 61 70 20 7b 27 20 27 27 7d 20 22 66 69 72 73  map {' ''} "firs
0910: 74 28 24 61 72 67 29 22 5d 0a 20 20 64 6f 5f 65  t($arg)"].  do_e
0920: 78 65 63 73 71 6c 5f 74 65 73 74 20 34 2e 31 2e  xecsql_test 4.1.
0930: 24 74 6e 20 22 0a 20 20 20 20 49 4e 53 45 52 54  $tn ".    INSERT
0940: 20 49 4e 54 4f 20 7a 7a 7a 28 7a 7a 7a 2c 20 72   INTO zzz(zzz, r
0950: 61 6e 6b 29 20 56 41 4c 55 45 53 28 27 72 61 6e  ank) VALUES('ran
0960: 6b 27 2c 20 27 24 66 75 6e 63 27 29 3b 0a 20 20  k', '$func');.  
0970: 20 20 53 45 4c 45 43 54 20 72 61 6e 6b 20 49 53    SELECT rank IS
0980: 20 24 61 72 67 20 46 52 4f 4d 20 7a 7a 7a 20 57   $arg FROM zzz W
0990: 48 45 52 45 20 7a 7a 7a 20 4d 41 54 43 48 20 27  HERE zzz MATCH '
09a0: 61 20 2b 20 62 20 2b 20 63 27 0a 20 20 22 20 31  a + b + c'.  " 1
09b0: 0a 7d 0a 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74  .}..do_execsql_t
09c0: 65 73 74 20 34 2e 32 20 7b 0a 20 20 49 4e 53 45  est 4.2 {.  INSE
09d0: 52 54 20 49 4e 54 4f 20 7a 7a 7a 28 7a 7a 7a 2c  RT INTO zzz(zzz,
09e0: 20 72 61 6e 6b 29 20 56 41 4c 55 45 53 28 27 72   rank) VALUES('r
09f0: 61 6e 6b 27 2c 20 27 66 31 28 29 27 29 3b 0a 7d  ank', 'f1()');.}
0a00: 20 7b 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   {}..#----------
0a10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
0a50: 23 20 4d 69 73 71 75 6f 74 69 6e 67 20 69 6e 20  # Misquoting in 
0a60: 74 6f 6b 65 6e 69 7a 65 3d 20 61 6e 64 20 6f 74  tokenize= and ot
0a70: 68 65 72 20 6f 70 74 69 6f 6e 73 2e 20 0a 23 0a  her options. .#.
0a80: 64 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65 73 74  do_catchsql_test
0a90: 20 35 2e 31 20 7b 0a 20 20 43 52 45 41 54 45 20   5.1 {.  CREATE 
0aa0: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 78 78  VIRTUAL TABLE xx
0ab0: 20 55 53 49 4e 47 20 66 74 73 35 28 78 2c 20 74   USING fts5(x, t
0ac0: 6f 6b 65 6e 69 7a 65 3d 22 70 6f 72 74 65 72 20  okenize="porter 
0ad0: 27 61 73 63 69 69 22 29 3b 0a 7d 20 7b 31 20 7b  'ascii");.} {1 {
0ae0: 70 61 72 73 65 20 65 72 72 6f 72 20 69 6e 20 74  parse error in t
0af0: 6f 6b 65 6e 69 7a 65 20 64 69 72 65 63 74 69 76  okenize directiv
0b00: 65 7d 7d 20 0a 0a 64 6f 5f 63 61 74 63 68 73 71  e}} ..do_catchsq
0b10: 6c 5f 74 65 73 74 20 35 2e 32 20 7b 0a 20 20 43  l_test 5.2 {.  C
0b20: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
0b30: 42 4c 45 20 78 78 20 55 53 49 4e 47 20 66 74 73  BLE xx USING fts
0b40: 35 28 78 2c 20 5b 79 5b 5d 29 3b 0a 7d 20 7b 30  5(x, [y[]);.} {0
0b50: 20 7b 7d 7d 0a 0a 64 6f 5f 63 61 74 63 68 73 71   {}}..do_catchsq
0b60: 6c 5f 74 65 73 74 20 35 2e 33 20 7b 0a 20 20 43  l_test 5.3 {.  C
0b70: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
0b80: 42 4c 45 20 79 79 20 55 53 49 4e 47 20 66 74 73  BLE yy USING fts
0b90: 35 28 78 2c 20 5b 79 5d 5d 29 3b 0a 7d 20 7b 31  5(x, [y]]);.} {1
0ba0: 20 7b 75 6e 72 65 63 6f 67 6e 69 7a 65 64 20 74   {unrecognized t
0bb0: 6f 6b 65 6e 3a 20 22 5d 22 7d 7d 0a 0a 23 2d 2d  oken: "]"}}..#--
0bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 23 20 45 72 72 6f 72 73  -------.# Errors
0c10: 20 69 6e 20 70 72 65 66 69 78 3d 20 64 69 72 65   in prefix= dire
0c20: 63 74 69 76 65 73 2e 0a 23 0a 64 6f 5f 63 61 74  ctives..#.do_cat
0c30: 63 68 73 71 6c 5f 74 65 73 74 20 36 2e 32 20 7b  chsql_test 6.2 {
0c40: 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41  .  CREATE VIRTUA
0c50: 4c 20 54 41 42 4c 45 20 61 62 63 20 55 53 49 4e  L TABLE abc USIN
0c60: 47 20 66 74 73 35 28 61 2c 20 70 72 65 66 69 78  G fts5(a, prefix
0c70: 3d 27 31 2c 20 32 2c 20 31 30 30 31 27 29 3b 0a  ='1, 2, 1001');.
0c80: 7d 20 7b 31 20 7b 70 72 65 66 69 78 20 6c 65 6e  } {1 {prefix len
0c90: 67 74 68 20 6f 75 74 20 6f 66 20 72 61 6e 67 65  gth out of range
0ca0: 20 28 6d 61 78 20 39 39 39 29 7d 7d 0a 64 6f 5f   (max 999)}}.do_
0cb0: 63 61 74 63 68 73 71 6c 5f 74 65 73 74 20 36 2e  catchsql_test 6.
0cc0: 33 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52  3 {.  CREATE VIR
0cd0: 54 55 41 4c 20 54 41 62 4c 45 20 61 62 63 20 55  TUAL TAbLE abc U
0ce0: 53 49 4e 47 20 66 74 73 35 28 61 2c 20 70 72 65  SING fts5(a, pre
0cf0: 66 69 78 3d 27 31 2c 20 32 2c 20 30 30 30 30 27  fix='1, 2, 0000'
0d00: 29 3b 0a 7d 20 7b 31 20 7b 70 72 65 66 69 78 20  );.} {1 {prefix 
0d10: 6c 65 6e 67 74 68 20 6f 75 74 20 6f 66 20 72 61  length out of ra
0d20: 6e 67 65 20 28 6d 61 78 20 39 39 39 29 7d 7d 0a  nge (max 999)}}.
0d30: 64 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65 73 74  do_catchsql_test
0d40: 20 36 2e 34 20 7b 0a 20 20 43 52 45 41 54 45 20   6.4 {.  CREATE 
0d50: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 61 62  VIRTUAL TABLE ab
0d60: 63 20 55 53 49 4e 47 20 66 74 73 35 28 61 2c 20  c USING fts5(a, 
0d70: 70 72 65 66 69 78 3d 27 31 20 20 2c 20 31 30 30  prefix='1  , 100
0d80: 30 30 30 30 27 29 3b 0a 7d 20 7b 31 20 7b 70 72  0000');.} {1 {pr
0d90: 65 66 69 78 20 6c 65 6e 67 74 68 20 6f 75 74 20  efix length out 
0da0: 6f 66 20 72 61 6e 67 65 20 28 6d 61 78 20 39 39  of range (max 99
0db0: 39 29 7d 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d  9)}}..#---------
0dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e00: 0a 23 20 44 75 70 6c 69 63 61 74 65 20 74 6f 6b  .# Duplicate tok
0e10: 65 6e 69 7a 65 3d 20 61 6e 64 20 6f 74 68 65 72  enize= and other
0e20: 20 6f 70 74 69 6f 6e 73 2e 0a 23 0a 64 6f 5f 63   options..#.do_c
0e30: 61 74 63 68 73 71 6c 5f 74 65 73 74 20 37 2e 31  atchsql_test 7.1
0e40: 20 7b 0a 20 20 43 52 45 41 54 45 20 56 49 52 54   {.  CREATE VIRT
0e50: 55 41 4c 20 54 41 42 4c 45 20 61 62 63 20 55 53  UAL TABLE abc US
0e60: 49 4e 47 20 66 74 73 35 28 61 2c 20 74 6f 6b 65  ING fts5(a, toke
0e70: 6e 69 7a 65 3d 70 6f 72 74 65 72 2c 20 74 6f 6b  nize=porter, tok
0e80: 65 6e 69 7a 65 3d 61 73 63 69 69 29 3b 0a 7d 20  enize=ascii);.} 
0e90: 7b 31 20 7b 6d 75 6c 74 69 70 6c 65 20 74 6f 6b  {1 {multiple tok
0ea0: 65 6e 69 7a 65 3d 2e 2e 2e 20 64 69 72 65 63 74  enize=... direct
0eb0: 69 76 65 73 7d 7d 0a 64 6f 5f 63 61 74 63 68 73  ives}}.do_catchs
0ec0: 71 6c 5f 74 65 73 74 20 37 2e 32 20 7b 0a 20 20  ql_test 7.2 {.  
0ed0: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54  CREATE VIRTUAL T
0ee0: 41 42 4c 45 20 61 62 63 20 55 53 49 4e 47 20 66  ABLE abc USING f
0ef0: 74 73 35 28 61 2c 20 63 6f 6e 74 65 6e 74 3d 70  ts5(a, content=p
0f00: 6f 72 74 65 72 2c 20 63 6f 6e 74 65 6e 74 3d 61  orter, content=a
0f10: 73 63 69 69 29 3b 0a 7d 20 7b 31 20 7b 6d 75 6c  scii);.} {1 {mul
0f20: 74 69 70 6c 65 20 63 6f 6e 74 65 6e 74 3d 2e 2e  tiple content=..
0f30: 2e 20 64 69 72 65 63 74 69 76 65 73 7d 7d 0a 64  . directives}}.d
0f40: 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65 73 74 20  o_catchsql_test 
0f50: 37 2e 33 20 7b 0a 20 20 43 52 45 41 54 45 20 56  7.3 {.  CREATE V
0f60: 49 52 54 55 41 4c 20 54 41 42 4c 45 20 61 62 63  IRTUAL TABLE abc
0f70: 20 55 53 49 4e 47 20 66 74 73 35 28 61 2c 20 63   USING fts5(a, c
0f80: 6f 6e 74 65 6e 74 5f 72 6f 77 69 64 3d 70 6f 72  ontent_rowid=por
0f90: 74 65 72 2c 20 63 6f 6e 74 65 6e 74 5f 72 6f 77  ter, content_row
0fa0: 69 64 3d 61 29 3b 0a 7d 20 7b 31 20 7b 6d 75 6c  id=a);.} {1 {mul
0fb0: 74 69 70 6c 65 20 63 6f 6e 74 65 6e 74 5f 72 6f  tiple content_ro
0fc0: 77 69 64 3d 2e 2e 2e 20 64 69 72 65 63 74 69 76  wid=... directiv
0fd0: 65 73 7d 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d  es}}..#---------
0fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1020: 0a 23 20 55 6e 72 65 63 6f 67 6e 69 7a 65 64 20  .# Unrecognized 
1030: 6f 70 74 69 6f 6e 2e 0a 23 0a 64 6f 5f 63 61 74  option..#.do_cat
1040: 63 68 73 71 6c 5f 74 65 73 74 20 38 2e 30 20 7b  chsql_test 8.0 {
1050: 0a 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41  .  CREATE VIRTUA
1060: 4c 20 54 41 42 4c 45 20 61 62 63 20 55 53 49 4e  L TABLE abc USIN
1070: 47 20 66 74 73 35 28 61 2c 20 6e 6f 73 75 63 68  G fts5(a, nosuch
1080: 6f 70 74 69 6f 6e 3d 31 32 33 29 3b 0a 7d 20 7b  option=123);.} {
1090: 31 20 7b 75 6e 72 65 63 6f 67 6e 69 7a 65 64 20  1 {unrecognized 
10a0: 6f 70 74 69 6f 6e 3a 20 22 6e 6f 73 75 63 68 6f  option: "nosucho
10b0: 70 74 69 6f 6e 22 7d 7d 0a 64 6f 5f 63 61 74 63  ption"}}.do_catc
10c0: 68 73 71 6c 5f 74 65 73 74 20 38 2e 31 20 7b 0a  hsql_test 8.1 {.
10d0: 20 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c    CREATE VIRTUAL
10e0: 20 54 41 42 4c 45 20 61 62 63 20 55 53 49 4e 47   TABLE abc USING
10f0: 20 66 74 73 35 28 61 2c 20 22 6e 6f 73 75 63 68   fts5(a, "nosuch
1100: 6f 70 74 69 6f 6e 22 3d 31 32 33 29 3b 0a 7d 20  option"=123);.} 
1110: 7b 31 20 7b 70 61 72 73 65 20 65 72 72 6f 72 20  {1 {parse error 
1120: 69 6e 20 22 22 6e 6f 73 75 63 68 6f 70 74 69 6f  in ""nosuchoptio
1130: 6e 22 3d 31 32 33 22 7d 7d 0a 0a 23 2d 2d 2d 2d  n"=123"}}..#----
1140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1180: 2d 2d 2d 2d 2d 0a 23 20 45 72 72 6f 72 73 20 69  -----.# Errors i
1190: 6e 3a 0a 23 0a 23 20 20 20 39 2e 31 2e 2a 20 27  n:.#.#   9.1.* '
11a0: 70 67 73 7a 27 20 6f 70 74 69 6f 6e 73 2e 0a 23  pgsz' options..#
11b0: 20 20 20 39 2e 32 2e 2a 20 27 61 75 74 6f 6d 65     9.2.* 'autome
11c0: 72 67 65 27 20 6f 70 74 69 6f 6e 73 2e 0a 23 20  rge' options..# 
11d0: 20 20 39 2e 33 2e 2a 20 27 63 72 69 73 69 73 6d    9.3.* 'crisism
11e0: 65 72 67 65 27 20 6f 70 74 69 6f 6e 73 2e 0a 23  erge' options..#
11f0: 20 20 20 39 2e 34 2e 2a 20 61 20 6e 6f 6e 2d 65     9.4.* a non-e
1200: 78 69 73 74 61 6e 74 20 6f 70 74 69 6f 6e 2e 0a  xistant option..
1210: 23 20 20 20 39 2e 35 2e 2a 20 27 68 61 73 68 73  #   9.5.* 'hashs
1220: 69 7a 65 27 20 6f 70 74 69 6f 6e 73 2e 0a 23 0a  ize' options..#.
1230: 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20  do_execsql_test 
1240: 39 2e 30 20 7b 0a 20 20 43 52 45 41 54 45 20 56  9.0 {.  CREATE V
1250: 49 52 54 55 41 4c 20 54 41 42 4c 45 20 61 62 63  IRTUAL TABLE abc
1260: 20 55 53 49 4e 47 20 66 74 73 35 28 61 2c 20 62   USING fts5(a, b
1270: 29 3b 0a 7d 20 7b 7d 0a 64 6f 5f 63 61 74 63 68  );.} {}.do_catch
1280: 73 71 6c 5f 74 65 73 74 20 39 2e 31 2e 31 20 7b  sql_test 9.1.1 {
1290: 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 61  .  INSERT INTO a
12a0: 62 63 28 61 62 63 2c 20 72 61 6e 6b 29 20 56 41  bc(abc, rank) VA
12b0: 4c 55 45 53 28 27 70 67 73 7a 27 2c 20 2d 35 29  LUES('pgsz', -5)
12c0: 3b 0a 7d 20 7b 31 20 7b 53 51 4c 20 6c 6f 67 69  ;.} {1 {SQL logi
12d0: 63 20 65 72 72 6f 72 7d 7d 0a 64 6f 5f 63 61 74  c error}}.do_cat
12e0: 63 68 73 71 6c 5f 74 65 73 74 20 39 2e 31 2e 32  chsql_test 9.1.2
12f0: 20 7b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f   {.  INSERT INTO
1300: 20 61 62 63 28 61 62 63 2c 20 72 61 6e 6b 29 20   abc(abc, rank) 
1310: 56 41 4c 55 45 53 28 27 70 67 73 7a 27 2c 20 35  VALUES('pgsz', 5
1320: 30 30 30 30 30 30 30 29 3b 0a 7d 20 7b 31 20 7b  0000000);.} {1 {
1330: 53 51 4c 20 6c 6f 67 69 63 20 65 72 72 6f 72 7d  SQL logic error}
1340: 7d 0a 64 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65  }.do_catchsql_te
1350: 73 74 20 39 2e 31 2e 33 20 7b 0a 20 20 49 4e 53  st 9.1.3 {.  INS
1360: 45 52 54 20 49 4e 54 4f 20 61 62 63 28 61 62 63  ERT INTO abc(abc
1370: 2c 20 72 61 6e 6b 29 20 56 41 4c 55 45 53 28 27  , rank) VALUES('
1380: 70 67 73 7a 27 2c 20 36 36 2e 36 37 29 3b 0a 7d  pgsz', 66.67);.}
1390: 20 7b 31 20 7b 53 51 4c 20 6c 6f 67 69 63 20 65   {1 {SQL logic e
13a0: 72 72 6f 72 7d 7d 0a 0a 64 6f 5f 63 61 74 63 68  rror}}..do_catch
13b0: 73 71 6c 5f 74 65 73 74 20 39 2e 32 2e 31 20 7b  sql_test 9.2.1 {
13c0: 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 61  .  INSERT INTO a
13d0: 62 63 28 61 62 63 2c 20 72 61 6e 6b 29 20 56 41  bc(abc, rank) VA
13e0: 4c 55 45 53 28 27 61 75 74 6f 6d 65 72 67 65 27  LUES('automerge'
13f0: 2c 20 2d 35 29 3b 0a 7d 20 7b 31 20 7b 53 51 4c  , -5);.} {1 {SQL
1400: 20 6c 6f 67 69 63 20 65 72 72 6f 72 7d 7d 0a 64   logic error}}.d
1410: 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65 73 74 20  o_catchsql_test 
1420: 39 2e 32 2e 32 20 7b 0a 20 20 49 4e 53 45 52 54  9.2.2 {.  INSERT
1430: 20 49 4e 54 4f 20 61 62 63 28 61 62 63 2c 20 72   INTO abc(abc, r
1440: 61 6e 6b 29 20 56 41 4c 55 45 53 28 27 61 75 74  ank) VALUES('aut
1450: 6f 6d 65 72 67 65 27 2c 20 35 30 30 30 30 30 30  omerge', 5000000
1460: 30 29 3b 0a 7d 20 7b 31 20 7b 53 51 4c 20 6c 6f  0);.} {1 {SQL lo
1470: 67 69 63 20 65 72 72 6f 72 7d 7d 0a 64 6f 5f 63  gic error}}.do_c
1480: 61 74 63 68 73 71 6c 5f 74 65 73 74 20 39 2e 32  atchsql_test 9.2
1490: 2e 33 20 7b 0a 20 20 49 4e 53 45 52 54 20 49 4e  .3 {.  INSERT IN
14a0: 54 4f 20 61 62 63 28 61 62 63 2c 20 72 61 6e 6b  TO abc(abc, rank
14b0: 29 20 56 41 4c 55 45 53 28 27 61 75 74 6f 6d 65  ) VALUES('autome
14c0: 72 67 65 27 2c 20 36 36 2e 36 37 29 3b 0a 7d 20  rge', 66.67);.} 
14d0: 7b 31 20 7b 53 51 4c 20 6c 6f 67 69 63 20 65 72  {1 {SQL logic er
14e0: 72 6f 72 7d 7d 0a 64 6f 5f 65 78 65 63 73 71 6c  ror}}.do_execsql
14f0: 5f 74 65 73 74 20 39 2e 32 2e 34 20 7b 0a 20 20  _test 9.2.4 {.  
1500: 49 4e 53 45 52 54 20 49 4e 54 4f 20 61 62 63 28  INSERT INTO abc(
1510: 61 62 63 2c 20 72 61 6e 6b 29 20 56 41 4c 55 45  abc, rank) VALUE
1520: 53 28 27 61 75 74 6f 6d 65 72 67 65 27 2c 20 31  S('automerge', 1
1530: 29 3b 0a 7d 20 7b 7d 0a 0a 64 6f 5f 63 61 74 63  );.} {}..do_catc
1540: 68 73 71 6c 5f 74 65 73 74 20 39 2e 33 2e 31 20  hsql_test 9.3.1 
1550: 7b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20  {.  INSERT INTO 
1560: 61 62 63 28 61 62 63 2c 20 72 61 6e 6b 29 20 56  abc(abc, rank) V
1570: 41 4c 55 45 53 28 27 63 72 69 73 69 73 6d 65 72  ALUES('crisismer
1580: 67 65 27 2c 20 2d 35 29 3b 0a 7d 20 7b 31 20 7b  ge', -5);.} {1 {
1590: 53 51 4c 20 6c 6f 67 69 63 20 65 72 72 6f 72 7d  SQL logic error}
15a0: 7d 0a 64 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65  }.do_catchsql_te
15b0: 73 74 20 39 2e 33 2e 32 20 7b 0a 20 20 49 4e 53  st 9.3.2 {.  INS
15c0: 45 52 54 20 49 4e 54 4f 20 61 62 63 28 61 62 63  ERT INTO abc(abc
15d0: 2c 20 72 61 6e 6b 29 20 56 41 4c 55 45 53 28 27  , rank) VALUES('
15e0: 63 72 69 73 69 73 6d 65 72 67 65 27 2c 20 36 36  crisismerge', 66
15f0: 2e 36 37 29 3b 0a 7d 20 7b 31 20 7b 53 51 4c 20  .67);.} {1 {SQL 
1600: 6c 6f 67 69 63 20 65 72 72 6f 72 7d 7d 0a 64 6f  logic error}}.do
1610: 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 39 2e  _execsql_test 9.
1620: 33 2e 33 20 7b 0a 20 20 49 4e 53 45 52 54 20 49  3.3 {.  INSERT I
1630: 4e 54 4f 20 61 62 63 28 61 62 63 2c 20 72 61 6e  NTO abc(abc, ran
1640: 6b 29 20 56 41 4c 55 45 53 28 27 63 72 69 73 69  k) VALUES('crisi
1650: 73 6d 65 72 67 65 27 2c 20 31 29 3b 0a 7d 20 7b  smerge', 1);.} {
1660: 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73  }.do_execsql_tes
1670: 74 20 39 2e 33 2e 34 20 7b 0a 20 20 49 4e 53 45  t 9.3.4 {.  INSE
1680: 52 54 20 49 4e 54 4f 20 61 62 63 28 61 62 63 2c  RT INTO abc(abc,
1690: 20 72 61 6e 6b 29 20 56 41 4c 55 45 53 28 27 63   rank) VALUES('c
16a0: 72 69 73 69 73 6d 65 72 67 65 27 2c 20 35 30 30  risismerge', 500
16b0: 30 30 30 30 30 29 3b 0a 7d 20 7b 7d 0a 0a 64 6f  00000);.} {}..do
16c0: 5f 63 61 74 63 68 73 71 6c 5f 74 65 73 74 20 39  _catchsql_test 9
16d0: 2e 34 2e 31 20 7b 0a 20 20 49 4e 53 45 52 54 20  .4.1 {.  INSERT 
16e0: 49 4e 54 4f 20 61 62 63 28 61 62 63 2c 20 72 61  INTO abc(abc, ra
16f0: 6e 6b 29 20 56 41 4c 55 45 53 28 27 6e 6f 73 75  nk) VALUES('nosu
1700: 63 68 6f 70 74 69 6f 6e 27 2c 20 31 29 3b 0a 7d  choption', 1);.}
1710: 20 7b 31 20 7b 53 51 4c 20 6c 6f 67 69 63 20 65   {1 {SQL logic e
1720: 72 72 6f 72 7d 7d 0a 0a 64 6f 5f 63 61 74 63 68  rror}}..do_catch
1730: 73 71 6c 5f 74 65 73 74 20 39 2e 35 2e 31 20 7b  sql_test 9.5.1 {
1740: 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 61  .  INSERT INTO a
1750: 62 63 28 61 62 63 2c 20 72 61 6e 6b 29 20 56 41  bc(abc, rank) VA
1760: 4c 55 45 53 28 27 68 61 73 68 73 69 7a 65 27 2c  LUES('hashsize',
1770: 20 27 6e 6f 74 20 61 6e 20 69 6e 74 65 67 65 72   'not an integer
1780: 27 29 3b 0a 7d 20 7b 31 20 7b 53 51 4c 20 6c 6f  ');.} {1 {SQL lo
1790: 67 69 63 20 65 72 72 6f 72 7d 7d 0a 64 6f 5f 63  gic error}}.do_c
17a0: 61 74 63 68 73 71 6c 5f 74 65 73 74 20 39 2e 35  atchsql_test 9.5
17b0: 2e 32 20 7b 0a 20 20 49 4e 53 45 52 54 20 49 4e  .2 {.  INSERT IN
17c0: 54 4f 20 61 62 63 28 61 62 63 2c 20 72 61 6e 6b  TO abc(abc, rank
17d0: 29 20 56 41 4c 55 45 53 28 27 68 61 73 68 73 69  ) VALUES('hashsi
17e0: 7a 65 27 2c 20 2d 35 30 30 30 30 30 29 3b 0a 7d  ze', -500000);.}
17f0: 20 7b 31 20 7b 53 51 4c 20 6c 6f 67 69 63 20 65   {1 {SQL logic e
1800: 72 72 6f 72 7d 7d 0a 64 6f 5f 63 61 74 63 68 73  rror}}.do_catchs
1810: 71 6c 5f 74 65 73 74 20 39 2e 35 2e 33 20 7b 0a  ql_test 9.5.3 {.
1820: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 61 62    INSERT INTO ab
1830: 63 28 61 62 63 2c 20 72 61 6e 6b 29 20 56 41 4c  c(abc, rank) VAL
1840: 55 45 53 28 27 68 61 73 68 73 69 7a 65 27 2c 20  UES('hashsize', 
1850: 35 30 30 30 30 30 29 3b 0a 7d 20 7b 30 20 7b 7d  500000);.} {0 {}
1860: 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..#------------
1870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
18b0: 54 6f 6f 20 6d 61 6e 79 20 70 72 65 66 69 78 20  Too many prefix 
18c0: 69 6e 64 65 78 65 73 2e 20 4d 61 78 69 6d 75 6d  indexes. Maximum
18d0: 20 61 6c 6c 6f 77 65 64 20 69 73 20 33 31 2e 0a   allowed is 31..
18e0: 23 0a 66 6f 72 65 61 63 68 20 7b 74 6e 20 73 70  #.foreach {tn sp
18f0: 65 63 7d 20 7b 0a 20 20 31 20 7b 70 72 65 66 69  ec} {.  1 {prefi
1900: 78 3d 22 31 20 32 20 33 20 34 20 35 20 36 20 37  x="1 2 3 4 5 6 7
1910: 20 38 20 39 20 31 30 20 31 31 20 31 32 20 31 33   8 9 10 11 12 13
1920: 20 31 34 20 31 35 20 31 36 20 31 37 20 31 38 20   14 15 16 17 18 
1930: 31 39 20 32 30 20 32 31 20 32 32 20 32 33 20 32  19 20 21 22 23 2
1940: 34 20 32 35 20 32 36 20 32 37 20 32 38 20 32 39  4 25 26 27 28 29
1950: 20 33 30 20 33 31 20 33 32 22 7d 0a 20 20 32 20   30 31 32"}.  2 
1960: 7b 70 72 65 66 69 78 3d 22 31 20 32 20 33 20 34  {prefix="1 2 3 4
1970: 22 2c 20 70 72 65 66 69 78 3d 22 35 20 36 20 37  ", prefix="5 6 7
1980: 20 38 20 39 20 31 30 20 31 31 20 31 32 20 31 33   8 9 10 11 12 13
1990: 20 31 34 20 31 35 20 31 36 20 31 37 20 31 38 20   14 15 16 17 18 
19a0: 31 39 20 32 30 20 32 31 20 32 32 20 32 33 20 32  19 20 21 22 23 2
19b0: 34 20 32 35 20 32 36 20 32 37 20 32 38 20 32 39  4 25 26 27 28 29
19c0: 20 33 30 20 33 31 20 33 32 22 7d 0a 7d 20 7b 0a   30 31 32"}.} {.
19d0: 20 20 73 65 74 20 73 71 6c 20 22 43 52 45 41 54    set sql "CREAT
19e0: 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20  E VIRTUAL TABLE 
19f0: 78 79 7a 20 55 53 49 4e 47 20 66 74 73 35 28 78  xyz USING fts5(x
1a00: 2c 20 24 73 70 65 63 29 22 0a 20 20 64 6f 5f 63  , $spec)".  do_c
1a10: 61 74 63 68 73 71 6c 5f 74 65 73 74 20 31 30 2e  atchsql_test 10.
1a20: 24 74 6e 20 24 73 71 6c 20 7b 31 20 7b 74 6f 6f  $tn $sql {1 {too
1a30: 20 6d 61 6e 79 20 70 72 65 66 69 78 20 69 6e 64   many prefix ind
1a40: 65 78 65 73 20 28 6d 61 78 20 33 31 29 7d 7d 0a  exes (max 31)}}.
1a50: 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..#------------
1a60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1a90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
1aa0: 65 72 72 6f 72 73 20 69 6e 20 74 68 65 20 64 65  errors in the de
1ab0: 74 61 69 6c 3d 20 6f 70 74 69 6f 6e 2e 0a 23 0a  tail= option..#.
1ac0: 66 6f 72 65 61 63 68 20 7b 74 6e 20 6f 70 74 7d  foreach {tn opt}
1ad0: 20 7b 0a 20 20 31 20 7b 64 65 74 61 69 6c 3d 78   {.  1 {detail=x
1ae0: 7d 20 20 0a 20 20 32 20 7b 64 65 74 61 69 6c 3d  }  .  2 {detail=
1af0: 27 78 27 7d 0a 20 20 33 20 7b 64 65 74 61 69 6c  'x'}.  3 {detail
1b00: 3d 27 24 27 7d 0a 20 20 34 20 7b 64 65 74 61 69  ='$'}.  4 {detai
1b10: 6c 3d 27 31 2c 32 2c 27 7d 0a 20 20 35 20 7b 64  l='1,2,'}.  5 {d
1b20: 65 74 61 69 6c 3d 27 2c 31 27 7d 0a 20 20 36 20  etail=',1'}.  6 
1b30: 7b 64 65 74 61 69 6c 3d 27 27 7d 0a 7d 20 7b 0a  {detail=''}.} {.
1b40: 20 20 73 65 74 20 72 65 73 20 5b 6c 69 73 74 20    set res [list 
1b50: 31 20 7b 6d 61 6c 66 6f 72 6d 65 64 20 64 65 74  1 {malformed det
1b60: 61 69 6c 3d 2e 2e 2e 20 64 69 72 65 63 74 69 76  ail=... directiv
1b70: 65 7d 5d 0a 20 20 64 6f 5f 63 61 74 63 68 73 71  e}].  do_catchsq
1b80: 6c 5f 74 65 73 74 20 31 31 2e 24 74 6e 20 22 43  l_test 11.$tn "C
1b90: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
1ba0: 42 4c 45 20 66 31 20 55 53 49 4e 47 20 66 74 73  BLE f1 USING fts
1bb0: 35 28 78 2c 20 24 6f 70 74 29 22 20 24 72 65 73  5(x, $opt)" $res
1bc0: 0a 7d 0a 0a 64 6f 5f 63 61 74 63 68 73 71 6c 5f  .}..do_catchsql_
1bd0: 74 65 73 74 20 31 32 2e 31 20 7b 0a 20 20 49 4e  test 12.1 {.  IN
1be0: 53 45 52 54 20 49 4e 54 4f 20 74 31 28 74 31 2c  SERT INTO t1(t1,
1bf0: 20 72 61 6e 6b 29 20 56 41 4c 55 45 53 28 27 72   rank) VALUES('r
1c00: 61 6e 6b 27 2c 20 4e 55 4c 4c 29 3b 3b 0a 7d 20  ank', NULL);;.} 
1c10: 7b 31 20 7b 53 51 4c 20 6c 6f 67 69 63 20 65 72  {1 {SQL logic er
1c20: 72 6f 72 7d 7d 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d  ror}}..#--------
1c30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1c70: 2d 0a 23 20 65 72 72 6f 72 73 20 69 6e 20 74 68  -.# errors in th
1c80: 65 20 27 75 73 65 72 6d 65 72 67 65 27 20 6f 70  e 'usermerge' op
1c90: 74 69 6f 6e 0a 23 0a 64 6f 5f 65 78 65 63 73 71  tion.#.do_execsq
1ca0: 6c 5f 74 65 73 74 20 31 33 2e 30 20 7b 0a 20 20  l_test 13.0 {.  
1cb0: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54  CREATE VIRTUAL T
1cc0: 41 42 4c 45 20 74 74 20 55 53 49 4e 47 20 66 74  ABLE tt USING ft
1cd0: 73 35 28 74 74 74 29 3b 0a 7d 0a 66 6f 72 65 61  s5(ttt);.}.forea
1ce0: 63 68 20 7b 74 6e 20 76 61 6c 7d 20 7b 0a 20 20  ch {tn val} {.  
1cf0: 31 20 20 20 20 20 2d 31 0a 20 20 32 20 20 20 20  1     -1.  2    
1d00: 20 34 2e 32 0a 20 20 33 20 20 20 20 20 31 37 0a   4.2.  3     17.
1d10: 20 20 34 20 20 20 20 20 31 0a 7d 20 7b 0a 20 20    4     1.} {.  
1d20: 73 65 74 20 73 71 6c 20 22 49 4e 53 45 52 54 20  set sql "INSERT 
1d30: 49 4e 54 4f 20 74 74 28 74 74 2c 20 72 61 6e 6b  INTO tt(tt, rank
1d40: 29 20 56 41 4c 55 45 53 28 27 75 73 65 72 6d 65  ) VALUES('userme
1d50: 72 67 65 27 2c 20 24 76 61 6c 29 22 0a 20 20 64  rge', $val)".  d
1d60: 6f 5f 63 61 74 63 68 73 71 6c 5f 74 65 73 74 20  o_catchsql_test 
1d70: 31 33 2e 24 74 6e 20 24 73 71 6c 20 7b 31 20 7b  13.$tn $sql {1 {
1d80: 53 51 4c 20 6c 6f 67 69 63 20 65 72 72 6f 72 7d  SQL logic error}
1d90: 7d 0a 7d 0a 0a 66 69 6e 69 73 68 5f 74 65 73 74  }.}..finish_test
1da0: 0a                                               .