From 28287c0dc5fac4a712019fd7c9a59b71c7d551a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 21 Jul 2004 14:53:09 +0200 Subject: Fixed BUG#2653: Undeclared variables not detected in stored procedures. We now get an run-time error instead of a crash (although a slightly misleading error message, but it's an improvement). mysql-test/r/sp-error.result: New test case for BUG#2653. mysql-test/t/sp-error.test: New test case for BUG#2653. sql/sp_head.cc: Detect failed evals (fix item really), which are due to unresolved variables/fields. Typically this would be a reference to an undeclared variable. (Also got rid of some compiler warnings.) sql/sp_rcontext.cc: Detect failed evals (fix item really), which are due to unresolved variables/fields. Typically this would be a reference to an undeclared variable. sql/sp_rcontext.h: Changed return type to int, so be able to detect failed evals (fix item). sql/sql_class.cc: Changed return type to int, so be able to detect failed evals (fix item). --- mysql-test/t/sp-error.test | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mysql-test/t/sp-error.test') diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 5a139e14560..3ca3a4ea677 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -553,6 +553,28 @@ drop table t3| --error 1049 create procedure nodb.bug3339() begin end| +# +# BUG#2653 +# +create procedure bug2653_1(a int, out b int) + set b = aa| + +create procedure bug2653_2(a int, out b int) +begin + if aa < 0 then + set b = - a; + else + set b = a; + end if; +end| + +--error 1054 +call bug2653_1(1, @b)| +--error 1054 +call bug2653_2(2, @b)| + +drop procedure bug2653_1| +drop procedure bug2653_2| drop table t1| -- cgit v1.2.1