~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
select hex(@a);
2
hex(@a)
3
NULL
4
select hex(@a);
5
hex(@a)
6
610063
7
set global init_connect="set @a=2;set @b=3";
8
select @a, @b;
9
@a	@b
10
2	3
11
set GLOBAL init_connect=DEFAULT;
12
select @a;
13
@a
14
NULL
15
set global init_connect="drop table if exists t1; create table t1(a char(10));\
16
insert into t1 values ('\0');insert into t1 values('abc')";
17
select hex(a) from t1;
18
hex(a)
19
00
20
616263
21
set GLOBAL init_connect="adsfsdfsdfs";
22
select @a;
23
Got one of the listed errors
24
drop table t1;
25
End of 4.1 tests
26
create table t1 (x int);
27
insert into t1 values (3), (5), (7);
28
create table t2 (y int);
29
create user mysqltest1@localhost;
30
grant all privileges on test.* to mysqltest1@localhost;
31
set global init_connect="create procedure p1() select * from t1";
32
call p1();
33
x
34
3
35
5
36
7
37
drop procedure p1;
38
set global init_connect="create procedure p1(x int)\
39
begin\
40
  select count(*) from t1;\
41
  select * from t1;\
42
  set @x = x;
43
end";
44
call p1(42);
45
count(*)
46
3
47
x
48
3
49
5
50
7
51
select @x;
52
@x
53
42
54
set global init_connect="call p1(4711)";
55
select @x;
56
@x
57
4711
58
set global init_connect="drop procedure if exists p1";
59
call p1();
60
ERROR 42000: PROCEDURE test.p1 does not exist
61
create procedure p1(out sum int)
62
begin
63
declare n int default 0;
64
declare c cursor for select * from t1;
65
declare exit handler for not found
66
begin
67
close c;
68
set sum = n;
69
end;
70
open c;
71
loop
72
begin
73
declare x int;
74
fetch c into x;
75
if x > 3 then
76
set n = n + x;
77
end if;
78
end;
79
end loop;
80
end|
81
set global init_connect="call p1(@sum)";
82
select @sum;
83
@sum
84
12
85
drop procedure p1;
86
create procedure p1(tbl char(10), v int)
87
begin
88
set @s = concat('insert into ', tbl, ' values (?)');
89
set @v = v;
90
prepare stmt1 from @s;
91
execute stmt1 using @v;
92
deallocate prepare stmt1;
93
end|
94
set global init_connect="call p1('t1', 11)";
95
select * from t1;
96
x
97
3
98
5
99
7
100
11
101
drop procedure p1;
102
create function f1() returns int
103
begin
104
declare n int;
105
select count(*) into n from t1;
106
return n;
107
end|
108
set global init_connect="set @x = f1()";
109
select @x;
110
@x
111
4
112
set global init_connect="create view v1 as select f1()";
113
select * from v1;
114
f1()
115
4
116
set global init_connect="drop view v1";
117
select * from v1;
118
ERROR 42S02: Table 'test.v1' doesn't exist
119
drop function f1;
120
create trigger trg1
121
after insert on t2
122
for each row
123
insert into t1 values (new.y);
124
set global init_connect="insert into t2 values (13), (17), (19)";
125
select * from t1;
126
x
127
3
128
5
129
7
130
11
131
13
132
17
133
19
134
drop trigger trg1;
135
set global init_connect="set @a='a\\0c'";
136
revoke all privileges, grant option from mysqltest1@localhost;
137
drop user mysqltest1@localhost;
138
drop table t1, t2;