mysql´æ´¢¹ý³ÌÓï·¨
±äÁ¿¶¨Òå:
DECLARE variable_name [,variable_name...] datatype [DEFAULT value];
ÆäÖУ¬datatypeΪmysqlµÄÊý¾ÝÀàÐÍ£¬Èç:INT, FLOAT, DATE, VARCHAR(length)
Àý:
DECLARE l_int INT unsigned default 4000000; DECLARE l_numeric NUMERIC(8,2) DEFAULT 9.95; DECLARE l_date DATE DEFAULT '1999-12-31'; DECLARE l_datetime DATETIME DEFAULT '1999-12-31 23:59:59'; DECLARE l_varchar VARCHAR(255) DEFAULT 'This will not be padded';
±äÁ¿¸³Öµ
SET ±äÁ¿Ãû = ±í´ïʽֵ [,variable_name = expression ...]
²ÎÊý
mysql´æ´¢¹ý³ÌµÄ²ÎÊýÓÃÔÚ´æ´¢¹ý³ÌµÄ¶¨Ò壬¹²ÓÐÈýÖÖ²ÎÊýÀàÐÍ,IN,OUT,INOUT
Create procedure|function([[IN |OUT |INOUT ] ²ÎÊýÃû Êý¾ÝÀàÐÎ...])
IN ÊäÈë²ÎÊý
±íʾ¸Ã²ÎÊýµÄÖµ±ØÐëÔÚµ÷Óô洢¹ý³Ìʱָ¶¨£¬ÔÚ´æ´¢¹ý³ÌÖÐÐ޸ĸòÎÊýµÄÖµ²»Äܱ»·µ»Ø£¬ÎªÄ¬ÈÏÖµ
OUT Êä³ö²ÎÊý
¸ÃÖµ¿ÉÔÚ´æ´¢¹ý³ÌÄÚ²¿±»¸Ä±ä£¬²¢¿É·µ»Ø
INOUT ÊäÈëÊä³ö²ÎÊý
µ÷ÓÃʱָ¶¨£¬²¢Çҿɱ»¸Ä±äºÍ·µ»Ø
IN²ÎÊýÀý×Ó:
´´½¨
mysql> CREATE PROCEDURE sp_demo_in_parameter(IN p_in INT) BEGIN SELECT p_in; /*²éѯÊäÈë²ÎÊý*/*/ SET p_in=2; /*ÐÞ¸Ä*/ select p_in;/*²é¿´Ð޸ĺóµÄÖµ*/ END;
Ö´Ðнá¹û:
mysql> set @p_in=1
mysql> call sp_demo_in_parameter(@p_in)
+------+
| p_in |
+------+
| 1 |
+------+
+------+
| p_in |
+------+
| 2 |
+------+
mysql> select @p_in;
+-------+
| @p_in |
+-------+
| 1 |
+-------+
ÒÔÉÏ¿ÉÒÔ¿´³ö£¬p_inËäÈ»ÔÚ´æ´¢¹ý³ÌÖб»Ð޸쬵«²¢²»Ó°Ïì@p_idµÄÖµ
OUT²ÎÊýÀý×Ó
´´½¨:
mysql> CREATE PROCEDURE sp_demo_out_parameter(OUT p_out INT) BEGIN SELECT p_out;/*²é¿´Êä³ö²ÎÊý*/ SET p_out=2;/*Ð޸IJÎÊýÖµ*/ SELECT p_out;/*¿´¿´Óзñ±ä»¯*/ END;
Ö´Ðнá¹û:
mysql> SET @p_out=1
mysql> CALL sp_demo_out_parameter(@p_out)
+-------+
| p_out |
+-------+
| NULL |
+-------+
/*δ±»¶¨Ò壬·µ»ØNULL*/
+-------+
| p_out |
+-------+
| 2 |
+-------+
mysql> SELECT @p_out;
+-------+
| p_out |
+-------+
| 2 |
+----------+
INOUT²ÎÊýÀý×Ó:
mysql>
Ïà¹ØÎĵµ£º
×öÈí¼þÊý¾Ý¿â±Ø²»¿ÉÉÙ£¬ÎÒÑ¡ÔñÁËMySQL¡£
Ê×Ïȵ½http://dev.mysql.com/downloads/ÏÂÔØºÃMySQL5.1ºÍMySQL GUI TOOLS
ϵ½µçÄÔÉÏ,È»ºó°²×°£¬ÏÈ×°5.1ÔÙ×°gui tools ,һ·ȷ¶¨°É¡£
ŪºÃºó£¬µã¿ªMySQL Query Browser£¬¾Í¿ÉÒÔ²Ù×÷Êý¾Ý¿âÁË¡£
MySQLµÄÇý¶¯³ÌÐòÊÇGUITOOLS°²×°Ä¿Â¼/java/libϵÄmysql-connector-java-5.0.4-bin.ja ......
10055:ûÓлº´æ¿Õ¼ä¿ÉÀûÓà ·½·¨:²é¿´ÏÂÄãµÄCÅ̿ռäÊÇ·ñÒѾÂú,Çå³ýһЩûÓÐÓõÄÎļþ. ¿ÉÒÔÔÚºǫ́µÄ"ÂÛ̳ºËÐÄÉèÖÃ","ºËÐŦÄÜÉèÖÃ"Àï"½ø³ÌÓÅ»¯"¿ªÆô,"GZIP ѹËõÊä³ö"¹Ø±Õ. ²éÕÒÁËÒ»ÏÂ10055£¨Ã»Óлº´æ
˵Ã÷:Èç¹ûÓöµ½Êý¾Ý¿â³ö´íµÄÎÊÌâÐÞ¸ÄÏàÓ¦µÄ´úÂëºóÒ»°ãÒªÖØÆômysql¡£Èç¹ûÓöµ½mysqlµÄÎÊÌâ¿ÉÒÔÏÈÖØÆ ......
http://www.javaeye.com/topic/211951
Õâ¶Îʱ¼äÔÚ¿´¡¶High Performance MySQL¡·£¬¿´µ½´æ´¢ÒýÇæÕâ¸öµØ·½¸Ðµ½ºÜ¶àϸ½Ú±È½ÏİÉú£¬ËùÒÔ×ܽáС¼ÇһЩ
ΪÁËÊÊÓ¦¸÷ÖÖ²»Í¬µÄÔËÐл·¾³£¬MYSQLÌṩÁ˶àÖÖ²»Í¬µÄ´æ´¢ÒýÇæ£¨Storage Engine £©,ÔÚÓ¦ÓóÌÐò¿ª·¢Õâ¸ö²ãÃæÉÏ£¬¿ª·¢Õß¿ÉÒÔ¸ù¾Ý²»Í¬µÄÐèÇóÑ¡ÔñÊʺϵÄStorage Engine ·½°¸£¬¸üΪÁ ......
ÔÎÄÁ´½Ó£ºhttp://hi.baidu.com/171892549/blog/item/14818d0ac616ee34b1351dbd.html
ÔÚÊý¾Ý¿â±íÖУ¬Ê¹ÓÃË÷Òý¿ÉÒÔ´ó´óÌá¸ß²éѯËÙ¶È¡£
¼ÙÈçÎÒÃÇ´´½¨ÁËÒ»¸ö testIndex ±í£º
CREATE TABLE testIndex(i_testID INT NOT NULL,vc_Name VARCHAR(16) NOT NULL);
ÎÒÃÇËæ»úÏòÀïÃæ²åÈëÁË 1000 Ìõ¼Ç¼£¬ÆäÖÐÓÐÒ»Ìõ i_testID vc_Name ......
1. ¶¨Òå
/*
Plugin system variables.
*/
static long sysvar_one_value;
static char *sysvar_two_value;
static MYSQL_SYSVAR_LONG(simple_sysvar_one, sysvar_one_value,
PLUGIN_VAR_RQCMDARG,
"Simple fulltext parser example system variab ......