71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
--disable_query_log
|
|
set @@session.explicit_defaults_for_timestamp=off;
|
|
--enable_query_log
|
|
# owner: yuchen.wyc
|
|
# owner group: SQL1
|
|
# description: OUR GOAL: Make all this simple and effective!
|
|
--disable_warnings
|
|
drop table if exists t1,t2,t3,t4;
|
|
--enable_warnings
|
|
|
|
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
|
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
|
connect (conn3,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
|
connect (conn4,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
|
|
|
###
|
|
# account test
|
|
##
|
|
create table t1(id int primary key, money1 int);
|
|
insert into t1(id,money1) values(1,100);
|
|
create table t2(id int primary key, money1 int);
|
|
insert into t2(id,money1) values(1,100);
|
|
|
|
select id,money1 from t1;
|
|
select id,money1 from t2;
|
|
|
|
--echo id1 - 100 id2 + 100
|
|
connection conn1;
|
|
begin;
|
|
update t1 set money1 = money1-100 where id = 1;
|
|
update t2 set money1 = money1+100 where id = 1;
|
|
commit;
|
|
|
|
|
|
connection conn2;
|
|
select id,money1 from t1;
|
|
select id,money1 from t2;
|
|
|
|
drop table t1;
|
|
drop table t2;
|
|
|
|
|
|
###
|
|
# account test
|
|
##
|
|
create table t1(id int primary key, money1 int);
|
|
insert into t1(id,money1) values(1,100);
|
|
create table t2(id int primary key, money1 int);
|
|
insert into t2(id,money1) values(1,100);
|
|
|
|
select id,money1 from t1;
|
|
select id,money1 from t2;
|
|
|
|
--echo id1 - 100 id2 + 100
|
|
connection conn1;
|
|
begin;
|
|
update t1 set money1 = money1-100 where id = 1;
|
|
disconnect conn1;
|
|
--error 2006
|
|
update t2 set money1 = money1+100 where id = 1;
|
|
--error 2006
|
|
commit;
|
|
sleep 1;
|
|
|
|
connection conn2;
|
|
select id,money1 from t1;
|
|
select id,money1 from t2;
|
|
|
|
drop table t1;
|
|
drop table t2;
|