File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -1071,14 +1071,16 @@ def run_gc
10711071 end
10721072
10731073 it "#affected_rows with multi statements returns the last result's affected_rows" do
1074- @client . set_server_option ( Mysql2 ::Client ::OPTION_MULTI_STATEMENTS_ON )
1075-
1076- @client . query ( "INSERT INTO lastIdTest (blah) VALUES (1234), (5678); UPDATE lastIdTest SET blah=4321 WHERE id=1" )
1077- expect ( @client . affected_rows ) . to eq ( 2 )
1078- expect ( @client . next_result ) . to eq ( true )
1079- expect ( @client . affected_rows ) . to eq ( 1 )
1080- ensure
1081- @client . set_server_option ( Mysql2 ::Client ::OPTION_MULTI_STATEMENTS_OFF )
1074+ begin
1075+ @client . set_server_option ( Mysql2 ::Client ::OPTION_MULTI_STATEMENTS_ON )
1076+
1077+ @client . query ( "INSERT INTO lastIdTest (blah) VALUES (1234), (5678); UPDATE lastIdTest SET blah=4321 WHERE id=1" )
1078+ expect ( @client . affected_rows ) . to eq ( 2 )
1079+ expect ( @client . next_result ) . to eq ( true )
1080+ expect ( @client . affected_rows ) . to eq ( 1 )
1081+ ensure
1082+ @client . set_server_option ( Mysql2 ::Client ::OPTION_MULTI_STATEMENTS_OFF )
1083+ end
10821084 end
10831085
10841086 it "#affected_rows isn't cleared by Statement#close" do
You can’t perform that action at this time.
0 commit comments