~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/read_many_rows.inc

  • Committer: Brian Aker
  • Date: 2008-12-16 22:26:59 UTC
  • mfrom: (673.3.9 tests)
  • Revision ID: brian@tangent.org-20081216222659-066d8awi29paz0og
Merging in Stewart's tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
CREATE TABLE t2 (id INTEGER PRIMARY KEY);
30
30
CREATE TABLE t3 (a CHAR(32) PRIMARY KEY,id INTEGER);
31
31
eval CREATE TABLE t4 (a CHAR(32) PRIMARY KEY,id INTEGER) ENGINE=$other_engine_type;
32
 
 
 
32
begin;
33
33
INSERT INTO t1 (id) VALUES (1);
34
34
INSERT INTO t1 SELECT id+1 FROM t1;
35
35
INSERT INTO t1 SELECT id+2 FROM t1;
60
60
 
61
61
DROP TABLE t1,t2,t3,t4;
62
62
 
63
 
#
64
 
# Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
65
 
#
66
 
CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB;
67
 
CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
68
 
DELIMITER |;
69
 
CREATE TRIGGER t1_bi before INSERT
70
 
    ON t1 FOR EACH ROW
71
 
BEGIN
72
 
  DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock';
73
 
  DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
74
 
  INSERT INTO t2 (f2) VALUES (1);
75
 
  DELETE FROM t2 WHERE f2 = 1;
76
 
END;|
77
 
 
78
 
CREATE PROCEDURE proc24989()
79
 
BEGIN
80
 
  DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
81
 
  DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
82
 
  INSERT INTO t2 (f2) VALUES (1);
83
 
  DELETE FROM t2 WHERE f2 = 1;
84
 
END;|
85
 
 
86
 
create procedure proc24989_2()
87
 
    deterministic
88
 
begin
89
 
  declare continue handler for sqlexception
90
 
    select 'Outer handler' as 'exception';
91
 
 
92
 
  insert into t1 values(1);
93
 
  select "continued";
94
 
end|
95
 
 
96
 
DELIMITER ;|
97
 
 
98
 
connect (con1,localhost,root,,);
99
 
connect (con2,localhost,root,,);
100
 
 
101
 
connection con1;
102
 
start transaction;
103
 
insert into t1 values(1);
104
 
 
105
 
connection con2;
106
 
start transaction;
107
 
insert into t2 values(123);
108
 
send insert into t1 values(1);
109
 
 
110
 
connection con1;
111
 
--sleep 1
112
 
insert into t1 values(1);
113
 
 
114
 
connection con2;
115
 
--error 1213
116
 
reap;
117
 
select @a;
118
 
# check that the whole transaction was rolled back
119
 
select * from t2;
120
 
 
121
 
connection con1;
122
 
commit;
123
 
start transaction;
124
 
insert into t1 values(1);
125
 
 
126
 
connection con2;
127
 
start transaction;
128
 
insert into t2 values(123);
129
 
send call proc24989();
130
 
 
131
 
connection con1;
132
 
--sleep 1
133
 
insert into t1 values(1);
134
 
 
135
 
connection con2;
136
 
reap;
137
 
select @a,@b;
138
 
# check that the whole transaction was rolled back
139
 
select * from t2;
140
 
 
141
 
connection con1;
142
 
commit;
143
 
start transaction;
144
 
insert into t1 values(1);
145
 
 
146
 
connection con2;
147
 
start transaction;
148
 
insert into t2 values(123);
149
 
send call proc24989_2();
150
 
 
151
 
connection con1;
152
 
--sleep 1
153
 
insert into t1 values(1);
154
 
commit;
155
 
 
156
 
connection con2;
157
 
reap;
158
 
# check that the whole transaction was rolled back
159
 
select * from t2;
160
 
 
161
 
disconnect con1;
162
 
disconnect con2;
163
 
connection default;
164
 
drop procedure proc24989;
165
 
drop procedure proc24989_2;
166
 
drop table t1,t2;
167