Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into pcgem.rdg.cyberkinetica.com:/var/db/bk/work-acurtis/bug3788.4
parents d3f4a597 dde2a985
...@@ -4368,33 +4368,19 @@ longlong Item_func_row_count::val_int() ...@@ -4368,33 +4368,19 @@ longlong Item_func_row_count::val_int()
Item_func_sp::Item_func_sp(sp_name *name) Item_func_sp::Item_func_sp(sp_name *name)
:Item_func(), m_name(name), m_sp(NULL) :Item_func(), m_name(name), m_sp(NULL)
{ {
char *empty_name= (char *) "";
maybe_null= 1; maybe_null= 1;
m_name->init_qname(current_thd); m_name->init_qname(current_thd);
bzero(&dummy_table, sizeof(dummy_table)); dummy_table= (TABLE *)sql_alloc(sizeof(TABLE));
dummy_table.share.table_cache_key = empty_name; bzero(dummy_table, sizeof(TABLE));
dummy_table.share.table_name = empty_name;
dummy_table.table.alias = empty_name;
dummy_table.share.table_name = empty_name;
dummy_table.table.maybe_null = maybe_null;
dummy_table.table.in_use= current_thd;
dummy_table.table.s = &dummy_table.share;
} }
Item_func_sp::Item_func_sp(sp_name *name, List<Item> &list) Item_func_sp::Item_func_sp(sp_name *name, List<Item> &list)
:Item_func(list), m_name(name), m_sp(NULL) :Item_func(list), m_name(name), m_sp(NULL)
{ {
char *empty_name= (char *) "";
maybe_null= 1; maybe_null= 1;
m_name->init_qname(current_thd); m_name->init_qname(current_thd);
bzero(&dummy_table, sizeof(dummy_table)); dummy_table= (TABLE *)sql_alloc(sizeof(TABLE));
dummy_table.share.table_cache_key = empty_name; bzero(dummy_table, sizeof(TABLE));
dummy_table.share.table_name = empty_name;
dummy_table.table.alias = empty_name;
dummy_table.share.table_name = empty_name;
dummy_table.table.maybe_null = maybe_null;
dummy_table.table.in_use= current_thd;
dummy_table.table.s = &dummy_table.share;
} }
const char * const char *
...@@ -4426,7 +4412,21 @@ Item_func_sp::sp_result_field(void) const ...@@ -4426,7 +4412,21 @@ Item_func_sp::sp_result_field(void) const
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ENTER("Item_func_sp::sp_result_field"); DBUG_ENTER("Item_func_sp::sp_result_field");
if (m_sp) if (m_sp)
field= m_sp->make_field(max_length, name, &dummy_table.table); {
if (dummy_table->s == NULL)
{
char *empty_name= (char *) "";
TABLE_SHARE *share;
dummy_table->s= share= &dummy_table->share_not_to_be_used;
dummy_table->alias = empty_name;
dummy_table->maybe_null = maybe_null;
dummy_table->in_use= current_thd;
share->table_cache_key = empty_name;
share->table_name = empty_name;
share->table_name = empty_name;
}
field= m_sp->make_field(max_length, name, dummy_table);
}
DBUG_RETURN(field); DBUG_RETURN(field);
} }
......
...@@ -1252,10 +1252,7 @@ class Item_func_sp :public Item_func ...@@ -1252,10 +1252,7 @@ class Item_func_sp :public Item_func
private: private:
sp_name *m_name; sp_name *m_name;
mutable sp_head *m_sp; mutable sp_head *m_sp;
mutable struct { TABLE *dummy_table;
TABLE table;
TABLE_SHARE share;
} dummy_table;
int execute(Item **itp); int execute(Item **itp);
Field *sp_result_field(void) const; Field *sp_result_field(void) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment