| 1 |
drop table if exists t1; |
| 2 |
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; |
| 3 |
connect a,localhost,root,,; |
| 4 |
connect b,localhost,root,,; |
| 5 |
SET GLOBAL log_bin_trust_function_creators = 1; |
| 6 |
create table t1 (col1 integer primary key, col2 integer) engine=innodb; |
| 7 |
insert t1 values (1,100); |
| 8 |
create function f1 () returns integer begin |
| 9 |
declare var1 int; |
| 10 |
select col2 into var1 from t1 where col1=1 for update; |
| 11 |
return var1; |
| 12 |
end| |
| 13 |
start transaction; |
| 14 |
select f1(); |
| 15 |
f1() |
| 16 |
100 |
| 17 |
connection b; |
| 18 |
update t1 set col2=0 where col1=1; |
| 19 |
connection default; |
| 20 |
select * from t1; |
| 21 |
col1 col2 |
| 22 |
1 100 |
| 23 |
connection a; |
| 24 |
rollback; |
| 25 |
connection b; |
| 26 |
rollback; |
| 27 |
connection a; |
| 28 |
disconnect a; |
| 29 |
connection b; |
| 30 |
disconnect b; |
| 31 |
connection default; |
| 32 |
drop table t1; |
| 33 |
drop function f1; |
| 34 |
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; |