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)来说是不可见的(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
相关文档:
Administration 管理
Kill a Thread 结束一个线程
mysql > KILL 999;
Optimize Table 优化表
mysql > OPTIMEZE TABLE foo;
Reload Users Permissions 刷新MySQL系统权限相关表
mysql > FLUSH PRIVILEGES;
Repair Table 修复表
mysql > ......
MySQL Cluster配置step by step
来源:http://space.itpub.net/15415488/viewspace-620903
公司有个项目是测试distributed DB,其中一项是针对MySQL Cluster的测试。
于是花了两天时间装机器和配置MySQL Cluster。整个过程还是比较顺利的,当然如果对MySQL常用命令比较熟悉的话会更顺利。
留下step by step配 ......
public class select {
public List XiuGai_select(String keyword){
List list=new ArrayList();
Connection conn = null;
Statement stmt = null;
String sql=null;
ResultSet res = null;
get ......
亲爱的拯救MySQL的中国签名支持者:
欧盟可能无法拯救MySQL, 中国和俄罗斯可能是拯救MySQL的希望之所在。中国拥有强大、独立以及自信的反垄断主管机关,因此,我本人在此请求您的帮助。对于您在 http://helpmysql.org/cn/petition
的签名,我们深表感谢。如果可以的话,我们需要您的进一步帮助:
&nb ......
新增用户:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'你的远端ip' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
如:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.10.19.220' IDENTIFIED BY '123456' WITH GRANT OPTION;
登录到新增的用户:(假如原授权机的IP为10.10.19.222)
mysql -uroot -p123456&n ......