1create table t1 (a int);
2insert into t1 values (1),(2),(3);
3length
4107520
5select length(routine_definition) from information_schema.routines where routine_schema = 'test' and routine_name = 'longprocedure';
6length(routine_definition)
7107530
8call test.longprocedure(@value);
9select @value;
10@value
113
12drop procedure test.longprocedure;
13drop table t1;
14create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
15insert into t1 (f1, f2, f3, f4, f5) values
16("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
17Warnings:
18Note	1265	Data truncated for column 'f5' at row 1
19create table t2 like t1;
20select count(*) from t1;
21count(*)
22256
23select count(*) from t2;
24count(*)
250
26drop procedure if exists p1;
27create procedure p1()
28begin
29declare done integer default 0;
30declare vf1 char(100) ;
31declare vf2 mediumint;
32declare vf3 int ;
33declare vf4 real ;
34declare vf5 numeric ;
35declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
36declare continue handler for sqlstate '02000' set done = 1;
37open cur1;
38while done <> 1 do
39fetch cur1 into vf1, vf2, vf3, vf4, vf5;
40if not done then
41insert into t2 values (vf1, vf2, vf3, vf4, vf5);
42end if;
43end while;
44close cur1;
45end|
46call p1();
47select count(*) from t1;
48count(*)
49256
50select count(*) from t2;
51count(*)
52256
53select f1 from t1 limit 1;
54f1
55This is a test case for for Bug#9819
56select f1 from t2 limit 1;
57f1
58This is a test case for for Bug#9819
59drop procedure p1;
60drop table t1, t2;
61create table t1 (
62`id1` int unsigned not null default '0',
63`id2` int unsigned not null default '0',
64`link_type` int unsigned not null default '0',
65`visibility` tinyint not null default '0',
66`data` varchar(255) not null default '',
67`time` int unsigned not null default '0',
68`version` int unsigned not null default '0',
69primary key (id1, link_type, visibility, id2)
70) default collate=latin1_bin;
71create procedure select_test()
72begin
73declare id1_cond int;
74set id1_cond = 1;
75while id1_cond <= 10000 do
76select count(*) as cnt from (select id1 from t1 force index (primary) where id1 = id1_cond and link_type = 1 and visibility = 1 order by id2 desc) as t into @cnt;
77set id1_cond = id1_cond + 1;
78end while;
79end//
80Warnings:
81Warning	1287	'<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
82insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
83set @before=unix_timestamp();
84call select_test();
85select unix_timestamp() - @before < @time;
86unix_timestamp() - @before < @time
871
88drop procedure select_test;
89drop table t1;
90