You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
637 B

  1. drop table if exists t1;
  2. SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
  3. SET GLOBAL log_bin_trust_function_creators = 1;
  4. create table t1 (col1 integer primary key, col2 integer) engine=innodb;
  5. insert t1 values (1,100);
  6. create function f1 () returns integer begin
  7. declare var1 int;
  8. select col2 into var1 from t1 where col1=1 for update;
  9. return var1;
  10. end|
  11. start transaction;
  12. select f1();
  13. f1()
  14. 100
  15. update t1 set col2=0 where col1=1;
  16. select * from t1;
  17. col1 col2
  18. 1 100
  19. rollback;
  20. rollback;
  21. drop table t1;
  22. drop function f1;
  23. SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;