diff options
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 83fbd8c5173..f517504e1f5 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -230,7 +230,20 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) goto done; } - lex_start(thd, (uchar*)defstr, deflen); + { + /* This is something of a kludge. We need to initialize some fields + * in thd->lex (the unit and master stuff), and the easiest way to + * do it is, is to call mysql_init_query(), but this unfortunately + * resets teh value_list where we keep the CALL parameters. So we + * copy the list and then restore it. + */ + List<Item> vals= thd->lex->value_list; + + mysql_init_query(thd, TRUE); + lex_start(thd, (uchar*)defstr, deflen); + thd->lex->value_list= vals; + } + if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL) { LEX *newlex= thd->lex; |