mysql-Daily fixed-point operation

Source: Internet
Author: User

The most recent project to design a daily fixed-point execution of the script, so in this mark, easy to find

Set time_zone = ' "";
Set GLOBAL Event_scheduler = 1;

--Set the database base database that the event uses or belongs to
Use nitrogenates;

# If a task plan that originally exists for that name is deleted first
Drop event if exists upload_to_sdmp;

# set the delimiter to ' $$ ', MySQL default statement delimiter is '; ', so that the subsequent create-to-end code will be treated as a statement to execute
DELIMITER $$
# Create a scheduled task, set the first execution time to ' 2014-07-30 10:00:00 ' and execute once a day
Create Event Upload_to_sdmp
On schedule every 1 day starts timestamp ' 2017-01-17 07:16:00 '
#on Schedule every 1 SECOND
Do

# Start the task of the project
Begin


--Do something write your scheduled tasks to do
# INSERT Test_group (name,project_id) VALUES ("haha", 1);


# Gets the last execution of the Case_all and copies it to the new ID
#更改时间为当前时间
The ID that corresponds to the #将最后一次执行的 case becomes the new ID.
Insert into Execution (name,project_id,test_suite_id) Select name,project_id,test_suite_id from execution WHERE test_ Suite_id=3 ORDER by Created_time DESC LIMIT 1;
UPDATE Execution SET created_time= (select current_timestamp) WHERE created_time= "0000-00-00 00:00:00";
#UPDATE queue_entry SET execution_id= (select id from execution ORDER by ID DESC LIMIT 1) WHERE execution_id= (SELECT ID fro M execution WHERE test_suite_id=3 ORDER by Created_time DESC LIMIT;
Insert into Queue_entry (test_case_id,project_id) Select test_case_id,project_id from Queue_entry WHERE execution_id= ( Select id from execution WHERE test_suite_id=3 ORDER by Created_time DESC LIMIT;
UPDATE queue_entry SET execution_id= (SELECT ID from execution ORDER by ID DESC LIMIT 1) WHERE execution_id=0;


#获取倒数第二条
#select ID from execution WHERE test_suite_id=3 ORDER by Created_time DESC LIMIT 1, 1;
#最新的 ID
#SELECT ID from execution ORDER by ID DESC LIMIT 1;

--End Scheduled Tasks
End $$

# Set the statement separator back to '; '
DELIMITER;

mysql-Daily fixed-point operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.