diff options
author | unknown <pem@mysql.comhem.se> | 2004-07-21 14:53:09 +0200 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2004-07-21 14:53:09 +0200 |
commit | 28287c0dc5fac4a712019fd7c9a59b71c7d551a9 (patch) | |
tree | 9c4a5fbacf4edbc4b2994c620f5d4a69b951f7d6 /sql/sp_rcontext.cc | |
parent | 09ea3e09a4b276bb13b67d4fc1c950cbe5026da9 (diff) | |
download | mariadb-git-28287c0dc5fac4a712019fd7c9a59b71c7d551a9.tar.gz |
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).
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r-- | sql/sp_rcontext.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 0b2b20fe3b3..7fa44f217f6 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -40,12 +40,19 @@ sp_rcontext::sp_rcontext(uint fsize, uint hmax, uint cmax) m_saved.empty(); } -void +int sp_rcontext::set_item_eval(uint idx, Item *i, enum_field_types type) { extern Item *sp_eval_func_item(THD *thd, Item *it, enum_field_types type); + Item *it= sp_eval_func_item(current_thd, i, type); - set_item(idx, sp_eval_func_item(current_thd, i, type)); + if (! it) + return -1; + else + { + set_item(idx, it); + return 0; + } } int |