zoukankan      html  css  js  c++  java
  • 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;

  • 相关阅读:
    【WPF学习】第四十八章 理解WPF动画
    【WPF学习】第四十七章 WriteableBitmap类
    【WPF学习】第四十六章 效果
    【WPF学习】第四十五章 可视化对象
    【WPF学习】第四十四章 图画
    【WPF学习】第四十三章 路径和几何图形
    【WPF学习】第四十二章 透明
    【WPF学习】第四十一章 变换
    【WPF学习】第四十章 画刷
    【WPF学习】第三十九章 理解形状
  • 原文地址:https://www.cnblogs.com/zeze/p/6296626.html
Copyright © 2011-2022 走看看