mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Fix for the bug #2198: SELECT INTO OUTFILE (with Sub-Select) Problem.
Proper Item_cache::setup() method. Code cleanup. (discussed with sanja) sql/item.cc: code cleanup sql/item.h: fix for the bug #2198: SELECT INTO OUTFILE (with Sub-Select) Problem. proper Item_cache::setup() method code cleanup sql/item_subselect.cc: fix for the bug #2198: SELECT INTO OUTFILE (with Sub-Select) Problem. proper Item_cache::setup() method code cleanup
This commit is contained in:
parent
509d5cf391
commit
17e54cf407
3 changed files with 15 additions and 19 deletions
|
@ -1867,7 +1867,6 @@ void Item_cache_int::store(Item *item)
|
|||
{
|
||||
value= item->val_int_result();
|
||||
null_value= item->null_value;
|
||||
collation.set(item->collation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1875,7 +1874,6 @@ void Item_cache_real::store(Item *item)
|
|||
{
|
||||
value= item->val_result();
|
||||
null_value= item->null_value;
|
||||
collation.set(item->collation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1898,7 +1896,6 @@ void Item_cache_str::store(Item *item)
|
|||
value_buff.copy(*value);
|
||||
value= &value_buff;
|
||||
}
|
||||
collation.set(item->collation);
|
||||
}
|
||||
|
||||
|
||||
|
|
16
sql/item.h
16
sql/item.h
|
@ -878,13 +878,15 @@ public:
|
|||
void set_used_tables(table_map map) { used_table_map= map; }
|
||||
|
||||
virtual bool allocate(uint i) { return 0; };
|
||||
virtual bool setup(Item *item) { example= item; return 0; };
|
||||
virtual void store(Item *)= 0;
|
||||
void set_len_n_dec(uint32 max_len, uint8 dec)
|
||||
virtual bool setup(Item *item)
|
||||
{
|
||||
max_length= max_len;
|
||||
decimals= dec;
|
||||
}
|
||||
example= item;
|
||||
max_length= item->max_length;
|
||||
decimals= item->decimals;
|
||||
collation.set(item->collation);
|
||||
return 0;
|
||||
};
|
||||
virtual void store(Item *)= 0;
|
||||
enum Type type() const { return CACHE_ITEM; }
|
||||
static Item_cache* get_cache(Item_result type);
|
||||
table_map used_tables() const { return used_table_map; }
|
||||
|
@ -909,7 +911,7 @@ class Item_cache_real: public Item_cache
|
|||
double value;
|
||||
public:
|
||||
Item_cache_real(): Item_cache() {}
|
||||
|
||||
|
||||
void store(Item *item);
|
||||
double val() { return value; }
|
||||
longlong val_int() { return (longlong) (value+(value > 0 ? 0.5 : -0.5)); }
|
||||
|
|
|
@ -301,8 +301,6 @@ void Item_singlerow_subselect::fix_length_and_dec()
|
|||
if ((max_columns= engine->cols()) == 1)
|
||||
{
|
||||
engine->fix_length_and_dec(row= &value);
|
||||
if (!(value= Item_cache::get_cache(engine->type())))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -955,13 +953,9 @@ static Item_result set_row(List<Item> &item_list, Item *item,
|
|||
res_type= sel_item->result_type();
|
||||
item->decimals= sel_item->decimals;
|
||||
*maybe_null= sel_item->maybe_null;
|
||||
if (row)
|
||||
{
|
||||
if (!(row[i]= Item_cache::get_cache(res_type)))
|
||||
return STRING_RESULT; // we should return something
|
||||
row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals);
|
||||
row[i]->collation.set(sel_item->collation);
|
||||
}
|
||||
if (!(row[i]= Item_cache::get_cache(res_type)))
|
||||
return STRING_RESULT; // we should return something
|
||||
row[i]->setup(sel_item);
|
||||
}
|
||||
if (item_list.elements > 1)
|
||||
res_type= ROW_RESULT;
|
||||
|
@ -982,7 +976,10 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row)
|
|||
DBUG_ASSERT(row || unit->first_select()->item_list.elements==1);
|
||||
|
||||
if (unit->first_select()->item_list.elements == 1)
|
||||
{
|
||||
res_type= set_row(unit->types, item, row, &maybe_null);
|
||||
item->collation.set(row[0]->collation);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool fake= 0;
|
||||
|
|
Loading…
Reference in a new issue