START TRANSACTION;
中止5秒...select * from account where userid=1 for update;commit;------------------------
MSSQL实现方案:
WAITFOR DELAY '00:05';MYSQLe 有没有类似的功能呢?

解决方案 »

  1.   

    SLEEP(duration) Sleeps (pauses) for the number of seconds given by the duration argument, then returns 0. If SLEEP() is interrupted, it returns 1. The duration may have a fractional part given in microseconds. sleep(10)
      

  2.   

    sleep(5)  #-- 等待5秒
    select * from account where userid=1 for update; 
    commit;
      

  3.   

    sleep(10);
    select * from account where userid=1 for update;
    commit; 
      

  4.   

    这样不行啊
    begin;
    sleep(5);
    select * from account where userid=1 for update;
    commit;
    出错了。。
    我的版本是 6.0.7-alpha-community MySQL Community Server (GPL)You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep(5)' at line 1
      

  5.   

    if sleep(5)=0 then 
    select * from account where userid=1 for update; 
    end if;