summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-code.test
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2005-11-18 16:30:27 +0100
committerunknown <pem@mysql.com>2005-11-18 16:30:27 +0100
commit6726a6b8b9cc6059f8080846185114e42f248556 (patch)
tree511c72f417c8aa02f30a0a354d4641217c9c1dca /mysql-test/t/sp-code.test
parent91ab707678870966b9410cd3bdd783eb2a7c19e4 (diff)
downloadmariadb-git-6726a6b8b9cc6059f8080846185114e42f248556.tar.gz
Post-review fixes, mainly fixing all print() methods for sp_instr* classes.
Also added mysql-test files: include/is_debug_build.inc r/is_debug_build.require r/sp-code.result t/sp-code.test sql/sp_head.cc: Review fixes: - Some minor editorial changes - Fixed all print() methods for instructions: - reserve() enough space - check return value from reserve() - use qs_append, with length arg, whenever possible sql/sp_pcontext.cc: Review fixes. Also fixed bug in find_cursor(). sql/sp_pcontext.h: Changed parameter names (review fix). sql/sql_parse.cc: Moved comment. (Review fix) mysql-test/include/is_debug_build.inc: New BitKeeper file ``mysql-test/include/is_debug_build.inc'' mysql-test/r/is_debug_build.require: New BitKeeper file ``mysql-test/r/is_debug_build.require'' mysql-test/r/sp-code.result: New BitKeeper file ``mysql-test/r/sp-code.result'' mysql-test/t/sp-code.test: New BitKeeper file ``mysql-test/t/sp-code.test''
Diffstat (limited to 'mysql-test/t/sp-code.test')
-rw-r--r--mysql-test/t/sp-code.test50
1 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
new file mode 100644
index 00000000000..a40d86f9d4a
--- /dev/null
+++ b/mysql-test/t/sp-code.test
@@ -0,0 +1,50 @@
+#
+# Test the debugging feature "show procedure/function code <name>"
+#
+
+-- source include/is_debug_build.inc
+select version(), substring_index(version(), "-", -1);
+
+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;