• 定时事件——调用函数


    函数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

  • 相关阅读:
    c++链表实现学生成绩管理系统(简易版)
    IOS动画讲解
    栈的实现
    Masonry的使用
    二叉树详解-2
    二叉树详解-1
    CoreData的使用-2
    NSPredicate 详解
    CoreData的使用-1
    IOS常用手势用法
  • 原文地址:https://www.cnblogs.com/wudage/p/9121973.html
Copyright © 2020-2023  润新知