summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2003-03-05 19:45:17 +0100
committerunknown <pem@mysql.com>2003-03-05 19:45:17 +0100
commitf74b36a24266e290cf23c7d06333c3a558e33af9 (patch)
treee234a7655df51a3c25765f6ba7d58d0148fbd99c /sql
parentf519382d2bf276a9beb5d123fde93ec4cdfdefea (diff)
downloadmariadb-git-f74b36a24266e290cf23c7d06333c3a558e33af9.tar.gz
Improved error handling regarding SPs (with info like names etc in the output).
Disabled queries in FUNCTIONs. include/mysqld_error.h: New error message for queries in FUNCTIONs. mysql-test/t/sp.test: Moved error tests to sp-error.test. sql/share/czech/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/danish/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/dutch/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/english/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/estonian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/french/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/german/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/greek/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/hungarian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/italian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/japanese/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/korean/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/norwegian-ny/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/norwegian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/polish/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/portuguese/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/romanian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/russian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/serbian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/slovak/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/spanish/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/swedish/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/share/ukrainian/errmsg.txt: New error message for queries in FUNCTIONs. Improved most of the SP error messages with added info. sql/sp_head.cc: Added debug output to sp_instr_jump::execute(). (Moved from sp_head.h) sql/sp_head.h: Moved sp_instr_jump::execute() to sp_head.cc. sql/sql_lex.h: Added SQLCOM_CREATE_SPFUNCTION (for improved error handling). sql/sql_parse.cc: Improved error handling regarding SPs (adding info like names etc in output). sql/sql_yacc.yy: Improved error handling regarding SPs (adding info like names etc in output). Disabled queries in FUNCTIONS (since it can't work anyway).
Diffstat (limited to 'sql')
-rw-r--r--sql/share/czech/errmsg.txt21
-rw-r--r--sql/share/danish/errmsg.txt21
-rw-r--r--sql/share/dutch/errmsg.txt21
-rw-r--r--sql/share/english/errmsg.txt21
-rw-r--r--sql/share/estonian/errmsg.txt21
-rw-r--r--sql/share/french/errmsg.txt21
-rw-r--r--sql/share/german/errmsg.txt21
-rw-r--r--sql/share/greek/errmsg.txt21
-rw-r--r--sql/share/hungarian/errmsg.txt21
-rw-r--r--sql/share/italian/errmsg.txt21
-rw-r--r--sql/share/japanese/errmsg.txt21
-rw-r--r--sql/share/korean/errmsg.txt21
-rw-r--r--sql/share/norwegian-ny/errmsg.txt21
-rw-r--r--sql/share/norwegian/errmsg.txt21
-rw-r--r--sql/share/polish/errmsg.txt21
-rw-r--r--sql/share/portuguese/errmsg.txt21
-rw-r--r--sql/share/romanian/errmsg.txt21
-rw-r--r--sql/share/russian/errmsg.txt21
-rw-r--r--sql/share/serbian/errmsg.txt21
-rw-r--r--sql/share/slovak/errmsg.txt21
-rw-r--r--sql/share/spanish/errmsg.txt21
-rw-r--r--sql/share/swedish/errmsg.txt21
-rw-r--r--sql/share/ukrainian/errmsg.txt21
-rw-r--r--sql/sp_head.cc13
-rw-r--r--sql/sp_head.h6
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_parse.cc45
-rw-r--r--sql/sql_yacc.yy68
28 files changed, 352 insertions, 265 deletions
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index 67a7fc8259d..cf423e3d995 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -260,14 +260,15 @@ v/*
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 193d8204c7d..4aa1fb6756c 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -254,14 +254,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index e328bc64cfd..de19d3b2e3d 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -262,14 +262,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index b2e56d8b701..97a533c04d8 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 46b7240dd6d..648fdc1a8f3 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -256,14 +256,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 5dba7cd4739..a504701c52b 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 0a90b30d07c..76c6ac7b5cb 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -261,14 +261,15 @@
"Select %u wurde wДhrend der Optimierung reduziert.",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 0d64095b2e3..dbdd3da364f 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 4927b9b86e0..19acbdb413e 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 7a38bb4c9f0..1aaabf17187 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 21c891fb982..83dce80cc96 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 61aa944c92d..e8322b66873 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 527db96e708..a2c1cb04415 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 9af96c322c6..72212208faf 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -253,14 +253,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index cec72e6a1a2..7a012f20de3 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -255,14 +255,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 93f1bc4af81..f749d98c29b 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index c6cd6efc9a0..0df04309f40 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -255,14 +255,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index ecad689594d..362b65f8623 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -254,14 +254,15 @@
"Select %u был упразднен в процессе оптимизации",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 456df149576..1350e56062d 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -247,14 +247,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index a2a9f94e970..53331bdb904 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -259,14 +259,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 9faddd8b7f1..e48922ac566 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -252,14 +252,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 33359dbf7aa..0b83c93efea 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -251,14 +251,15 @@
"Select %u was reduced during optimisation",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index dfdb3e1c378..006789fb781 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -256,14 +256,15 @@
"Select %u was скасовано при оптимiзацii",
"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"
-"Can't create a PROCEDURE from within a PROCEDURE"
-"PROCEDURE already exists"
-"PROCEDURE does not exist"
-"Failed to DROP PROCEDURE"
-"Failed to CREATE PROCEDURE"
-"%s with no matching label"
-"Redefining label"
-"End-label without match"
-"Referring to uninitialized variable"
+"Can't create a %s from within another stored routine"
+"%s %s already exists"
+"%s %s does not exist"
+"Failed to DROP %s %s"
+"Failed to CREATE %s %s"
+"%s with no matching label: %s"
+"Redefining label %s"
+"End-label %s without match"
+"Referring to uninitialized variable %s"
"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"
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 55d21c37609..58ea7a7a873 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -443,6 +443,19 @@ sp_instr_set::execute(THD *thd, uint *nextp)
}
//
+// 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
//
int
diff --git a/sql/sp_head.h b/sql/sp_head.h
index ee64a1bd0cf..52cbdc56093 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -265,11 +265,7 @@ public:
virtual ~sp_instr_jump()
{}
- virtual int execute(THD *thd, uint *nextp)
- {
- *nextp= m_dest;
- return 0;
- }
+ virtual int execute(THD *thd, uint *nextp);
virtual void
set_destination(uint dest)
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 337b69026bf..66c58090bfd 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -75,7 +75,7 @@ enum enum_sql_command {
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES,
SQLCOM_HELP,
- SQLCOM_CREATE_PROCEDURE, SQLCOM_CALL,
+ SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL,
SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION,
/* This should be the last !!! */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 94278371fd0..539913383a7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -52,6 +52,15 @@
#define TRANS_MEM_ROOT_BLOCK_SIZE 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 "C" pthread_mutex_t THR_LOCK_keycache;
#ifdef SOLARIS
@@ -1589,7 +1598,7 @@ mysql_execute_command(THD *thd)
*/
sp_clear_function_cache(thd);
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))
DBUG_RETURN(-1);
@@ -2961,23 +2970,27 @@ mysql_execute_command(THD *thd)
res= -1;
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
break;
- case SQLCOM_CREATE_PROCEDURE: // FUNCTION too (but not UDF!)
+ case SQLCOM_CREATE_PROCEDURE:
+ case SQLCOM_CREATE_SPFUNCTION:
if (!lex->sphead)
{
- send_error(thd, ER_SP_NO_RECURSIVE_CREATE);
- goto error;
+ res= -1; // Shouldn't happen
+ break;
}
else
{
uint namelen;
char *name= lex->sphead->name(&namelen);
#ifdef HAVE_DLOPEN
- udf_func *udf = find_udf(name, namelen);
-
- if (udf)
+ if (lex->sphead->m_type == TYPE_ENUM_FUNCTION)
{
- net_printf(thd, ER_UDF_EXISTS, name);
- goto error;
+ udf_func *udf = find_udf(name, namelen);
+
+ if (udf)
+ {
+ net_printf(thd, ER_UDF_EXISTS, name);
+ goto error;
+ }
}
#endif
res= lex->sphead->create(thd);
@@ -2987,10 +3000,10 @@ mysql_execute_command(THD *thd)
send_ok(thd);
break;
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;
default:
- send_error(thd, ER_SP_STORE_FAILED);
+ net_printf(thd, ER_SP_STORE_FAILED, SP_TYPE_STRING(lex), name);
goto error;
}
}
@@ -3002,7 +3015,7 @@ mysql_execute_command(THD *thd)
sp= sp_find_procedure(thd, &lex->udf.name);
if (! sp)
{
- send_error(thd, ER_SP_DOES_NOT_EXIST);
+ net_printf(thd, ER_SP_DOES_NOT_EXIST, "PROCEDURE", lex->udf.name);
goto error;
}
else
@@ -3037,7 +3050,7 @@ mysql_execute_command(THD *thd)
sp= sp_find_function(thd, &lex->udf.name);
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;
}
else
@@ -3079,10 +3092,12 @@ mysql_execute_command(THD *thd)
send_ok(thd);
break;
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;
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;
}
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 7c2b97904fb..576962058c0 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -917,6 +917,11 @@ create:
{
LEX *lex= Lex;
+ if (lex->sphead)
+ {
+ net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "PROCEDURE");
+ YYABORT;
+ }
lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&$3, lex);
lex->sphead->m_type= TYPE_ENUM_PROCEDURE;
@@ -948,7 +953,11 @@ create_function_tail:
{
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->sphead= new sp_head(&lex->udf.name, lex);
lex->sphead->m_type= TYPE_ENUM_FUNCTION;
@@ -962,7 +971,9 @@ create_function_tail:
Lex->sphead->m_returns= (enum enum_field_types)$7;
}
sp_proc_stmt
- {}
+ {
+ Lex->sql_command = SQLCOM_CREATE_SPFUNCTION;
+ }
;
call:
@@ -1110,10 +1121,25 @@ sp_proc_stmt:
if (lex->sql_command != SQLCOM_SET_OPTION ||
!lex->var_list.is_empty())
{
- sp_instr_stmt *i= new sp_instr_stmt(lex->sphead->instructions());
-
- i->set_lex(lex);
- lex->sphead->add_instr(i);
+ /* 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());
+
+ i->set_lex(lex);
+ lex->sphead->add_instr(i);
+ }
}
lex->sphead->restore_lex(YYTHD);
}
@@ -1185,7 +1211,7 @@ sp_proc_stmt:
if (! lab)
{
- send_error(YYTHD, ER_SP_LILABEL_MISMATCH, "LEAVE");
+ net_printf(YYTHD, ER_SP_LILABEL_MISMATCH, "LEAVE", $2.str);
YYABORT;
}
else
@@ -1203,7 +1229,7 @@ sp_proc_stmt:
if (! lab)
{
- send_error(YYTHD, ER_SP_LILABEL_MISMATCH, "ITERATE");
+ net_printf(YYTHD, ER_SP_LILABEL_MISMATCH, "ITERATE", $2.str);
YYABORT;
}
else
@@ -1305,7 +1331,7 @@ sp_labeled_control:
if (lab)
{
- send_error(YYTHD, ER_SP_LABEL_REDEFINE);
+ net_printf(YYTHD, ER_SP_LABEL_REDEFINE, $1.str);
YYABORT;
}
else
@@ -1321,7 +1347,7 @@ sp_labeled_control:
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;
}
else
@@ -1965,6 +1991,17 @@ alter:
lex->sql_command= SQLCOM_ALTER_PROCEDURE;
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:
@@ -3526,10 +3563,13 @@ select_var_ident:
send_error(lex->thd, ER_SYNTAX_ERROR);
YYABORT;
}
- if (lex->result)
- ((select_dumpvar *)lex->result)->var_list.push_back( new my_var($1,1,t->offset));
- else
+ if (! lex->result)
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:
{ /* We're compiling a stored procedure and found a variable */
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;
}
else