• MySQL 缓存表建触发器


    BEGIN
    		IF (select new.name NOT REGEXP (SELECT IF((select filterword from t_crawl_configuration where id=new.crawl_id)='','fzuir',(select filterword from t_crawl_configuration where id=new.crawl_id))) and new.price>=(select lowest_price from t_crawl_configuration where id=new.crawl_id))  then
    						insert into t_product_data(crawl_url_id,pid,name,price,crawl_id) values(new.crawl_url_id,new.pid,new.name,new.price,new.crawl_id);
    		end if;
    END

    插入表格过程中建立触发器

    -- 触发器 同时插入有用数据
    DROP TRIGGER IF EXISTS t_afterinsert_on_t_product;
    CREATE TRIGGER t_afterinsert_on_t_product
    AFTER INSERT ON t_product
    FOR EACH ROW
    BEGIN
    IF (select new.name NOT REGEXP (SELECT IF((select filterword from t_crawl_configuration where id=new.crawl_id)='','fzuir',(select filterword from t_crawl_configuration where id=new.crawl_id))) and new.price>=(select lowest_price from t_crawl_configuration where id=new.crawl_id)) then
    insert into t_product_data(crawl_url_id,pid,name,price,crawl_id) values(new.crawl_url_id,new.pid,new.name,new.price,new.crawl_id);
    end if;
    END;


    -- 触发器 同时插入有用数据
    DROP TRIGGER IF EXISTS t_afterinsert_on_t_product_test;
    CREATE TRIGGER t_afterinsert_on_t_product_test
    AFTER INSERT ON t_product_test
    FOR EACH ROW
    BEGIN
    IF (select new.name NOT REGEXP (SELECT IF((select filterword from t_crawl_configuration where id=new.crawl_id)='','fzuir',(select filterword from t_crawl_configuration where id=new.crawl_id))) and new.price>=(select lowest_price from t_crawl_configuration where id=new.crawl_id)) then
    insert into t_product_data(crawl_url_id,pid,name,price,crawl_id) values(new.crawl_url_id,new.pid,new.name,new.price,new.crawl_id);
    end if;
    END;

  • 相关阅读:
    import和from .xxx import *的一点重要区别
    django 的时区设置
    更新项目,uwsgi重新加载和日志文件
    jQuery将json字符串显示在页面上
    远程访问rhel7的oracle中的问题
    ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务 的解决方法
    rhel7使用centos7yum组件
    spring AOP
    public protected default private权限修饰符理解
    用idea创建web项目
  • 原文地址:https://www.cnblogs.com/zeze/p/6296626.html
Copyright © 2020-2023  润新知