| OLD | NEW |
| 1 # The author disclaims copyright to this source code. In place of | 1 # The author disclaims copyright to this source code. In place of |
| 2 # a legal notice, here is a blessing: | 2 # a legal notice, here is a blessing: |
| 3 # | 3 # |
| 4 # May you do good and not evil. | 4 # May you do good and not evil. |
| 5 # May you find forgiveness for yourself and forgive others. | 5 # May you find forgiveness for yourself and forgive others. |
| 6 # May you share freely, never taking more than you give. | 6 # May you share freely, never taking more than you give. |
| 7 # | 7 # |
| 8 #*********************************************************************** | 8 #*********************************************************************** |
| 9 # | 9 # |
| 10 # This file tests the triggers of views. | 10 # This file tests the triggers of views. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 db close | 123 db close |
| 124 sqlite3 db test.db | 124 sqlite3 db test.db |
| 125 execsql { | 125 execsql { |
| 126 update test set b=99 where id=7; | 126 update test set b=99 where id=7; |
| 127 select * from test2; | 127 select * from test2; |
| 128 } | 128 } |
| 129 } {7 99} | 129 } {7 99} |
| 130 | 130 |
| 131 do_test trigger4-4.1 { | 131 do_test trigger4-4.1 { |
| 132 db close | 132 db close |
| 133 file delete -force trigtest.db | 133 forcedelete trigtest.db |
| 134 file delete -force trigtest.db-journal | 134 forcedelete trigtest.db-journal |
| 135 sqlite3 db trigtest.db | 135 sqlite3 db trigtest.db |
| 136 catchsql {drop table tbl; drop view vw} | 136 catchsql {drop table tbl; drop view vw} |
| 137 execsql { | 137 execsql { |
| 138 create table tbl(a integer primary key, b integer); | 138 create table tbl(a integer primary key, b integer); |
| 139 create view vw as select * from tbl; | 139 create view vw as select * from tbl; |
| 140 create trigger t_del_tbl instead of delete on vw for each row begin | 140 create trigger t_del_tbl instead of delete on vw for each row begin |
| 141 delete from tbl where a = old.a; | 141 delete from tbl where a = old.a; |
| 142 end; | 142 end; |
| 143 create trigger t_upd_tbl instead of update on vw for each row begin | 143 create trigger t_upd_tbl instead of update on vw for each row begin |
| 144 update tbl set a=new.a, b=new.b where a = old.a; | 144 update tbl set a=new.a, b=new.b where a = old.a; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 #test update of view | 188 #test update of view |
| 189 do_test trigger4-7.1 { | 189 do_test trigger4-7.1 { |
| 190 catchsql {update vw set b=b+1000 where a>101 and a<2000} | 190 catchsql {update vw set b=b+1000 where a>101 and a<2000} |
| 191 } {0 {}} | 191 } {0 {}} |
| 192 do_test trigger4-7.2 { | 192 do_test trigger4-7.2 { |
| 193 execsql {select a, b from vw where a<=102 or a>=227 order by a} | 193 execsql {select a, b from vw where a<=102 or a>=227 order by a} |
| 194 } {101 1001 102 2002 227 2127 228 2128} | 194 } {101 1001 102 2002 227 2127 228 2128} |
| 195 | 195 |
| 196 integrity_check trigger4-99.9 | 196 integrity_check trigger4-99.9 |
| 197 db close | 197 db close |
| 198 file delete -force trigtest.db trigtest.db-journal | 198 forcedelete trigtest.db trigtest.db-journal |
| 199 | 199 |
| 200 finish_test | 200 finish_test |
| OLD | NEW |