Commit 12f771d9 authored by pem@mysql.com's avatar pem@mysql.com

Improved error handling regarding SPs (with info like names etc in the output).

Disabled queries in FUNCTIONs.
parent c4b76c26
...@@ -277,4 +277,5 @@ ...@@ -277,4 +277,5 @@
#define ER_SP_UNINIT_VAR 1258 #define ER_SP_UNINIT_VAR 1258
#define ER_SP_BADSELECT 1259 #define ER_SP_BADSELECT 1259
#define ER_SP_BADRETURN 1260 #define ER_SP_BADRETURN 1260
#define ER_ERROR_MESSAGES 261 #define ER_SP_BADQUERY 1261
#define ER_ERROR_MESSAGES 262
delete from mysql.proc;
create procedure proc1()
set @x = 42;
create function func1() returns int
return 42;
create procedure foo()
create procedure bar() set @x=3;
Can't create a PROCEDURE from within another stored routine
create procedure foo()
create function bar() returns double return 2.3;
Can't create a FUNCTION from within another stored routine
create procedure proc1()
set @x = 42;
PROCEDURE proc1 already exists
create function func1() returns int
return 42;
FUNCTION func1 already exists
alter procedure foo;
PROCEDURE foo does not exist
alter function foo;
FUNCTION foo does not exist
drop procedure foo;
PROCEDURE foo does not exist
drop function foo;
FUNCTION foo does not exist
call foo();
PROCEDURE foo does not exist
create procedure foo()
foo: loop
leave bar;
end loop;
LEAVE with no matching label: bar
create procedure foo()
foo: loop
iterate bar;
end loop;
ITERATE with no matching label: bar
create procedure foo()
foo: loop
foo: loop
set @x=2;
end loop foo;
end loop foo;
Redefining label foo
create procedure foo()
foo: loop
set @x=2;
end loop bar;
End-label bar without match
create procedure foo(out x int)
begin
declare y int;
set x = y;
end;
Referring to uninitialized variable y
create procedure foo(x int)
select * from test.t1;
SELECT in a stored procedure must have INTO
create procedure foo()
return 42;
RETURN is only allowed in a FUNCTION
create function foo() returns int
begin
declare x int;
select max(c) into x from test.t;
return x;
end;
Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION
drop procedure proc1;
drop function func1;
#
# Stored PROCEDURE error tests
#
# Make sure we don't have any procedures left.
delete from mysql.proc;
delimiter |;
# Check that we get the right error, i.e. UDF declaration parses correctly,
# but foo.so doesn't exist.
# QQ This generates an error message containing a misleading errno which
# might vary between systems (it usually doesn't have anything to do with
# the actual failing dlopen()).
#--error 1126
#create function foo returns real soname "foo.so"|
create procedure proc1()
set @x = 42|
create function func1() returns int
return 42|
# Can't create recursively
--error 1250
create procedure foo()
create procedure bar() set @x=3|
--error 1250
create procedure foo()
create function bar() returns double return 2.3|
# Already exists
--error 1251
create procedure proc1()
set @x = 42|
--error 1251
create function func1() returns int
return 42|
# Does not exist
--error 1252
alter procedure foo|
--error 1252
alter function foo|
--error 1252
drop procedure foo|
--error 1252
drop function foo|
--error 1252
call foo()|
# LEAVE/ITERATE with no match
--error 1255
create procedure foo()
foo: loop
leave bar;
end loop|
--error 1255
create procedure foo()
foo: loop
iterate bar;
end loop|
# Redefining label
--error 1256
create procedure foo()
foo: loop
foo: loop
set @x=2;
end loop foo;
end loop foo|
# End label mismatch
--error 1257
create procedure foo()
foo: loop
set @x=2;
end loop bar|
# Referring to undef variable
--error 1258
create procedure foo(out x int)
begin
declare y int;
set x = y;
end|
# We require INTO in SELECTs (for now; this might change in the future)
--error 1259
create procedure foo(x int)
select * from test.t1|
# RETURN in FUNCTION only
--error 1260
create procedure foo()
return 42|
# Doesn't allow queries in FUNCTIONs (for now :-( )
--error 1261
create function foo() returns int
begin
declare x int;
select max(c) into x from test.t;
return x;
end|
drop procedure proc1|
drop function func1|
delimiter ;|
...@@ -213,16 +213,6 @@ until x = 0 end repeat| ...@@ -213,16 +213,6 @@ until x = 0 end repeat|
drop procedure b2| drop procedure b2|
# Btw, this should generate an error (for now; this might change in the future)
--error 1259
create procedure b3(x int)
repeat
select * from test.t1; # No INTO!
insert into test.t1 values (repeat("b3",3), x);
set x = x-1;
until x = 0 end repeat|
# Labelled WHILE with ITERATE (pointless really) # Labelled WHILE with ITERATE (pointless really)
create procedure c(x int) create procedure c(x int)
hmm: while x > 0 do hmm: while x > 0 do
...@@ -398,14 +388,6 @@ end| ...@@ -398,14 +388,6 @@ end|
#drop table t2| #drop table t2|
drop procedure create_select| drop procedure create_select|
# Check that we get the right error, i.e. UDF declaration parses correctly,
# but foo.so doesn't exist.
# QQ This generates an error message containing a misleading errno which
# might vary between systems (it usually doesn't have anything to do with
# the actual failing dlopen()).
#--error 1126
#create function foo returns real soname "foo.so"|
# A minimal, constant FUNCTION. # A minimal, constant FUNCTION.
create function e() returns double create function e() returns double
return 2.7182818284590452354| return 2.7182818284590452354|
......
...@@ -260,14 +260,15 @@ v/* ...@@ -260,14 +260,15 @@ v/*
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -254,14 +254,15 @@ ...@@ -254,14 +254,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -262,14 +262,15 @@ ...@@ -262,14 +262,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -256,14 +256,15 @@ ...@@ -256,14 +256,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -261,14 +261,15 @@ ...@@ -261,14 +261,15 @@
"Select %u wurde während der Optimierung reduziert.", "Select %u wurde während der Optimierung reduziert.",
"Tabelle '%-.64s', die in einem der SELECT-Befehle verwendet wurde kann nicht in %-.32s verwendet werden." "Tabelle '%-.64s', die in einem der SELECT-Befehle verwendet wurde kann nicht in %-.32s verwendet werden."
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -253,14 +253,15 @@ ...@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -253,14 +253,15 @@ ...@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -253,14 +253,15 @@ ...@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -253,14 +253,15 @@ ...@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -255,14 +255,15 @@ ...@@ -255,14 +255,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -255,14 +255,15 @@ ...@@ -255,14 +255,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -254,14 +254,15 @@ ...@@ -254,14 +254,15 @@
"Select %u ", "Select %u ",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -247,14 +247,15 @@ ...@@ -247,14 +247,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -259,14 +259,15 @@ ...@@ -259,14 +259,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -252,14 +252,15 @@ ...@@ -252,14 +252,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -251,14 +251,15 @@ ...@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -256,14 +256,15 @@ ...@@ -256,14 +256,15 @@
"Select %u was iii", "Select %u was iii",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
"Can't create a PROCEDURE from within a PROCEDURE" "Can't create a %s from within another stored routine"
"PROCEDURE already exists" "%s %s already exists"
"PROCEDURE does not exist" "%s %s does not exist"
"Failed to DROP PROCEDURE" "Failed to DROP %s %s"
"Failed to CREATE PROCEDURE" "Failed to CREATE %s %s"
"%s with no matching label" "%s with no matching label: %s"
"Redefining label" "Redefining label %s"
"End-label without match" "End-label %s without match"
"Referring to uninitialized variable" "Referring to uninitialized variable %s"
"SELECT in a stored procedure must have INTO" "SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a stored FUNCTION" "RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
...@@ -442,6 +442,19 @@ sp_instr_set::execute(THD *thd, uint *nextp) ...@@ -442,6 +442,19 @@ sp_instr_set::execute(THD *thd, uint *nextp)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
//
// sp_instr_jump
//
int
sp_instr_jump::execute(THD *thd, uint *nextp)
{
DBUG_ENTER("sp_instr_jump::execute");
DBUG_PRINT("info", ("destination: %u", m_dest));
*nextp= m_dest;
DBUG_RETURN(0);
}
// //
// sp_instr_jump_if // sp_instr_jump_if
// //
......
...@@ -265,11 +265,7 @@ class sp_instr_jump : public sp_instr ...@@ -265,11 +265,7 @@ class sp_instr_jump : public sp_instr
virtual ~sp_instr_jump() virtual ~sp_instr_jump()
{} {}
virtual int execute(THD *thd, uint *nextp) virtual int execute(THD *thd, uint *nextp);
{
*nextp= m_dest;
return 0;
}
virtual void virtual void
set_destination(uint dest) set_destination(uint dest)
......
...@@ -75,7 +75,7 @@ enum enum_sql_command { ...@@ -75,7 +75,7 @@ enum enum_sql_command {
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES, SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES,
SQLCOM_HELP, SQLCOM_HELP,
SQLCOM_CREATE_PROCEDURE, SQLCOM_CALL, SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL,
SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION, SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION,
/* This should be the last !!! */ /* This should be the last !!! */
......
...@@ -52,6 +52,15 @@ ...@@ -52,6 +52,15 @@
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096 #define TRANS_MEM_ROOT_BLOCK_SIZE 4096
#define TRANS_MEM_ROOT_PREALLOC 4096 #define TRANS_MEM_ROOT_PREALLOC 4096
/* Used in error handling only */
#define SP_TYPE_STRING(LP) \
((LP)->sphead->m_type == TYPE_ENUM_FUNCTION ? "FUNCTION" : "PROCEDURE")
#define SP_COM_STRING(LP) \
((LP)->sql_command == SQLCOM_CREATE_SPFUNCTION || \
(LP)->sql_command == SQLCOM_ALTER_FUNCTION || \
(LP)->sql_command == SQLCOM_DROP_FUNCTION ? \
"FUNCTION" : "PROCEDURE")
extern int yyparse(void *thd); extern int yyparse(void *thd);
extern "C" pthread_mutex_t THR_LOCK_keycache; extern "C" pthread_mutex_t THR_LOCK_keycache;
#ifdef SOLARIS #ifdef SOLARIS
...@@ -1589,7 +1598,7 @@ mysql_execute_command(THD *thd) ...@@ -1589,7 +1598,7 @@ mysql_execute_command(THD *thd)
*/ */
sp_clear_function_cache(thd); sp_clear_function_cache(thd);
if (lex->sql_command != SQLCOM_CREATE_PROCEDURE && if (lex->sql_command != SQLCOM_CREATE_PROCEDURE &&
lex->sql_command != SQLCOM_CREATE_FUNCTION) lex->sql_command != SQLCOM_CREATE_SPFUNCTION)
{ {
if (sp_cache_functions(thd, lex)) if (sp_cache_functions(thd, lex))
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -2961,17 +2970,20 @@ mysql_execute_command(THD *thd) ...@@ -2961,17 +2970,20 @@ mysql_execute_command(THD *thd)
res= -1; res= -1;
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
break; break;
case SQLCOM_CREATE_PROCEDURE: // FUNCTION too (but not UDF!) case SQLCOM_CREATE_PROCEDURE:
case SQLCOM_CREATE_SPFUNCTION:
if (!lex->sphead) if (!lex->sphead)
{ {
send_error(thd, ER_SP_NO_RECURSIVE_CREATE); res= -1; // Shouldn't happen
goto error; break;
} }
else else
{ {
uint namelen; uint namelen;
char *name= lex->sphead->name(&namelen); char *name= lex->sphead->name(&namelen);
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
if (lex->sphead->m_type == TYPE_ENUM_FUNCTION)
{
udf_func *udf = find_udf(name, namelen); udf_func *udf = find_udf(name, namelen);
if (udf) if (udf)
...@@ -2979,6 +2991,7 @@ mysql_execute_command(THD *thd) ...@@ -2979,6 +2991,7 @@ mysql_execute_command(THD *thd)
net_printf(thd, ER_UDF_EXISTS, name); net_printf(thd, ER_UDF_EXISTS, name);
goto error; goto error;
} }
}
#endif #endif
res= lex->sphead->create(thd); res= lex->sphead->create(thd);
switch (res) switch (res)
...@@ -2987,10 +3000,10 @@ mysql_execute_command(THD *thd) ...@@ -2987,10 +3000,10 @@ mysql_execute_command(THD *thd)
send_ok(thd); send_ok(thd);
break; break;
case SP_WRITE_ROW_FAILED: case SP_WRITE_ROW_FAILED:
send_error(thd, ER_SP_ALREADY_EXISTS); net_printf(thd, ER_SP_ALREADY_EXISTS, SP_TYPE_STRING(lex), name);
goto error; goto error;
default: default:
send_error(thd, ER_SP_STORE_FAILED); net_printf(thd, ER_SP_STORE_FAILED, SP_TYPE_STRING(lex), name);
goto error; goto error;
} }
} }
...@@ -3002,7 +3015,7 @@ mysql_execute_command(THD *thd) ...@@ -3002,7 +3015,7 @@ mysql_execute_command(THD *thd)
sp= sp_find_procedure(thd, &lex->udf.name); sp= sp_find_procedure(thd, &lex->udf.name);
if (! sp) if (! sp)
{ {
send_error(thd, ER_SP_DOES_NOT_EXIST); net_printf(thd, ER_SP_DOES_NOT_EXIST, "PROCEDURE", lex->udf.name);
goto error; goto error;
} }
else else
...@@ -3037,7 +3050,7 @@ mysql_execute_command(THD *thd) ...@@ -3037,7 +3050,7 @@ mysql_execute_command(THD *thd)
sp= sp_find_function(thd, &lex->udf.name); sp= sp_find_function(thd, &lex->udf.name);
if (! sp) if (! sp)
{ {
send_error(thd, ER_SP_DOES_NOT_EXIST); net_printf(thd, ER_SP_DOES_NOT_EXIST, SP_COM_STRING(lex),lex->udf.name);
goto error; goto error;
} }
else else
...@@ -3079,10 +3092,12 @@ mysql_execute_command(THD *thd) ...@@ -3079,10 +3092,12 @@ mysql_execute_command(THD *thd)
send_ok(thd); send_ok(thd);
break; break;
case SP_KEY_NOT_FOUND: case SP_KEY_NOT_FOUND:
send_error(thd, ER_SP_DOES_NOT_EXIST); net_printf(thd, ER_SP_DOES_NOT_EXIST, SP_COM_STRING(lex),
lex->udf.name.str);
goto error; goto error;
default: default:
send_error(thd, ER_SP_DROP_FAILED); net_printf(thd, ER_SP_DROP_FAILED, SP_COM_STRING(lex),
lex->udf.name.str);
goto error; goto error;
} }
} }
......
...@@ -917,6 +917,11 @@ create: ...@@ -917,6 +917,11 @@ create:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead)
{
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "PROCEDURE");
YYABORT;
}
lex->spcont= new sp_pcontext(); lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&$3, lex); lex->sphead= new sp_head(&$3, lex);
lex->sphead->m_type= TYPE_ENUM_PROCEDURE; lex->sphead->m_type= TYPE_ENUM_PROCEDURE;
...@@ -948,7 +953,11 @@ create_function_tail: ...@@ -948,7 +953,11 @@ create_function_tail:
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command = SQLCOM_CREATE_PROCEDURE; if (lex->sphead)
{
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "FUNCTION");
YYABORT;
}
lex->spcont= new sp_pcontext(); lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&lex->udf.name, lex); lex->sphead= new sp_head(&lex->udf.name, lex);
lex->sphead->m_type= TYPE_ENUM_FUNCTION; lex->sphead->m_type= TYPE_ENUM_FUNCTION;
...@@ -962,7 +971,9 @@ create_function_tail: ...@@ -962,7 +971,9 @@ create_function_tail:
Lex->sphead->m_returns= (enum enum_field_types)$7; Lex->sphead->m_returns= (enum enum_field_types)$7;
} }
sp_proc_stmt sp_proc_stmt
{} {
Lex->sql_command = SQLCOM_CREATE_SPFUNCTION;
}
; ;
call: call:
...@@ -1109,12 +1120,27 @@ sp_proc_stmt: ...@@ -1109,12 +1120,27 @@ sp_proc_stmt:
*/ */
if (lex->sql_command != SQLCOM_SET_OPTION || if (lex->sql_command != SQLCOM_SET_OPTION ||
!lex->var_list.is_empty()) !lex->var_list.is_empty())
{
/* Currently we can't handle queries inside a FUNCTION,
** because of the way table locking works.
** This is unfortunate, and limits the usefulness of functions
** a great deal, but it's nothing we can do about this at the
** moment.
*/
if (lex->sphead->m_type == TYPE_ENUM_FUNCTION &&
lex->sql_command != SQLCOM_SET_OPTION)
{
send_error(YYTHD, ER_SP_BADQUERY);
YYABORT;
}
else
{ {
sp_instr_stmt *i= new sp_instr_stmt(lex->sphead->instructions()); sp_instr_stmt *i= new sp_instr_stmt(lex->sphead->instructions());
i->set_lex(lex); i->set_lex(lex);
lex->sphead->add_instr(i); lex->sphead->add_instr(i);
} }
}
lex->sphead->restore_lex(YYTHD); lex->sphead->restore_lex(YYTHD);
} }
} }
...@@ -1185,7 +1211,7 @@ sp_proc_stmt: ...@@ -1185,7 +1211,7 @@ sp_proc_stmt:
if (! lab) if (! lab)
{ {
send_error(YYTHD, ER_SP_LILABEL_MISMATCH, "LEAVE"); net_printf(YYTHD, ER_SP_LILABEL_MISMATCH, "LEAVE", $2.str);
YYABORT; YYABORT;
} }
else else
...@@ -1203,7 +1229,7 @@ sp_proc_stmt: ...@@ -1203,7 +1229,7 @@ sp_proc_stmt:
if (! lab) if (! lab)
{ {
send_error(YYTHD, ER_SP_LILABEL_MISMATCH, "ITERATE"); net_printf(YYTHD, ER_SP_LILABEL_MISMATCH, "ITERATE", $2.str);
YYABORT; YYABORT;
} }
else else
...@@ -1305,7 +1331,7 @@ sp_labeled_control: ...@@ -1305,7 +1331,7 @@ sp_labeled_control:
if (lab) if (lab)
{ {
send_error(YYTHD, ER_SP_LABEL_REDEFINE); net_printf(YYTHD, ER_SP_LABEL_REDEFINE, $1.str);
YYABORT; YYABORT;
} }
else else
...@@ -1321,7 +1347,7 @@ sp_labeled_control: ...@@ -1321,7 +1347,7 @@ sp_labeled_control:
if (! lab || strcasecmp($5.str, lab->name) != 0) if (! lab || strcasecmp($5.str, lab->name) != 0)
{ {
send_error(YYTHD, ER_SP_LABEL_MISMATCH); net_printf(YYTHD, ER_SP_LABEL_MISMATCH, $5.str);
YYABORT; YYABORT;
} }
else else
...@@ -1965,6 +1991,17 @@ alter: ...@@ -1965,6 +1991,17 @@ alter:
lex->sql_command= SQLCOM_ALTER_PROCEDURE; lex->sql_command= SQLCOM_ALTER_PROCEDURE;
lex->udf.name= $3; lex->udf.name= $3;
} }
| ALTER FUNCTION_SYM ident
/* QQ Characteristics missing for now */
opt_restrict
{
LEX *lex=Lex;
/* This is essensially an no-op right now, since we haven't
put the characteristics in yet. */
lex->sql_command= SQLCOM_ALTER_FUNCTION;
lex->udf.name= $3;
}
; ;
alter_list: alter_list:
...@@ -3526,10 +3563,13 @@ select_var_ident: ...@@ -3526,10 +3563,13 @@ select_var_ident:
send_error(lex->thd, ER_SYNTAX_ERROR); send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT; YYABORT;
} }
if (lex->result) if (! lex->result)
((select_dumpvar *)lex->result)->var_list.push_back( new my_var($1,1,t->offset));
else
YYABORT; YYABORT;
else
{
((select_dumpvar *)lex->result)->var_list.push_back( new my_var($1,1,t->offset));
t->isset= TRUE;
}
} }
; ;
...@@ -4384,7 +4424,7 @@ simple_ident: ...@@ -4384,7 +4424,7 @@ simple_ident:
{ /* We're compiling a stored procedure and found a variable */ { /* We're compiling a stored procedure and found a variable */
if (lex->sql_command != SQLCOM_CALL && ! spv->isset) if (lex->sql_command != SQLCOM_CALL && ! spv->isset)
{ {
send_error(YYTHD, ER_SP_UNINIT_VAR); net_printf(YYTHD, ER_SP_UNINIT_VAR, $1.str);
YYABORT; YYABORT;
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment