mysql´æ´¢¹ý³ÌÖвÎÊýµÄin,out,inoutÇø±ð
MySQL´æ´¢¹ý³ÌµÄ²ÎÊýÓÃÔÚ´æ´¢¹ý³ÌµÄ¶¨Ò壬¹²ÓÐÈýÖÖ²ÎÊýÀàÐÍ,IN,OUT,INOUT,ÐÎʽÈ磺
CREATE PROCEDURE([[IN |OUT |INOUT ] ²ÎÊýÃû Êý¾ÝÀàÐÎ...])
1¡¢IN ÊäÈë²ÎÊý:±íʾ¸Ã²ÎÊýµÄÖµ±ØÐëÔÚµ÷Óô洢¹ý³Ìʱָ¶¨£¬ÔÚ´æ´¢¹ý³ÌÖÐÐ޸ĸòÎÊýµÄÖµ²»Äܱ»·µ»Ø£¬ÎªÄ¬ÈÏÖµ
2¡¢OUT Êä³ö²ÎÊý:¸ÃÖµ¿ÉÔÚ´æ´¢¹ý³ÌÄÚ²¿±»¸Ä±ä£¬²¢¿É·µ»Ø
3¡¢INOUT ÊäÈëÊä³ö²ÎÊý:µ÷ÓÃʱָ¶¨£¬²¢Çҿɱ»¸Ä±äºÍ·µ»Ø
1¡¢MySQL ´æ´¢¹ý³Ì²ÎÊý£¨in£©
MySQL ´æ´¢¹ý³Ì “in” ²ÎÊý£º¸ú C ÓïÑԵĺ¯Êý²ÎÊýµÄÖµ´«µÝÀàËÆ£¬ MySQL ´æ´¢¹ý³ÌÄÚ²¿¿ÉÄÜ»áÐ޸Ĵ˲ÎÊý£¬µ«¶Ô in ÀàÐͲÎÊýµÄÐ޸ģ¬¶Ôµ÷ÓÃÕߣ¨caller£©À´ËµÊDz»¿É¼ûµÄ£¨not visible£©¡£
drop procedure if exists pr_param_in;
create procedure pr_param_in
(
in id int -- in ÀàÐ굀 MySQL ´æ´¢¹ý³Ì²ÎÊý
)
begin
if (id is not null) then
set id = id + 1;
end if;
select id as id_inner;
end;
set @id = 10;
call pr_param_in(@id);
select @id as id_out;
mysql> call pr_param_in(@id);
+----------+
| id_inner |
+----------+
| 11 |
+----------+
mysql> select @id as id_out;
+--------+
| id_out |
+--------+
| 10 |
+--------+
¿ÉÒÔ¿´µ½£ºÓû§±äÁ¿ @id ´«ÈëֵΪ 10£¬Ö´Ðд洢¹ý³Ìºó£¬ÔÚ¹ý³ÌÄÚ²¿ÖµÎª£º11£¨id_inner£©£¬µ«Íⲿ±äÁ¿ÖµÒÀ¾ÉΪ£º10£¨id_out£©¡£
2¡¢MySQL ´æ´¢¹ý³Ì²ÎÊý£¨out£©
MySQL ´æ´¢¹ý³Ì “out” ²ÎÊý£º´Ó´æ´¢¹ý³ÌÄÚ²¿´«Öµ¸øµ÷ÓÃÕß¡£ÔÚ´æ´¢¹ý³ÌÄÚ²¿£¬¸Ã²ÎÊý³õʼֵΪ null£¬ÎÞÂÛµ÷ÓÃÕßÊÇ·ñ¸ø´æ´¢¹ý³Ì²ÎÊýÉèÖÃÖµ¡£
drop procedure if exists pr_param_out;
create procedure pr_param_out
(
out id int
)
begin
select id as id_inner_1; -- id ³õʼֵΪ null
if (id is not null) then
set id = id + 1;
select id as id_inner_2;
else
select 1 into id;
end if;
select id as id_inner_3;
end;
set
Ïà¹ØÎĵµ£º
To familiarize you with the basics, we will describe the simplest
possible configuration for a functional MySQL Cluster. After this,
you should be able to design your desired setup from the
information provided in the other relevant sections of this
chapter.
......
====================================================
Òý×Ô£ºhttp://blog.sina.com.cn/s/blog_538a9d1901008f9g.html
ʲôÊÇC2¼¶°²È«ÐÔ£¿°²È«ÐԵķÖÀàÊÇÔõÑùµÄ£¿(2008-01-30 17:04:39)
DÀࣺ×îµÍ±£»¤£¬±£Áô¸ø²»ÄÜͨ¹ý¸ü¸ß¼¶±ð¼ì²éµÄϵͳ
C1£º½÷É÷±£»¤£¬ÒªÇóÓлùÓÚÓû§¼¶±ðµÄ¿ØÖÆÀ´±£»¤Êý¾Ý£¬Ö÷Òª·ÀÖ ......
Êý¾Ý¿âÌØµã
££Ê¹ÓÃpartition£¬´æÔÚÉϰٸö·ÖÇø
££½¨±íʱָ¶¨ÁËdata_dirºÍindex_dir£¬Êý¾Ý²»ÊÇ´æ´¢ÔÚĬÈÏλÖ㬶øÊÇÔÚmysqldµÄÊý¾ÝĿ¼ÏÂlinkµ½ÕæÕýµÄÊý¾ÝÎļþ
±¸·Ý»Ö¸´ÒªÇó
££±¸·Ý³öÀ´µÄÊý¾Ý»Ö¸´Ê±Òª»Ö¸´³É²»Í¬µÄ±íÃû
££»Ö¸´³öÀ´µÄÊý¾Ýʵ¼Ê´æ´¢Î»ÖÃÒ²Òª´æ´¢ÔÚÓëÔ±í²»Í¬µÄλÖÃ
ÎÊÌâ
Èç¹ûÖ±½Ómysqldump£sourc ......
ÎÒµÄϵͳÊÇubuntu6.06£¬×î½üÐÂ×°ºÃµÄmysqlÔÚ½øÈëmysql¹¤¾ßʱ£¬×ÜÊÇÓдíÎóÌáʾ:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ʹÓÃÍøÉϽéÉܵķ½·¨ÐÞ¸ÄrootÓû§µÄÃÜÂ룺
# mysqladmin -uroot -p password 'newpassword'
Enter pass ......