diff --git a/sql/sp.cc b/sql/sp.cc index 42b7248aa80..2d4cf97bce1 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -48,12 +48,12 @@ sp_find_procedure(THD *thd, Item_string *iname) HA_READ_KEY_EXACT)) goto done; - if ((defstr= get_field(&thd->mem_root, table, 1)) == NULL) + if ((defstr= get_field(&thd->mem_root, table->field[1])) == NULL) goto done; // QQ Set up our own mem_root here??? tmplex= lex_start(thd, (uchar*)defstr, strlen(defstr)); - if (yyparse(thd) || thd->fatal_error || tmplex->sphead == NULL) + if (yyparse(thd) || thd->is_fatal_error || tmplex->sphead == NULL) goto done; // Error else sp = tmplex->sphead; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 5ac904393f5..7ea9bfc1ba6 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1043,6 +1043,15 @@ bool select_dumpvar::send_data(List &items) bool select_dumpvar::send_eof() { + /* This mimics select_send::send_eof(), which unlocks this way. + * It appears to be necessary, since tables aren't unlock after + * selects otherwise. + */ + if (thd->lock) + { + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; + } if (row_count) { ::send_ok(thd,row_count); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5d82877d1b3..ce592b8ae97 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2982,13 +2982,17 @@ mysql_execute_command(THD *thd) } else { +#ifndef EMBEDDED_LIBRARY // When executing substatements, they're assumed to send_error when // it happens, but not to send_ok. my_bool nsok= thd->net.no_send_ok; thd->net.no_send_ok= TRUE; +#endif res= sp->execute(thd); +#ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; +#endif if (res == 0) send_ok(thd); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 269bd9143b8..ea3b550146b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1224,9 +1224,9 @@ sp_case: ; sp_whens: - /* Empty */ - | WHEN_SYM sp_case - | ELSE sp_proc_stmts + /* Empty */ {} + | WHEN_SYM sp_case {} + | ELSE sp_proc_stmts {} ; sp_labeled_control: