OLD | NEW |
1 # 2012 March 06 | 1 # 2012 March 06 |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 do_execsql_test 1.2.$i.1 { INSERT INTO t1(t1) VALUES('merge=1') } | 48 do_execsql_test 1.2.$i.1 { INSERT INTO t1(t1) VALUES('merge=1') } |
49 do_test 1.2.$i.2 { fts3_integrity_check t1 } ok | 49 do_test 1.2.$i.2 { fts3_integrity_check t1 } ok |
50 do_execsql_test 1.2.$i.3 { | 50 do_execsql_test 1.2.$i.3 { |
51 SELECT docid FROM t1 WHERE t1 MATCH 'zero one two three' | 51 SELECT docid FROM t1 WHERE t1 MATCH 'zero one two three' |
52 } {123 132 213 231 312 321} | 52 } {123 132 213 231 312 321} |
53 } | 53 } |
54 | 54 |
55 do_execsql_test 1.3 { | 55 do_execsql_test 1.3 { |
56 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level | 56 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level |
57 } { | 57 } { |
58 0 {0 1 2 3} | |
59 1 {0 1 2 3 4 5 6} | |
60 2 {0 1 2 3} | 58 2 {0 1 2 3} |
61 } | 59 } |
62 | 60 |
63 for {set i 0} {$i<100} {incr i} { | 61 for {set i 0} {$i<100} {incr i} { |
64 do_execsql_test 1.4.$i { INSERT INTO t1(t1) VALUES('merge=1,4') } | 62 do_execsql_test 1.4.$i { INSERT INTO t1(t1) VALUES('merge=1,4') } |
65 do_test 1.4.$i.2 { fts3_integrity_check t1 } ok | 63 do_test 1.4.$i.2 { fts3_integrity_check t1 } ok |
66 do_execsql_test 1.4.$i.3 { | 64 do_execsql_test 1.4.$i.3 { |
67 SELECT docid FROM t1 WHERE t1 MATCH 'zero one two three' | 65 SELECT docid FROM t1 WHERE t1 MATCH 'zero one two three' |
68 } {123 132 213 231 312 321} | 66 } {123 132 213 231 312 321} |
69 } | 67 } |
70 | 68 |
71 do_execsql_test 1.5 { | 69 do_execsql_test 1.5 { |
72 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level | 70 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level |
73 } { | 71 } { |
74 2 {0 1} | |
75 3 0 | 72 3 0 |
76 } | 73 } |
77 | 74 |
78 #------------------------------------------------------------------------- | 75 #------------------------------------------------------------------------- |
79 # Test cases 2.* test that errors in the xxx part of the 'merge=xxx' are | 76 # Test cases 2.* test that errors in the xxx part of the 'merge=xxx' are |
80 # handled correctly. | 77 # handled correctly. |
81 # | 78 # |
82 do_execsql_test 2.0 "CREATE VIRTUAL TABLE t2 USING $mod" | 79 do_execsql_test 2.0 "CREATE VIRTUAL TABLE t2 USING $mod" |
83 | 80 |
84 foreach {tn arg} { | 81 foreach {tn arg} { |
85 1 {merge=abc} | 82 1 {merge=abc} |
86 2 {merge=%%%} | 83 2 {merge=%%%} |
87 3 {merge=,} | 84 3 {merge=,} |
88 4 {merge=5,} | 85 4 {merge=5,} |
89 5 {merge=6,%} | 86 5 {merge=6,%} |
90 6 {merge=6,six} | 87 6 {merge=6,six} |
91 7 {merge=6,1} | 88 7 {merge=6,1} |
92 8 {merge=6,0} | |
93 } { | 89 } { |
94 do_catchsql_test 2.$tn { | 90 do_catchsql_test 2.$tn { |
95 INSERT INTO t2(t2) VALUES($arg); | 91 INSERT INTO t2(t2) VALUES($arg); |
96 } {1 {SQL logic error or missing database}} | 92 } {1 {SQL logic error or missing database}} |
97 } | 93 } |
98 | 94 |
99 #------------------------------------------------------------------------- | 95 #------------------------------------------------------------------------- |
100 # Test cases 3.* | 96 # Test cases 3.* |
101 # | 97 # |
102 do_test 3.0 { | 98 do_test 3.0 { |
103 reset_db | 99 reset_db |
104 execsql { PRAGMA page_size = 512 } | 100 execsql { PRAGMA page_size = 512 } |
105 fts3_build_db_2 -module $mod 30040 | 101 fts3_build_db_2 -module $mod 30040 |
106 } {} | 102 } {} |
107 do_test 3.1 { fts3_integrity_check t2 } {ok} | 103 do_test 3.1 { fts3_integrity_check t2 } {ok} |
108 | 104 |
109 do_execsql_test 3.2 { | 105 do_execsql_test 3.2 { |
110 SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level | 106 SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level |
111 } { | 107 } { |
112 0 {0 1 2 3 4 5 6} | 108 0 {0 1 2 3 4 5 6} |
113 1 {0 1 2 3 4} | 109 1 {0 1 2 3 4} |
114 2 {0 1 2 3 4} | 110 2 {0 1 2 3 4} |
115 3 {0 1 2 3 4 5 6} | 111 3 {0 1 2 3 4 5 6} |
116 } | 112 } |
117 | 113 |
118 do_execsql_test 3.3 { | 114 do_execsql_test 3.3 { |
119 INSERT INTO t2(t2) VALUES('merge=1000000,2'); | 115 INSERT INTO t2(t2) VALUES('merge=1000000,2'); |
120 SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level | 116 SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level |
121 } { | 117 } { |
122 0 0 | |
123 2 0 | |
124 3 0 | |
125 4 0 | 118 4 0 |
126 6 0 | |
127 } | 119 } |
128 | 120 |
129 #------------------------------------------------------------------------- | 121 #------------------------------------------------------------------------- |
130 # Test cases 4.* | 122 # Test cases 4.* |
131 # | 123 # |
132 reset_db | 124 reset_db |
133 do_execsql_test 4.1 " | 125 do_execsql_test 4.1 " |
134 PRAGMA page_size = 512; | 126 PRAGMA page_size = 512; |
135 CREATE VIRTUAL TABLE t4 USING $mod; | 127 CREATE VIRTUAL TABLE t4 USING $mod; |
136 PRAGMA main.page_size; | 128 PRAGMA main.page_size; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 0 {0 1 2 3 4 5 6 7} | 188 0 {0 1 2 3 4 5 6 7} |
197 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} | 189 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} |
198 2 {0 1 2} | 190 2 {0 1 2} |
199 } | 191 } |
200 | 192 |
201 do_execsql_test 5.3 { | 193 do_execsql_test 5.3 { |
202 INSERT INTO t1(t1) VALUES('merge=1,5'); | 194 INSERT INTO t1(t1) VALUES('merge=1,5'); |
203 INSERT INTO t1(t1) VALUES('merge=1,5'); | 195 INSERT INTO t1(t1) VALUES('merge=1,5'); |
204 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; | 196 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; |
205 } { | 197 } { |
206 0 {0 1 2} | |
207 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14} | 198 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14} |
208 2 {0 1 2 3} | 199 2 {0 1 2 3} |
209 } | 200 } |
210 | 201 |
211 do_execsql_test 5.4 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'0105'} | 202 do_execsql_test 5.4 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'010F'} |
212 do_test 5.5 { | 203 do_test 5.5 { |
213 foreach docid [execsql {SELECT docid FROM t1}] { | 204 foreach docid [execsql {SELECT docid FROM t1}] { |
214 execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid} | 205 execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid} |
215 } | 206 } |
216 } {} | 207 } {} |
217 | 208 |
218 do_execsql_test 5.6 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'0105'} | 209 do_execsql_test 5.6 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'010F'} |
219 | 210 |
220 do_execsql_test 5.7 { | 211 do_execsql_test 5.7 { |
221 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; | 212 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; |
222 SELECT quote(value) from t1_stat WHERE rowid=1; | 213 SELECT quote(value) from t1_stat WHERE rowid=1; |
223 } { | 214 } { |
224 0 {0 1 2 3 4 5 6 7 8 9 10} | 215 0 {0 1 2 3 4 5 6 7} |
225 1 {0 1 2 3 4 5 6 7 8 9 10 11 12} | 216 1 {0 1 2 3 4 5 6 7 8 9 10 11 12} |
226 2 {0 1 2 3 4 5 6 7} | 217 2 {0 1 2 3 4 5 6 7} |
227 X'0105' | 218 X'010F' |
228 } | 219 } |
229 | 220 |
230 do_execsql_test 5.8 { | 221 do_execsql_test 5.8 { |
231 INSERT INTO t1(t1) VALUES('merge=1,6'); | 222 INSERT INTO t1(t1) VALUES('merge=1,6'); |
232 INSERT INTO t1(t1) VALUES('merge=1,6'); | 223 INSERT INTO t1(t1) VALUES('merge=1,6'); |
233 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; | 224 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; |
234 SELECT quote(value) from t1_stat WHERE rowid=1; | 225 SELECT quote(value) from t1_stat WHERE rowid=1; |
235 } { | 226 } { |
236 0 {0 1 2 3 4} | |
237 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} | 227 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} |
238 2 {0 1 2 3 4 5 6 7 8} X'0106' | 228 2 {0 1 2 3 4 5 6 7 8} X'010E' |
239 } | 229 } |
240 | 230 |
241 do_test 5.8.1 { fts3_integrity_check t1 } ok | 231 do_test 5.8.1 { fts3_integrity_check t1 } ok |
242 | 232 |
243 do_test 5.9 { | 233 do_test 5.9 { |
244 set L [expr 16*16*7 + 16*3 + 12] | 234 set L [expr 16*16*7 + 16*3 + 12] |
245 foreach docid [execsql { | 235 foreach docid [execsql { |
246 SELECT docid FROM t1 UNION ALL SELECT docid FROM t1 LIMIT $L | 236 SELECT docid FROM t1 UNION ALL SELECT docid FROM t1 LIMIT $L |
247 }] { | 237 }] { |
248 execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid} | 238 execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid} |
249 } | 239 } |
250 } {} | 240 } {} |
251 | 241 |
252 do_execsql_test 5.10 { | 242 do_execsql_test 5.10 { |
253 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; | 243 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; |
254 SELECT quote(value) from t1_stat WHERE rowid=1; | 244 SELECT quote(value) from t1_stat WHERE rowid=1; |
255 } { | 245 } { |
256 0 0 1 {0 1} 2 0 3 0 X'0106' | 246 0 {0 1 2 3 4 5 6 7 8 9 10 11} 1 0 2 0 3 0 X'010E' |
257 } | 247 } |
258 | 248 |
259 do_execsql_test 5.11 { | 249 do_execsql_test 5.11 { |
260 INSERT INTO t1(t1) VALUES('merge=1,6'); | 250 INSERT INTO t1(t1) VALUES('merge=1,6'); |
261 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; | 251 SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; |
262 SELECT quote(value) from t1_stat WHERE rowid=1; | 252 SELECT quote(value) from t1_stat WHERE rowid=1; |
263 } { | 253 } { |
264 0 0 1 {0 1} 2 0 3 0 X'' | 254 1 {0 1} 2 0 3 0 X'010E' |
265 } | 255 } |
266 | 256 |
267 #------------------------------------------------------------------------- | 257 #------------------------------------------------------------------------- |
268 # Test cases 6.* | 258 # Test cases 6.* |
269 # | 259 # |
270 # At one point the following test caused an assert() to fail (because the | 260 # At one point the following test caused an assert() to fail (because the |
271 # second 'merge=1,2' operation below actually "merges" a single input | 261 # second 'merge=1,2' operation below actually "merges" a single input |
272 # segment, which was unexpected). | 262 # segment, which was unexpected). |
273 # | 263 # |
274 do_test 6.1 { | 264 do_test 6.1 { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } {0} | 322 } {0} |
333 do_test 7.5 { | 323 do_test 7.5 { |
334 set x [db total_changes] | 324 set x [db total_changes] |
335 execsql { INSERT INTO t1(t1) VALUES('merge=200,10') } | 325 execsql { INSERT INTO t1(t1) VALUES('merge=200,10') } |
336 expr { ([db total_changes] - $x)>1 } | 326 expr { ([db total_changes] - $x)>1 } |
337 } {0} | 327 } {0} |
338 | 328 |
339 } | 329 } |
340 | 330 |
341 finish_test | 331 finish_test |
OLD | NEW |