lock_multi.result 1.84 KB
Newer Older
1
drop table if exists t1,t2;
unknown's avatar
unknown committed
2 3 4 5 6 7
create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
 update low_priority t1 set n = 4;
 select n from t1;
unlock tables;
8 9
n
4
unknown's avatar
unknown committed
10 11 12 13 14 15 16
drop table t1;
create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
 update low_priority t1 set n = 4;
 select n from t1;
unlock tables;
17 18
n
1
unknown's avatar
unknown committed
19
drop table t1;
20 21 22 23 24 25 26 27 28
create table t1 (a int, b int);
create table t2 (c int, d int);
insert into t1 values(1,1);
insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
 update t1,t2 set c=a where b=d;
select c from t2;
c
unknown's avatar
unknown committed
29
2
30 31
drop table t1;
drop table t2;
32 33 34 35 36
create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
 insert t1 select * from t2;
drop table t2;
37
ERROR 42S02: Table 'test.t2' doesn't exist
38
drop table t1;
39 40 41 42 43 44 45
create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
 insert t1 select * from t2;
drop table t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
46 47 48 49 50 51 52
create table t1(a int);
lock tables t1 write;
show columns from t1;
Field	Type	Null	Key	Default	Extra
a	int(11)	YES		NULL	
unlock tables;
drop table t1;
unknown's avatar
unknown committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
use mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
use mysql;
 SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user;
Table	Op	Msg_type	Msg_text
mysql.columns_priv	optimize	status	OK
mysql.db	optimize	status	OK
mysql.host	optimize	status	OK
mysql.user	optimize	status	OK
UNLOCK TABLES;
Select_priv
N
use test;
use test;
69 70 71 72 73 74 75 76
CREATE DATABASE mysqltest_1;
FLUSH TABLES WITH READ LOCK;
 DROP DATABASE mysqltest_1;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist