~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/lock.result

  • Committer: Brian Aker
  • Date: 2009-06-05 23:10:06 UTC
  • mto: This revision was merged to the branch mainline in revision 1055.
  • Revision ID: brian@gaz-20090605231006-01nyw7pfpj2z2v8p
Remove guts in parser for LOCK TABLE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1,t2;
2
 
CREATE TABLE t1 (  `id` int NOT NULL default '0', `id2` int NOT NULL default '0', `id3` int NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY  (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM;
3
 
insert into t1 (id,id2) values (1,1),(1,2),(1,3);
4
 
LOCK TABLE t1 WRITE;
5
 
select dummy1,count(distinct id) from t1 group by dummy1;
6
 
dummy1  count(distinct id)
7
 
NULL    1
8
 
update t1 set id=-1 where id=1;
9
 
LOCK TABLE t1 READ;
10
 
update t1 set id=1 where id=1;
11
 
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
12
 
create table t2 SELECT * from t1;
13
 
ERROR HY000: Table 't2' was not locked with LOCK TABLES
14
 
create temporary table t2 SELECT * from t1;
15
 
drop table if exists t2;
16
 
unlock tables;
17
 
create table t2 SELECT * from t1;
18
 
LOCK TABLE t1 WRITE,t2 write;
19
 
insert into t2 SELECT * from t1;
20
 
update t1 set id=1 where id=-1;
21
 
drop table t1,t2;
22
 
CREATE TABLE t1 (
23
 
index1 int default NULL,
24
 
nr int default NULL,
25
 
KEY index1(index1)
26
 
) ENGINE=MyISAM;
27
 
CREATE TABLE t2 (
28
 
nr int default NULL,
29
 
name varchar(20) default NULL
30
 
) ENGINE=MyISAM;
31
 
INSERT INTO t2 VALUES (1,'item1');
32
 
INSERT INTO t2 VALUES (2,'item2');
33
 
lock tables t1 write, t2 read;
34
 
insert into t1 select 1,nr from t2 where name='item1';
35
 
insert into t1 select 2,nr from t2 where name='item2';
36
 
unlock tables;
37
 
check table t1;
38
 
Table   Op      Msg_type        Msg_text
39
 
test.t1 check   status  OK
40
 
lock tables t1 write;
41
 
check table t2;
42
 
Table   Op      Msg_type        Msg_text
43
 
test.t2 check   Error   Table 't2' was not locked with LOCK TABLES
44
 
test.t2 check   error   Corrupt
45
 
insert into t1 select index1,nr from t1;
46
 
ERROR HY000: Table 't1' was not locked with LOCK TABLES
47
 
unlock tables;
48
 
lock tables t1 write, t1 as t1_alias read;
49
 
insert into t1 select index1,nr from t1 as t1_alias;
50
 
drop table t1,t2;
51
 
ERROR HY000: Table 't2' was not locked with LOCK TABLES
52
 
unlock tables;
53
 
drop table t1,t2;
54
 
create table t1 (c1 int);
55
 
create table t2 (c1 int);
56
 
create table t3 (c1 int);
57
 
lock tables t1 write, t2 write, t3 write;
58
 
drop table t2, t3, t1;
59
 
create table t1 (c1 int);
60
 
create table t2 (c1 int);
61
 
create table t3 (c1 int);
62
 
lock tables t1 write, t2 write, t3 write, t1 as t4 read;
63
 
alter table t2 add column c2 int;
64
 
drop table t1, t2, t3;
65
 
create table t1 ( a int not null auto_increment, primary key(a));
66
 
create table t2 ( a int not null auto_increment, primary key(a));
67
 
lock tables t1 write, t2 read;
68
 
delete from t1 using t1,t2 where t1.a=t2.a;
69
 
delete t1 from t1,t2 where t1.a=t2.a;
70
 
delete from t2 using t1,t2 where t1.a=t2.a;
71
 
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
72
 
delete t2 from t1,t2 where t1.a=t2.a;
73
 
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
74
 
drop table t1,t2;
75
 
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
76
 
unlock tables;
77
 
drop table t2,t1;
78
 
End of 4.1 tests.
79
 
drop table if exists t1;
80
 
create table t1 (a int);
81
 
lock table t1 write;
82
 
flush tables with read lock;
83
 
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
84
 
unlock tables;
85
 
drop table t1;
86
 
 
87
 
Cleanup.
88
 
 
89
 
End of 5.1 tests.