mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
e99f14e73b
mysql-test/r/sp-code.result: Removed forgotten test line. mysql-test/t/sp-code.test: Removed forgotten test line.
49 lines
1 KiB
Text
49 lines
1 KiB
Text
#
|
|
# Test the debugging feature "show procedure/function code <name>"
|
|
#
|
|
|
|
-- source include/is_debug_build.inc
|
|
|
|
create procedure empty()
|
|
begin
|
|
end;
|
|
show procedure code empty;
|
|
drop procedure empty;
|
|
|
|
create function almost_empty()
|
|
returns int
|
|
return 0;
|
|
show function code almost_empty;
|
|
drop function almost_empty;
|
|
|
|
delimiter //;
|
|
create procedure code_sample(x int, out err int, out nulls int)
|
|
begin
|
|
declare count int default 0;
|
|
|
|
set nulls = 0;
|
|
begin
|
|
declare c cursor for select name from t1;
|
|
declare exit handler for not found close c;
|
|
|
|
open c;
|
|
loop
|
|
begin
|
|
declare n varchar(20);
|
|
declare continue handler for sqlexception set err=1;
|
|
|
|
fetch c into n;
|
|
if isnull(n) then
|
|
set nulls = nulls + 1;
|
|
else
|
|
set count = count + 1;
|
|
update t2 set idx = count where name=n;
|
|
end if;
|
|
end;
|
|
end loop;
|
|
end;
|
|
select t.name, t.idx from t2 t order by idx asc;
|
|
end//
|
|
delimiter ;//
|
|
show procedure code code_sample;
|
|
drop procedure code_sample;
|