zoukankan      html  css  js  c++  java
  • 定时事件——调用函数

    函数config() 内容
    BEGIN
    DECLARE t_error INT DEFAULT 0; -- 事务执行错误标志
    DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1;
        START TRANSACTION;
    -- 断闸命令
    insert into amp_command(dtuId,detectorNum,commandType,sendStatus,update_date,create_date,create_by) select left(machine_id,length(machine_id)-2),right(machine_id,2),1,0,NOW(),NOW(),create_by from amp_device_config where off_type = 1  and off_time <= now();
    update amp_device_config set off_type = 0 where off_type = 1 and off_time <= now() ;
    -- 合闸命令
    insert into amp_command(dtuId,detectorNum,commandType,sendStatus,update_date,create_date,create_by) select left(machine_id,length(machine_id)-2),right(machine_id,2),2,0,NOW(),NOW(),create_by from amp_device_config where on_type = 1  and on_time <= now();
    update amp_device_config set on_type = 0 where on_type = 1 and on_time <= now();

        -- SHOW ERRORS;
    IF t_error = 1 THEN  
    ROLLBACK;  
    ELSE  
    COMMIT;  
    END IF;
    select t_error;
    END

  • 相关阅读:
    strace命令的使用
    部署软件RDMA的步骤
    centos7上安装iptables
    在Linux中的.iso文件的处理方法
    centos7关闭自动锁屏
    SSH配置优化和慢的解决方法
    sort排序和uniq统计命令
    ansible的携带密码访问
    fabric入门
    防火墙设置本机端口转发
  • 原文地址:https://www.cnblogs.com/wudage/p/9121973.html
Copyright © 2011-2022 走看看