mysqlタイマーの使用(白版)


								mysql      (   )
      :                     ,                   ,
          cv           ,    ,        
                   ,           ,    。   
 		#      event               event      
		show VARIABLES LIKE '%sche%';
		
		#  value   off  0      ,             
		SET GLOBAL event_scheduler = 1;
		
		#     
		create table test
			(
			id int(11) not null auto_increment primary key,
			time datetime not null
			) engine=innodb default charset=utf8;

		#                ,    ,       (                  )
		delimiter //
			drop procedure if exists test_proce//

		#  event        test_proce (        /   。)
		create procedure test_proce()
				begin
		
		# test         (                   ,        )
		insert into test(time) values(now());
			end//
			delimiter ;

		#    test_event(   :        test_proce()    )
		create event test_event
		
		#                
		
		on schedule every 1 second
				on completion preserve disable
				
		#            ,         
		do call test_proce();

		#    test_event                   ,            
		#            test_event          
		alter event test_event on completion preserve enable;

		#    ,   test_event          
		alter event test_event on completion preserve disable;

		#  test     
		select * from test;
	      :
	1.  mysql    event  
	2.              。
	3.      ,          ,                    
	(                )
	4.                  ,                  。