bitsCN.com
定时任务
查看event是否开启: show variables like '%sche%';
将事件计划开启: set global event_scheduler=1;
关闭事件任务: alter event e_test ON COMPLETION PRESERVE DISABLE;
开户事件任务: alter event e_test ON COMPLETION PRESERVE ENABLE;
简单实例.
创建表 CREATE TABLE test(endtime DATETIME);
创建存储过程test
CREATE PROCEDURE test ()
BEGIN
update examinfo SET endtime = now() WHERE id = 14;
END;
创建event e_test
CREATE EVENT if not exists e_test
on schedule every 30 second
on completion preserve
do call test();
CREATE EVENT if not exists e_test
on schedule every 1 second
on completion preserve
do insert into aa values (now());
每隔30秒将执行存储过程test,将当前时间更新到examinfo表中id=14的记录的endtime字段中去.
触发器
delimiter //
CREATE TRIGGER trigger_htmlcache BEFORE INSERT ON t_model
FOR EACH ROW BEGIN
if CURDATE()
end if;
END;
//
通过建表->Insert的方式测试.
DELIMITER $$
DROP PROCEDURE IF EXISTS `njfyedepartment`.`sp_ireport` $$
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ireport`(IN qureyType VARCHAR(20),IN daytime VARCHAR(20),IN p_ids VARCHAR(50),IN c_ids VARCHAR(50),IN ct1_ids VARCHAR(50),IN ct2_ids VARCHAR(50),IN ku VARCHAR(50),IN ireport_chart varchar(50))
BEGIN
DECLARE i INT DEFAULT 1;
IF qureyType = 'insert' OR qureyType = 'INSERT' THEN
INSERT INTO ireport
(pid,cid,ct1id,ct2id,creatTime,crawlerNumber,WEEK)
SELECT province AS pid,
cityid AS cid,
category1id AS ct1id,
category2id AS ct2id,
(CURRENT_DATE) AS creatTime,COUNT(*) AS crawlerNumber,
(FLOOR(DAYOFMONTH(CURRENT_DATE)/8)+1) AS WEEK
FROM t_model t
WHERE TIME > (CURRENT_DATE-1) AND TIME AND province IS NOT NULL
AND cityid IS NOT NULL
GROUP BY province,cityid,category1id,category2id;
END IF;
IF qureyType = 'month' OR qureyType = 'MONTH' THEN
IF EXISTS(SELECT * FROM information_schema.`TABLES` T WHERE TABLE_NAME = 'tmp_result' AND TABLE_SCHEMA = ku) THEN
DROP TABLE tmp_result;
END IF;
CREATE TABLE tmp_result
(pid VARCHAR(50),pName VARCHAR(50),cid VARCHAR(50),cName VARCHAR(50),ct1id VARCHAR(50),ct1Name VARCHAR(50),
ct2id VARCHAR(50),ct2Name VARCHAR(50),month1 INTEGER,month2 INTEGER,month3 INTEGER,month4 INTEGER,month5 INTEGER,
month6 INTEGER,month7 INTEGER,month8 INTEGER,month9 INTEGER,month10 INTEGER,month11 INTEGER,month12 INTEGER,heji INTEGER);
lable_exit: BEGIN
SET @SqlCmd = ' INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name)
SELECT pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name FROM
(SELECT ia.pid,a.name AS pname,ia.cid,b.name AS cname,ia.ct1id,c.name AS ct1name,ia.ct2id,d.name AS ct2name
FROM ireport ia
LEFT JOIN province a ON ia.pid=a.id
LEFT JOIN city b ON ia.cid=b.id
LEFT JOIN t_category1 c ON ia.ct1id=c.id
LEFT JOIN t_category2 d ON ia.ct2id=d.id
WHERE YEAR(ia.creatTime)=YEAR(?) ';
IF p_ids IS NOT NULL AND p_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.pid in (');
SET @SqlCmd = CONCAT(@SqlCmd, p_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
IF c_ids IS NOT NULL AND c_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.cid in (');
SET @SqlCmd = CONCAT(@SqlCmd, c_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
IF ct1_ids IS NOT NULL AND ct1_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct1id in (');
SET @SqlCmd = CONCAT(@SqlCmd, ct1_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
IF ct2_ids IS NOT NULL AND ct2_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct2id in (');
SET @SqlCmd = CONCAT(@SqlCmd, ct2_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
SET @SqlCmd = CONCAT(@SqlCmd , ') AS ir GROUP BY pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name;');
PREPARE stmt1 FROM @SqlCmd;
SET @a = daytime;
EXECUTE stmt1 USING @a;
DEALLOCATE PREPARE stmt1;
LEAVE lable_exit;
END lable_exit;
WHILE i lable_exit: BEGIN
SET @SqlCmd = 'UPDATE tmp_result AS a,
(
SELECT pid,cid,ct1id,ct2id,SUM(crawlerNumber) AS crawlerNumber FROM
(SELECT pid,cid,ct1id,ct2id,crawlerNumber FROM ireport WHERE MONTH(creatTime)=? AND YEAR(creatTime)=YEAR(?)) AS ir
GROUP BY pid,cid,ct1id,ct2id
) AS b
SET a.month';
SET @SqlCmd = CONCAT(@SqlCmd , i);
SET @SqlCmd = CONCAT(@SqlCmd , '=b.crawlerNumber ');
SET @SqlCmd = CONCAT(@SqlCmd , 'WHERE a.pid=b.pid AND a.cid=b.cid AND a.ct1id=b.ct1id AND a.ct2id=b.ct2id; ');
PREPARE stmt1 FROM @SqlCmd;
SET @a = i;
SET @b = daytime;
EXECUTE stmt1 USING @a,@b;
DEALLOCATE PREPARE stmt1;
LEAVE lable_exit;
END lable_exit;
lable_exit: BEGIN
SET @SqlCmd = 'UPDATE tmp_result SET month';
SET @SqlCmd = CONCAT(@SqlCmd , i);
SET @SqlCmd = CONCAT(@SqlCmd , ' = 0 WHERE month');
SET @SqlCmd = CONCAT(@SqlCmd , i);
SET @SqlCmd = CONCAT(@SqlCmd , ' IS NULL');
PREPARE stmt1 FROM @SqlCmd;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
LEAVE lable_exit;
END lable_exit;
SET i = i + 1;
END WHILE;
UPDATE tmp_result SET heji=month1+month2+month3+month4+month5+month6+month7+month8+month9+month10+month11+month12;
INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12,heji)
SELECT '' AS pid,'--' AS pname,'' AS cid,'总合计:' AS cname,'' AS ct1id,'--' AS ct1name,'' AS ct2id,'--' AS ct2name,SUM(month1) AS month1,SUM(month2) AS month2,SUM(month3) AS month3,SUM(month4) AS month4,
SUM(month5) AS month5,SUM(month6) AS month6,SUM(month7) AS month7,SUM(month8) AS month8,SUM(month9) AS month9,SUM(month10) AS month10,SUM(month11) AS month11,SUM(month12) AS month12,SUM(heji) AS heji
FROM tmp_result;
IF ireport_chart = 'report' OR ireport_chart = 'REPORT' THEN
SELECT pid,pName,cid,cName,ct1id,ct1Name,ct2id,ct2Name,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12,heji FROM tmp_result;
END IF;
IF ireport_chart = 'chart' OR ireport_chart = 'CHART' THEN
SELECT '' AS pid,pName,'' AS cid,'' AS cName,'' AS ct1id,'' AS ct1Name,'' AS ct2id,'' AS ct2Name,SUM(month1) as month1,SUM(month2) as month2,SUM(month3) as month3,SUM(month4) as month4,
SUM(month5) as month5,SUM(month6) as month6,SUM(month7) as month7,SUM(month8) as month8,SUM(month9) as month9,SUM(month10) as month10,SUM(month11) as month11,SUM(month12) as month12,'' AS heji
FROM (SELECT pid,pName,cid,cName,ct1id,ct1Name,ct2id,ct2Name,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12 FROM tmp_result WHERE pname '--') AS ir
GROUP BY pid;
END IF;
END IF;
IF qureyType = 'week' OR qureyType = 'WEEK' THEN
IF EXISTS(SELECT * FROM information_schema.`TABLES` T WHERE TABLE_NAME = 'tmp_result' AND TABLE_SCHEMA = ku) THEN
DROP TABLE tmp_result;
END IF;
CREATE TABLE tmp_result
(pid VARCHAR(50),pName VARCHAR(50),cid VARCHAR(50),cName VARCHAR(50),ct1id VARCHAR(50),ct1Name VARCHAR(50),ct2id VARCHAR(50),ct2Name VARCHAR(50),week1 INTEGER,week2 INTEGER,week3 INTEGER,week4 INTEGER,heji INTEGER);
lable_exit: BEGIN
SET @SqlCmd = ' INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name)
SELECT pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name FROM
(SELECT ia.pid,a.name AS pname,ia.cid,b.name AS cname,ia.ct1id,c.name AS ct1name,ia.ct2id,d.name AS ct2name
FROM ireport ia
LEFT JOIN province a ON ia.pid=a.id
LEFT JOIN city b ON ia.cid=b.id
LEFT JOIN t_category1 c ON ia.ct1id=c.id
LEFT JOIN t_category2 d ON ia.ct2id=d.id
WHERE YEAR(ia.creatTime)=YEAR(?) And MONTH(ia.creatTime)=MONTH(?) ';
IF p_ids IS NOT NULL AND p_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.pid in (');
SET @SqlCmd = CONCAT(@SqlCmd, p_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
IF c_ids IS NOT NULL AND c_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.cid in (');
SET @SqlCmd = CONCAT(@SqlCmd, c_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
IF ct1_ids IS NOT NULL AND ct1_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct1id in (');
SET @SqlCmd = CONCAT(@SqlCmd, ct1_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
IF ct2_ids IS NOT NULL AND ct2_ids '' THEN
SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct2id in (');
SET @SqlCmd = CONCAT(@SqlCmd, ct2_ids);
SET @SqlCmd = CONCAT(@SqlCmd, ')');
END IF;
SET @SqlCmd = CONCAT(@SqlCmd , ') AS ir GROUP BY pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name;');
PREPARE stmt1 FROM @SqlCmd;
SET @a = daytime;
EXECUTE stmt1 USING @a,@a;
DEALLOCATE PREPARE stmt1;
LEAVE lable_exit;
END lable_exit;
WHILE i lable_exit: BEGIN
SET @SqlCmd = 'UPDATE tmp_result AS a,
(
SELECT pid,cid,ct1id,ct2id,SUM(crawlerNumber) AS crawlerNumber FROM
(SELECT pid,cid,ct1id,ct2id,crawlerNumber FROM ireport WHERE WEEK=? AND MONTH(creatTime)=MONTH(?)) AS ir
GROUP BY pid,cid,ct1id,ct2id
) AS b
SET a.week';
SET @SqlCmd = CONCAT(@SqlCmd , i);
SET @SqlCmd = CONCAT(@SqlCmd , '=b.crawlerNumber ');
SET @SqlCmd = CONCAT(@SqlCmd , 'WHERE a.pid=b.pid AND a.cid=b.cid AND a.ct1id=b.ct1id AND a.ct2id=b.ct2id; ');
PREPARE stmt1 FROM @SqlCmd;
SET @a = i;
SET @b = daytime;
EXECUTE stmt1 USING @a,@b;
DEALLOCATE PREPARE stmt1;
LEAVE lable_exit;
END lable_exit;
lable_exit: BEGIN
SET @SqlCmd = 'UPDATE tmp_result SET week';
SET @SqlCmd = CONCAT(@SqlCmd , i);
SET @SqlCmd = CONCAT(@SqlCmd , ' = 0 WHERE week');
SET @SqlCmd = CONCAT(@SqlCmd , i);
SET @SqlCmd = CONCAT(@SqlCmd , ' IS NULL');
PREPARE stmt1 FROM @SqlCmd;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
LEAVE lable_exit;
END lable_exit;
SET i = i + 1;
END WHILE;
UPDATE tmp_result SET heji=week1+week2+week3+week4;
INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name,week1,week2,week3,week4,heji)
SELECT '' AS pid,'--' AS pname,'' AS cid,'总合计:' AS cname,'' AS ct1id,'--' AS ct1name,'' AS ct2id,'--' AS ct2name, SUM(week1) AS week1,SUM(week2) AS week2,SUM(week3) AS week3,SUM(week4) AS week4,SUM(heji) AS heji
FROM tmp_result;
IF ireport_chart = 'report' OR ireport_chart = 'REPORT' THEN
SELECT pid,pName,cid,cName,ct1id,ct1Name,ct2id,ct2Name,week1,week2,week3,week4,heji FROM tmp_result;
END IF;
IF ireport_chart = 'chart' OR ireport_chart = 'CHART' THEN
SELECT '' as pid,pName,'' as cid,'' as cName,'' as ct1id,'' as ct1Name,'' as ct2id,'' as ct2Name,SUM(week1) AS week1,SUM(week2) AS week2,SUM(week3) AS week3,SUM(week4) AS week4,'' as heji
FROM (SELECT pid,cid,pname,cname,week1,week2,week3,week4 FROM tmp_result WHERE pname '--') AS ir
GROUP BY pid;
END IF;
END IF;
END $$
DELIMITER ;
作者“李丽芬的博客”

恐怖走廊是模拟山羊3之中的一个任务,这个任务要怎么样才能够去完成呢,掌握到详细的过关方式和对应的流程,能够完成这个任务的相应挑战,下面就为大家带来模拟山羊3恐怖走廊攻略,了解相关的信息。模拟山羊3恐怖走廊攻略1、首先需要玩家前往地图左上角的寂静岭处。2、在这里可以看到一个屋顶上写着RESTSTOP的房子,玩家需要操作山羊进入这个房子。3、进入房间之后,我们首先向前直走,随后向右转,在这里尽头有一扇门,我们直接从这里进去。4、进入之后同样是先向前走随后右转,在这里走到门前门会关上,我们需要回头找到

要自动化任务和管理多个系统,任务计划软件是您武器库中的宝贵工具,尤其是对于系统管理员而言。Windows任务计划程序完美地完成了这项工作,但最近许多人报告说操作员拒绝了请求错误。该问题存在于操作系统的所有迭代中,即使已经广泛报告和涵盖,也没有有效的解决方案。继续阅读以找到真正对其他人有用的内容!操作员或管理员拒绝了任务计划程序0x800710e0中的请求是什么?任务计划程序允许在没有用户输入的情况下自动执行各种任务和应用程序。您可以使用它来安排和组织特定应用程序、配置自动通知、帮助传递消息等。它

模拟山羊3是有着经典模拟玩法的游戏,可让玩家充分体验到休闲动作类操作模拟的乐趣,游戏中还拥有很多特色任务的精彩,其中模拟山羊3帝陵任务是需要玩家找寻到钟塔上的三个钟并操作的,一些玩家还不清楚要怎么弄,下面带来模拟山羊3帝陵任务攻略流程分享!模拟山羊3帝陵任务攻略流程按照顺序敲击钟即可。详细步骤拓展1、首先玩家需要打开地图去到雾丘公墓。2、然后上到钟楼上,里面会有着三个钟。3、接着按照从大到小的顺序,按照222312312熟悉怒敲击。4、完成敲击后即可完成任务,并打开大门获得光剑。

营救史蒂夫是模拟山羊3中的一个独特任务,具体需要怎么做才能够完成呢,这个任务比较简单,但是我们需要注意不要理解错意思,下面就为大家带来模拟山羊3营救史蒂夫任务攻略,能够更好的完成相关的任务。模拟山羊3营救史蒂夫任务攻略1、首先来到地图中右下角的温泉。2、在来到温泉边上之后就可以触发营救史蒂夫的这个任务。3、注意在温泉里有个男人,虽然他也叫史蒂夫,但是并不是本次任务的目标。4、在这个温泉里找到一条叫史蒂夫的鱼,并且将其带上岸,即可完成这个任务。

抖音作为当下最受欢迎的社交媒体平台之一,吸引了大量用户参与其中。在抖音上,有很多粉丝团任务可供用户完成,从而获得一定的奖励和福利。那么,抖音粉丝团任务在哪里可以找到呢?一、抖音粉丝团任务在哪里看?为了找到抖音粉丝团任务,你需要访问抖音的个人主页。在主页上,你会看到一个名为“粉丝团”的选项。点击这个选项,你就可以浏览你所加入的粉丝团和相关任务。在粉丝团任务栏目中,你会看到各种不同类型的任务,如点赞、评论、分享、转发等。每个任务都有对应的奖励和要求,一般来说,完成任务后会获得一定数量的金币或者经验值

如何在Windows11和Windows10中暂停任务管理器进程更新按CTRL+窗口键+删除打开任务管理器。默认情况下,任务管理器将打开“进程”窗口。正如您在此处看到的,所有应用程序都在无休止地移动,当您想要选择它们时,可能很难将它们指向下方。因此,按CTRL并按住它,这将暂停任务管理器。您仍然可以选择应用程序,甚至可以向下滚动,但您必须始终按住CTRL按钮。

实现任务通用是深度学习基础模型研究的核心问题,也是近期大模型方向的主要关注点之一。然而,在时间序列领域,各类分析任务的差别较大,既有需要细粒度建模的预测任务,也有需要提取高层语义信息的分类任务。如何构建统一的深度基础模型高效地完成各类时序分析任务,此前尚未有成型方案。为此,来自清华大学软件学院的团队围绕时序变化建模这一基本问题展开研究,提出了任务通用的时序基础模型TimesNet,论文被ICLR 2023接收。作者列表:吴海旭*,胡腾戈*,刘雍*,周航,王建民,龙明盛链接:https://ope

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version
