OLD | NEW |
1 # 2008 February 12 | 1 # 2008 February 12 |
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 do_test triggerA-2.10 { | 185 do_test triggerA-2.10 { |
186 db eval { | 186 db eval { |
187 DELETE FROM result4; | 187 DELETE FROM result4; |
188 CREATE TRIGGER r5u INSTEAD OF UPDATE ON v5 BEGIN | 188 CREATE TRIGGER r5u INSTEAD OF UPDATE ON v5 BEGIN |
189 INSERT INTO result4(a,b,c,d) VALUES(old.x, old.b, new.x, new.b); | 189 INSERT INTO result4(a,b,c,d) VALUES(old.x, old.b, new.x, new.b); |
190 END; | 190 END; |
191 UPDATE v5 SET b = b+9900000 WHERE x BETWEEN 3 AND 5; | 191 UPDATE v5 SET b = b+9900000 WHERE x BETWEEN 3 AND 5; |
192 SELECT * FROM result4 ORDER BY a; | 192 SELECT * FROM result4 ORDER BY a; |
193 } | 193 } |
194 } {3 305 3 9900305 4 404 4 9900404 5 504 5 9900504} | 194 } {3 305 3 9900305 4 404 4 9900404 5 504 5 9900504} |
| 195 do_test triggerA-2.11 { |
| 196 db eval { |
| 197 DELETE FROM result4; |
| 198 UPDATE v5 SET b = main.v5.b+9900000 WHERE main.v5.x BETWEEN 3 AND 5; |
| 199 SELECT * FROM result4 ORDER BY a; |
| 200 } |
| 201 } {3 305 3 9900305 4 404 4 9900404 5 504 5 9900504} |
195 | 202 |
196 # Only run the reamining tests if memory debugging is turned on. | 203 # Only run the reamining tests if memory debugging is turned on. |
197 # | 204 # |
198 ifcapable !memdebug { | 205 ifcapable !memdebug { |
199 puts "Skipping triggerA malloc tests: not compiled with -DSQLITE_MEMDEBUG..." | 206 puts "Skipping triggerA malloc tests: not compiled with -DSQLITE_MEMDEBUG..." |
200 finish_test | 207 finish_test |
201 return | 208 return |
202 } | 209 } |
203 source $testdir/malloc_common.tcl | 210 source $testdir/malloc_common.tcl |
204 | 211 |
205 # Save a copy of the current database configuration. | 212 # Save a copy of the current database configuration. |
206 # | 213 # |
207 db close | 214 db close |
208 file delete -force test.db-triggerA | 215 forcedelete test.db-triggerA |
209 file copy test.db test.db-triggerA | 216 copy_file test.db test.db-triggerA |
210 sqlite3 db test.db | 217 sqlite3 db test.db |
211 | 218 |
212 # Run malloc tests on the INSTEAD OF trigger firing. | 219 # Run malloc tests on the INSTEAD OF trigger firing. |
213 # | 220 # |
214 do_malloc_test triggerA-3 -tclprep { | 221 do_malloc_test triggerA-3 -tclprep { |
215 db close | 222 db close |
216 file delete -force test.db test.db-journal | 223 forcedelete test.db test.db-journal |
217 file copy -force test.db-triggerA test.db | 224 forcecopy test.db-triggerA test.db |
218 sqlite3 db test.db | 225 sqlite3 db test.db |
219 sqlite3_extended_result_codes db 1 | 226 sqlite3_extended_result_codes db 1 |
220 db eval {SELECT * FROM v5; -- warm up the cache} | 227 db eval {SELECT * FROM v5; -- warm up the cache} |
221 } -sqlbody { | 228 } -sqlbody { |
222 DELETE FROM v5 WHERE x=5; | 229 DELETE FROM v5 WHERE x=5; |
223 UPDATE v5 SET b=b+9900000 WHERE x BETWEEN 3 AND 5; | 230 UPDATE v5 SET b=b+9900000 WHERE x BETWEEN 3 AND 5; |
224 } | 231 } |
225 | 232 |
226 # Clean up the saved database copy. | 233 # Clean up the saved database copy. |
227 # | 234 # |
228 file delete -force test.db-triggerA | 235 forcedelete test.db-triggerA |
229 | 236 |
230 finish_test | 237 finish_test |
OLD | NEW |