Crashes with stored procedure return non-string values
  Also fixes Bug#2773


mysql-test/r/information_schema.result:
  Bug#3788
    Fix results for bugfix
mysql-test/r/sp.result:
  Bug#3788
    Tests for Bug
    Fix results for bugfix
mysql-test/t/sp.test:
  Bug#3788
    New tests for bug
sql/item.cc:
  Fix unrelated crash in view test with --ps-protocol.
sql/item_func.cc:
  Bug#3788
    Alter how SP function result types are handled.
sql/item_func.h:
  Bug#3788
    Alter how SP function result types are handled.
sql/mysql_priv.h:
  Bug#3788
    Prototypes for new global functions
sql/sp.cc:
  Bug#3788
    Alter how function return type is reported
sql/sp_head.cc:
  Bug#3788
    Change how function return types are stored for SPs
sql/sp_head.h:
  Bug#3788
    Change how function return types are stored for SPs
sql/sql_parse.cc:
  Bug#3788
    Split out field construction into its own function
sql/sql_table.cc:
  Bug#3788
    Split out field preparation code into its own function
sql/sql_yacc.yy:
  Bug#3788
    Change how function return types are stored for SPs
sql/unireg.cc:
  Bug#3788
    Add assertion check
This commit is contained in:
unknown 2005-03-04 21:14:35 +00:00
commit 1220069c53
14 changed files with 469 additions and 217 deletions

View file

@ -84,6 +84,9 @@ public:
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
enum enum_field_types m_returns; // For FUNCTIONs only
CHARSET_INFO *m_returns_cs; // For FUNCTIONs only
TYPELIB *m_returns_typelib; // For FUNCTIONs only
uint m_returns_len; // For FUNCTIONs only
uint m_returns_pack; // For FUNCTIONs only
my_bool m_has_return; // For FUNCTIONs only
my_bool m_simple_case; // TRUE if parsing simple case, FALSE otherwise
my_bool m_multi_results; // TRUE if a procedure with SELECT(s)
@ -96,7 +99,6 @@ public:
LEX_STRING m_db;
LEX_STRING m_name;
LEX_STRING m_params;
LEX_STRING m_retstr; // For FUNCTIONs only
LEX_STRING m_body;
LEX_STRING m_defstr;
LEX_STRING m_definer_user;
@ -105,8 +107,7 @@ public:
longlong m_modified;
HASH m_sptabs; /* Merged table lists */
// Pointers set during parsing
uchar *m_param_begin, *m_param_end, *m_returns_begin, *m_returns_end,
*m_body_begin;
uchar *m_param_begin, *m_param_end, *m_body_begin;
static void *
operator new(size_t size);
@ -124,6 +125,9 @@ public:
void
init_strings(THD *thd, LEX *lex, sp_name *name);
TYPELIB *
create_typelib(List<String> *src);
int
create(THD *thd);
@ -197,10 +201,7 @@ public:
char *create_string(THD *thd, ulong *lenp);
inline Item_result result()
{
return sp_map_result_type(m_returns);
}
Field *make_field(uint max_length, const char *name, TABLE *dummy);
void set_info(char *definer, uint definerlen,
longlong created, longlong modified,