Debian Codegraph @

ext/fts5/test/fts5limits.test

raw
1 # 2023 May 16
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #*************************************************************************
11 #
12
13 source [file join [file dirname [info script]] fts5_common.tcl]
14 set testprefix fts5limits
15 return_if_no_fts5
16
17
18 do_execsql_test 1.0 {
19 CREATE VIRTUAL TABLE ft USING fts5(x);
20 }
21
22 # Default limit for expression depth is 256
23 #
24 foreach {tn nRepeat op bErr} {
25 1 200 AND 0
26 2 200 NOT 0
27 3 200 OR 0
28
29 4 260 AND 0
30 5 260 NOT 1
31 6 260 OR 0
32 } {
33 set L [string repeat "abc " $nRepeat]
34 set Q [join $L " $op "]
35
36 set res {0 {}}
37 if {$bErr} {
38 set res "1 {fts5 expression tree is too large (maximum depth 256)}"
39 }
40
41 do_catchsql_test 1.$tn {
42 SELECT * FROM ft($Q)
43 } $res
44 }
45
46 finish_test
47