drop table footest drop table bartest drop sequence footest_seq create sequence footest_seq create table footest (asdf integer unique) create table bartest (asdf varchar(10) unique) delete from footest } incr count } if { $count != 1 } { report_error "db_transaction did not continue processing with db_continue_transaction present." } set count 0 db_dml db_api_acceptance_test_delete_footest "delete from footest" db_transaction { db_dml db_api_acceptance_test_insert_into_footest "insert into footest values (0)" error "db_transaction error" } on_error { db_continue_transaction } if [db_string db_api_acceptance_test_select_from_footest "select asdf from footest" -default 1] { report_error "db_transaction did not commit with db_continue_transaction present." } db_dml db_api_acceptance_test_delete_from_footest "delete from footest" set count 0 db_transaction { db_transaction { db_abort_transaction } on_error { incr count } report_error "db_transaction running code after abort" } on_error { incr count } if { $count != 2 } { report_error "db_transaction did not propagate error with on_error block present" } db_dml db_api_acceptance_test_delete_from_footest_again "delete from footest" set count 0 db_transaction { db_dml test "nonsense" } on_error { incr count } if { $count != 1 } { report_error "db_transaction did not execute on_error block." } proc ::replace_the_foo { col } { db_transaction { db_dml test "delete from footest" db_dml test "insert into footest values (:col)" } } proc ::print_the_foo {} { return [db_string db_api_acceptance_test_print_food_test "select asdf from footest" -default 0] } replace_the_foo 8 if { [string compare "8" [print_the_foo]] } { report_error "db_transaction did not succeed."} db_transaction { replace_the_foo 14 if { [string compare "14" [print_the_foo]] } { report_error "db_transaction did not succeed 2."} db_abort_transaction } on_error { } if { [string compare "8" [print_the_foo]] } { report_error "db_transaction did not succeed 3."} set count 0 db_dml db_api_acceptance_test_delete_from_footest_once_again "delete from footest" db_transaction { db_dml db_api_acceptance_test_insert_into_footest_val_1 {insert into footest values(1)} incr count nonsense db_dml db_api_acceptance_test_insert_into_footes_val_2 {insert into footest values(2)} incr count } on_error { } if { $count != 1 || [string compare [db_string test "select asdf from footest" -default 0] 0]} { report_error "db_transaction did not succeed: $count, [db_string test "select asdf from footest" -default 0]" } db_transaction { db_dml db_api_acceptance_test_insert_into_footest_again_with_val_1 {insert into footest values(1)} db_transaction { db_dml db_api_acceptance_test_insert_into_footest_again_with_val_2 delete from footest insert into footest values (0) select asdf from footest delete from footest on_error delete from footest nonsense nonsense nonsense select asdf from footest delete from footest insert into footest values(1) insert into footest values(2) select asdf from footest select asdf from footest insert into footest values(1) insert into footest values(2) on_error insert into footest values(3) select asdf from footest delete from footest insert into footest values (4) insert into footest values (4) insert into footest values (1) insert into footest values (2) select * from footest insert into footest values (1) insert into footest values (2) select * from footest insert into footest values (1) insert into footest values (2) insert into footest values (2) $correct_p == "0" select * from footest insert into footest values(1) insert into footest values(2) insert into footest values(3) delete from footest delete from footest on_error insert into footest values(1) insert into footest values(2) insert into footest values(3) select asdf from footest select * from footest where asdf = 0 select * from footest select asdf as i from footest where asdf < :asdf select asdf as i from footest where asdf < :asdf select asdf as i from footest where asdf > :asdf select asdf from footest select asdf from footest on_error insert into footest values(1) insert into footest values(2) insert into footest values(3) insert into footest values(1) insert into footest values(2) insert into footest values(3) select asdf from footest where asdf = :asdf select 2 as jkl, asdf from footest where asdf = 1 select 2 as jkl, asdf from footest where asdf = :asdf select 2 as jkl, asdf from footest where asdf = :asdf select 2 as jkl, asdf from footest where asdf = :asdf insert into footest values(1) insert into footest values(2) insert into footest values(3) insert into footest values(1) insert into footest values(2) insert into footest values(3) select * from footest select asdf as jkl from footest delete from footest insert into footest values (:asdf) select count(*) from footest where asdf is null delete from bartest insert into bartest values (:asdf) select count(*) from bartest where asdf = 'a' insert into bartest values (:asdf) select count(*) from bartest where asdf is null delete from footest