OLD | NEW |
1 # 2015 Jan 13 | 1 # 2015 Jan 13 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 #------------------------------------------------------------------------- | 38 #------------------------------------------------------------------------- |
39 # Syntax errors in the prefix= option. | 39 # Syntax errors in the prefix= option. |
40 # | 40 # |
41 foreach {tn opt} { | 41 foreach {tn opt} { |
42 1 {prefix=x} | 42 1 {prefix=x} |
43 2 {prefix='x'} | 43 2 {prefix='x'} |
44 3 {prefix='$'} | 44 3 {prefix='$'} |
45 4 {prefix='1,2,'} | 45 4 {prefix='1,2,'} |
46 5 {prefix=',1'} | 46 5 {prefix=',1'} |
| 47 6 {prefix='1,2,3...'} |
| 48 7 {prefix='1,2,3xyz'} |
47 } { | 49 } { |
48 set res [list 1 {malformed prefix=... directive}] | 50 set res [list 1 {malformed prefix=... directive}] |
49 do_catchsql_test 2.$tn "CREATE VIRTUAL TABLE f1 USING fts5(x, $opt)" $res | 51 do_catchsql_test 2.$tn "CREATE VIRTUAL TABLE f1 USING fts5(x, $opt)" $res |
50 } | 52 } |
51 | 53 |
52 #------------------------------------------------------------------------- | 54 #------------------------------------------------------------------------- |
53 # Syntax errors in the 'rank' option. | 55 # Syntax errors in the 'rank' option. |
54 # | 56 # |
55 foreach {tn val} { | 57 foreach {tn val} { |
56 1 "f1(xyz)" | 58 1 "f1(xyz)" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 do_catchsql_test 8.1 { | 154 do_catchsql_test 8.1 { |
153 CREATE VIRTUAL TABLE abc USING fts5(a, "nosuchoption"=123); | 155 CREATE VIRTUAL TABLE abc USING fts5(a, "nosuchoption"=123); |
154 } {1 {parse error in ""nosuchoption"=123"}} | 156 } {1 {parse error in ""nosuchoption"=123"}} |
155 | 157 |
156 #------------------------------------------------------------------------- | 158 #------------------------------------------------------------------------- |
157 # Errors in: | 159 # Errors in: |
158 # | 160 # |
159 # 9.1.* 'pgsz' options. | 161 # 9.1.* 'pgsz' options. |
160 # 9.2.* 'automerge' options. | 162 # 9.2.* 'automerge' options. |
161 # 9.3.* 'crisismerge' options. | 163 # 9.3.* 'crisismerge' options. |
| 164 # 9.4.* a non-existant option. |
| 165 # 9.5.* 'hashsize' options. |
162 # | 166 # |
163 do_execsql_test 9.0 { | 167 do_execsql_test 9.0 { |
164 CREATE VIRTUAL TABLE abc USING fts5(a, b); | 168 CREATE VIRTUAL TABLE abc USING fts5(a, b); |
165 } {} | 169 } {} |
166 do_catchsql_test 9.1.1 { | 170 do_catchsql_test 9.1.1 { |
167 INSERT INTO abc(abc, rank) VALUES('pgsz', -5); | 171 INSERT INTO abc(abc, rank) VALUES('pgsz', -5); |
168 } {1 {SQL logic error or missing database}} | 172 } {1 {SQL logic error or missing database}} |
169 do_catchsql_test 9.1.2 { | 173 do_catchsql_test 9.1.2 { |
170 INSERT INTO abc(abc, rank) VALUES('pgsz', 50000000); | 174 INSERT INTO abc(abc, rank) VALUES('pgsz', 50000000); |
171 } {1 {SQL logic error or missing database}} | 175 } {1 {SQL logic error or missing database}} |
(...skipping 24 matching lines...) Expand all Loading... |
196 INSERT INTO abc(abc, rank) VALUES('crisismerge', 1); | 200 INSERT INTO abc(abc, rank) VALUES('crisismerge', 1); |
197 } {} | 201 } {} |
198 do_execsql_test 9.3.4 { | 202 do_execsql_test 9.3.4 { |
199 INSERT INTO abc(abc, rank) VALUES('crisismerge', 50000000); | 203 INSERT INTO abc(abc, rank) VALUES('crisismerge', 50000000); |
200 } {} | 204 } {} |
201 | 205 |
202 do_catchsql_test 9.4.1 { | 206 do_catchsql_test 9.4.1 { |
203 INSERT INTO abc(abc, rank) VALUES('nosuchoption', 1); | 207 INSERT INTO abc(abc, rank) VALUES('nosuchoption', 1); |
204 } {1 {SQL logic error or missing database}} | 208 } {1 {SQL logic error or missing database}} |
205 | 209 |
| 210 do_catchsql_test 9.5.1 { |
| 211 INSERT INTO abc(abc, rank) VALUES('hashsize', 'not an integer'); |
| 212 } {1 {SQL logic error or missing database}} |
| 213 do_catchsql_test 9.5.2 { |
| 214 INSERT INTO abc(abc, rank) VALUES('hashsize', -500000); |
| 215 } {1 {SQL logic error or missing database}} |
| 216 do_catchsql_test 9.5.3 { |
| 217 INSERT INTO abc(abc, rank) VALUES('hashsize', 500000); |
| 218 } {0 {}} |
| 219 |
206 #------------------------------------------------------------------------- | 220 #------------------------------------------------------------------------- |
207 # Too many prefix indexes. Maximum allowed is 31. | 221 # Too many prefix indexes. Maximum allowed is 31. |
208 # | 222 # |
209 foreach {tn spec} { | 223 foreach {tn spec} { |
210 1 {prefix="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2
6 27 28 29 30 31 32"} | 224 1 {prefix="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2
6 27 28 29 30 31 32"} |
211 2 {prefix="1 2 3 4", prefix="5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31 32"} | 225 2 {prefix="1 2 3 4", prefix="5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31 32"} |
212 } { | 226 } { |
213 set sql "CREATE VIRTUAL TABLE xyz USING fts5(x, $spec)" | 227 set sql "CREATE VIRTUAL TABLE xyz USING fts5(x, $spec)" |
214 do_catchsql_test 10.$tn $sql {1 {too many prefix indexes (max 31)}} | 228 do_catchsql_test 10.$tn $sql {1 {too many prefix indexes (max 31)}} |
215 } | 229 } |
216 | 230 |
| 231 #------------------------------------------------------------------------- |
| 232 # errors in the detail= option. |
| 233 # |
| 234 foreach {tn opt} { |
| 235 1 {detail=x} |
| 236 2 {detail='x'} |
| 237 3 {detail='$'} |
| 238 4 {detail='1,2,'} |
| 239 5 {detail=',1'} |
| 240 6 {detail=''} |
| 241 } { |
| 242 set res [list 1 {malformed detail=... directive}] |
| 243 do_catchsql_test 11.$tn "CREATE VIRTUAL TABLE f1 USING fts5(x, $opt)" $res |
| 244 } |
| 245 |
| 246 do_catchsql_test 12.1 { |
| 247 INSERT INTO t1(t1, rank) VALUES('rank', NULL);; |
| 248 } {1 {SQL logic error or missing database}} |
| 249 |
| 250 #------------------------------------------------------------------------- |
| 251 # errors in the 'usermerge' option |
| 252 # |
| 253 do_execsql_test 13.0 { |
| 254 CREATE VIRTUAL TABLE tt USING fts5(ttt); |
| 255 } |
| 256 foreach {tn val} { |
| 257 1 -1 |
| 258 2 4.2 |
| 259 3 17 |
| 260 4 1 |
| 261 } { |
| 262 set sql "INSERT INTO tt(tt, rank) VALUES('usermerge', $val)" |
| 263 do_catchsql_test 13.$tn $sql {1 {SQL logic error or missing database}} |
| 264 } |
| 265 |
217 finish_test | 266 finish_test |
218 | 267 |
OLD | NEW |