mysql´æ´¢¹ý³Ì ¸³Öµ
IN expireDate VARCHAR(20),IN resType INT
//-----------------------------------------------------------------------------------
BEGIN
DECLARE a,b,icon_id INT;
DECLARE cur_1 CURSOR FOR SELECT id from `tbl_resource` WHERE discriminator="RC_CON" and robot_type=resType and add_date<=expireDate;/*robot_type ´úÌæ×ÊÔ´ÀàÐÍ*/
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET b = 1;
OPEN cur_1;
REPEAT
FETCH cur_1 INTO a;
SELECT smallIcon INTO icon_id from tbl_resource WHERE id=a; /*µÃµ½ËõÂÔͼƬµÄid*/
DELETE from `tbl_resource` WHERE parent_id=a; /*ɾ³ýÕâ¸öcontentËùº¬µÄ×ÊÔ´*/
DELETE from `tbl_visitrecords` WHERE resource_id=a; /*ɾ³ý·ÃÎÊÐÅÏ¢*/
DELETE from `tbl_detailrecord` WHERE resource_id=a; /*ɾ³ÇÏéϸ·ÃÎÊÐÅÏ¢ */
DELETE from `tbl_comment` WHERE resource_id=a; /*ɾ³ÇÏà¹ØÆÀÂÛ*/
DELETE from `tbl_resource` WHERE id=a; /*ɾ³Ç×Ô¼º*/
IF icon_id >0 THEN
DELETE from `tbl_resource` WHERE id=icon_id; /*ɾ³ýͼ±ê*/
/*SELECT "ɾ³ýÁË"+icon_id;*/
END IF;
UNTIL b = 1
END REPEAT;
CLOSE cur_1;
/*SELECT count(id) from `tbl_resource` WHERE discriminator="RC_CON" and robot_type=0 and add_date<=expireDate;*/
END
//Ïà¹ØÓï·¨
if Null is Null then
SELECT 23;
else
SELECT 45;
end IF;
//¸³Öµ
select @cnt := count(1) from tablenmae
ºÍ
select count(1) into @cnt from tablename
ÊÇµÈ¼ÛµÄ ¡£
Ïà¹ØÎĵµ£º
´úÂëÈçÏ£º
1 String command = " cmd /c C:/Program Files/MySQL/MySQL Server 5.0/bin>mysqldump -h localhost -u root -p aijia > E:/aijia.dmp " ;
2 try {
3 Process process& ......
×î½üÓöµ½Ò»¸öÐèÇóÒªÔÚlinuxÏÂÓÃjava µ÷ÓÃmysql¿Í»§¶ËÔ¶³ÌµÇ½mysql·þÎñÆ÷£¬´Ó¿Í»§¶Ë»úÆ÷µ¼Èëmysql½Å±¾£¬´Ómysql·þÎñÆ÷¶Ëµ¼³ö±íÖеÄÊý¾Ý¡£ÒÔÏÂÊÇÓõ½µÄÖ÷Òª·½·¨£º
Java ´úÂë
/**
* µ¼ÈëÊý¾Ý
* @param ½Å±¾µÄµØÖ·ºÍÃû³Æ
* @return ÊÇ·ñ³ ......
10055:ûÓлº´æ¿Õ¼ä¿ÉÀûÓà ·½·¨:²é¿´ÏÂÄãµÄCÅÌ¿Õ¼äÊÇ·ñÒѾÂú,Çå³ýһЩûÓÐÓõÄÎļþ. ¿ÉÒÔÔÚºǫ́µÄ"ÂÛ̳ºËÐÄÉèÖÃ","ºËÐŦÄÜÉèÖÃ"Àï"½ø³ÌÓÅ»¯"¿ªÆô,"GZIP ѹËõÊä³ö"¹Ø±Õ. ²éÕÒÁËÒ»ÏÂ10055£¨Ã»Óлº´æ
˵Ã÷:Èç¹ûÓöµ½Êý¾Ý¿â³ö´íµÄÎÊÌâÐÞ¸ÄÏàÓ¦µÄ´úÂëºóÒ»°ãÒªÖØÆômysql¡£Èç¹ûÓöµ½mysqlµÄÎÊÌâ¿ÉÒÔÏÈÖØÆ ......
Ç°²»¾ÃÍøÉϹ«¿ªÁËÒ»¸öMySQL FuncµÄ©¶´,½²µÄÊÇʹÓÃMySQL´´½¨Ò»¸ö×Ô¶¨ÒåµÄº¯Êý,È»ºóͨ¹ýÕâ¸öº¯ÊýÀ´¹¥»÷·þÎñÆ÷¡£×îÔç¿´µ½Ïà¹ØµÄ±¨µÀÊÇÔÚo-otikÉÏ,µ«Êǹ«²¼µÄÊÇÕë¶Ô UnixϵͳµÄExploit,²¢Çҳɹ¦ÂÊÒ²²»ÊǺܸß.¶ø½üÆÚ,¹úÄÚÓиßÊַųöÕë¶ÔWinϵͳµÄÏà¹ØÎÄÕÂ,ÓÚÊÇÎÒÂíÉÏÕÒÀ´ÓëÅóÓÑһͬÑо¿.
ÆäʵÎÒÃÇÔç¾ÍÄÜÏëµ½.µ±ÎÒÃÇÔÚ¶ÔMSSQL ......
¶ÔÓÚÿ¸öÀàÐÍÓµÓеÄÖµ·¶Î§ÒÔ¼°²¢ÇÒÖ¸¶¨ÈÕÆÚºÎʱ¼äÖµµÄÓÐЧ¸ñʽµÄÃèÊö¼û7.3.6 ÈÕÆÚºÍʱ¼äÀàÐÍ¡£
ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñÁËËùÓмǼ£¬Æädate_colµÄÖµÊÇÔÚ×îºó30ÌìÒÔÄÚ£º
mysql> SELECT something from table
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
DAYOFWEEK(date)
·µ»ØÈÕÆ ......