mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
postreview fix (SCRUM)
fixed layout sql/filesort.cc: fixed layout sql/gstream.cc: fixed layout sql/item.cc: postreview fix sql/item.h: postreview fix sql/item_cmpfunc.cc: postreview fix sql/item_cmpfunc.h: fixed layout sql/item_func.h: fixed layout sql/item_row.h: fixed layout sql/item_strfunc.cc: fixed layout sql/item_subselect.cc: postreview fix sql/item_subselect.h: postreview fix sql/nt_servc.cc: fixed layout sql/opt_range.cc: fixed layout sql/password.c: fixed layout sql/spatial.cc: fixed layout sql/sql_help.cc: fixed layout sql/sql_lex.cc: fixed layout sql/sql_olap.cc: fixed layout sql/sql_select.cc: fixed layout sql/sql_show.cc: fixed layout sql/sql_string.cc: fixed layout sql/sql_table.cc: fixed layout sql/stacktrace.c: fixed layout
This commit is contained in:
@ -12,12 +12,14 @@ int GTextReadStream::get_next_toc_type() const
|
|||||||
return eostream;
|
return eostream;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_'))
|
if (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) ||
|
||||||
|
(*cur=='_'))
|
||||||
{
|
{
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || (*cur=='.'))
|
if (((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') ||
|
||||||
|
(*cur=='.'))
|
||||||
{
|
{
|
||||||
return numeric;
|
return numeric;
|
||||||
}
|
}
|
||||||
@ -63,8 +65,8 @@ const char *GTextReadStream::get_next_word(int *word_len)
|
|||||||
|
|
||||||
++cur;
|
++cur;
|
||||||
|
|
||||||
while(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_') ||
|
while (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) ||
|
||||||
((*cur>='0') && (*cur<='9')))
|
(*cur=='_') || ((*cur>='0') && (*cur<='9')))
|
||||||
{
|
{
|
||||||
++cur;
|
++cur;
|
||||||
}
|
}
|
||||||
|
32
sql/item.cc
32
sql/item.cc
@ -502,18 +502,17 @@ bool Item_ref_on_list_position::fix_fields(THD *thd,
|
|||||||
struct st_table_list *tables,
|
struct st_table_list *tables,
|
||||||
Item ** reference)
|
Item ** reference)
|
||||||
{
|
{
|
||||||
ref= 0;
|
|
||||||
List_iterator<Item> li(list);
|
List_iterator<Item> li(list);
|
||||||
Item *item;
|
Item *item;
|
||||||
uint i= 0;
|
for (uint i= 0; (item= li++) && i < pos; i++);
|
||||||
for (; (item= li++) && i < pos; i++);
|
if (item)
|
||||||
if (i == pos)
|
|
||||||
{
|
{
|
||||||
ref= li.ref();
|
ref= li.ref();
|
||||||
return Item_ref_null_helper::fix_fields(thd, tables, reference);
|
return Item_ref_null_helper::fix_fields(thd, tables, reference);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ref= 0;
|
||||||
my_error(ER_CARDINALITY_COL, MYF(0), pos);
|
my_error(ER_CARDINALITY_COL, MYF(0), pos);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1280,29 +1279,20 @@ longlong Item_cache_str::val_int()
|
|||||||
|
|
||||||
bool Item_cache_row::allocate(uint num)
|
bool Item_cache_row::allocate(uint num)
|
||||||
{
|
{
|
||||||
n= num;
|
item_count= num;
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
if (!(values= (Item_cache **) thd->calloc(sizeof(Item_cache *)*n)))
|
return (!(values=
|
||||||
{
|
(Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count)));
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_cache_row::setup(Item * item)
|
bool Item_cache_row::setup(Item * item)
|
||||||
{
|
{
|
||||||
if (!values && allocate(item->cols()))
|
if (!values && allocate(item->cols()))
|
||||||
return 1;
|
return 1;
|
||||||
for(uint i= 0; i < n; i++)
|
for (uint i= 0; i < item_count; i++)
|
||||||
{
|
{
|
||||||
if (!(values[i]= Item_cache::get_cache(item->el(i)->result_type())))
|
if (!(values[i]= Item_cache::get_cache(item->el(i)->result_type())))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
values[i]->setup(item->el(i));
|
values[i]->setup(item->el(i));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1312,7 +1302,7 @@ void Item_cache_row::store(Item * item)
|
|||||||
{
|
{
|
||||||
null_value= 0;
|
null_value= 0;
|
||||||
item->bring_value();
|
item->bring_value();
|
||||||
for(uint i= 0; i < n; i++)
|
for (uint i= 0; i < item_count; i++)
|
||||||
{
|
{
|
||||||
values[i]->store(item->el(i));
|
values[i]->store(item->el(i));
|
||||||
null_value|= values[i]->null_value;
|
null_value|= values[i]->null_value;
|
||||||
@ -1330,7 +1320,7 @@ void Item_cache_row::illegal_method_call(const char *method)
|
|||||||
|
|
||||||
bool Item_cache_row::check_cols(uint c)
|
bool Item_cache_row::check_cols(uint c)
|
||||||
{
|
{
|
||||||
if (c != n)
|
if (c != item_count)
|
||||||
{
|
{
|
||||||
my_error(ER_CARDINALITY_COL, MYF(0), c);
|
my_error(ER_CARDINALITY_COL, MYF(0), c);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1340,7 +1330,7 @@ bool Item_cache_row::check_cols(uint c)
|
|||||||
|
|
||||||
bool Item_cache_row::null_inside()
|
bool Item_cache_row::null_inside()
|
||||||
{
|
{
|
||||||
for (uint i= 0; i < n; i++)
|
for (uint i= 0; i < item_count; i++)
|
||||||
{
|
{
|
||||||
if (values[i]->cols() > 1)
|
if (values[i]->cols() > 1)
|
||||||
{
|
{
|
||||||
@ -1359,7 +1349,7 @@ bool Item_cache_row::null_inside()
|
|||||||
|
|
||||||
void Item_cache_row::bring_value()
|
void Item_cache_row::bring_value()
|
||||||
{
|
{
|
||||||
for (uint i= 0; i < n; i++)
|
for (uint i= 0; i < item_count; i++)
|
||||||
values[i]->bring_value();
|
values[i]->bring_value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -731,9 +731,9 @@ public:
|
|||||||
class Item_cache_row: public Item_cache
|
class Item_cache_row: public Item_cache
|
||||||
{
|
{
|
||||||
Item_cache **values;
|
Item_cache **values;
|
||||||
uint n;
|
uint item_count;
|
||||||
public:
|
public:
|
||||||
Item_cache_row(): values(0), n(2) { fixed= 1; null_value= 1; }
|
Item_cache_row(): values(0), item_count(2) { fixed= 1; null_value= 1; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
'allocate' used only in row transformer, to preallocate space for row
|
'allocate' used only in row transformer, to preallocate space for row
|
||||||
@ -768,7 +768,7 @@ public:
|
|||||||
};
|
};
|
||||||
enum Item_result result_type() const { return ROW_RESULT; }
|
enum Item_result result_type() const { return ROW_RESULT; }
|
||||||
|
|
||||||
uint cols() { return n; }
|
uint cols() { return item_count; }
|
||||||
Item* el(uint i) { return values[i]; }
|
Item* el(uint i) { return values[i]; }
|
||||||
Item** addr(uint i) { return (Item **) (values + i); }
|
Item** addr(uint i) { return (Item **) (values + i); }
|
||||||
bool check_cols(uint c);
|
bool check_cols(uint c);
|
||||||
|
@ -153,12 +153,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
|
|||||||
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
|
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,11 +272,7 @@ int Arg_comparator::compare_e_row()
|
|||||||
|
|
||||||
bool Item_in_optimizer::preallocate_row()
|
bool Item_in_optimizer::preallocate_row()
|
||||||
{
|
{
|
||||||
if ((cache= Item_cache::get_cache(ROW_RESULT)))
|
return (!(cache= Item_cache::get_cache(ROW_RESULT)));
|
||||||
return 0;
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
||||||
@ -296,11 +288,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
|||||||
used_tables_cache= args[0]->used_tables();
|
used_tables_cache= args[0]->used_tables();
|
||||||
const_item_cache= args[0]->const_item();
|
const_item_cache= args[0]->const_item();
|
||||||
if (!cache && !(cache= Item_cache::get_cache(args[0]->result_type())))
|
if (!cache && !(cache= Item_cache::get_cache(args[0]->result_type())))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
cache->setup(args[0]);
|
cache->setup(args[0]);
|
||||||
if (args[1]->fix_fields(thd, tables, args))
|
if (args[1]->fix_fields(thd, tables, args))
|
||||||
return 1;
|
return 1;
|
||||||
@ -1246,19 +1234,11 @@ void cmp_item_row::store_value(Item *item)
|
|||||||
item->null_value|= item->el(i)->null_value;
|
item->null_value|= item->el(i)->null_value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
|
void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
|
||||||
{
|
{
|
||||||
@ -1281,19 +1261,11 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
|
|||||||
item->null_value|= item->el(i)->null_value;
|
item->null_value|= item->el(i)->null_value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int cmp_item_row::cmp(Item *arg)
|
int cmp_item_row::cmp(Item *arg)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,11 @@ SUBSELECT TODO:
|
|||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include "sql_select.h"
|
#include "sql_select.h"
|
||||||
|
|
||||||
|
inline Item * and_items(Item* cond, Item *item)
|
||||||
|
{
|
||||||
|
return (cond? (new Item_cond_and(cond, item)) : item);
|
||||||
|
}
|
||||||
|
|
||||||
Item_subselect::Item_subselect():
|
Item_subselect::Item_subselect():
|
||||||
Item_result_field(), engine_owner(1), value_assigned(0), substitution(0),
|
Item_result_field(), engine_owner(1), value_assigned(0), substitution(0),
|
||||||
have_to_be_excluded(0)
|
have_to_be_excluded(0)
|
||||||
@ -51,7 +56,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex,
|
|||||||
DBUG_ENTER("Item_subselect::init");
|
DBUG_ENTER("Item_subselect::init");
|
||||||
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
|
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
|
||||||
|
|
||||||
select_transformer(select_lex->master_unit());
|
select_transformer(thd, select_lex->master_unit());
|
||||||
if (select_lex->next_select())
|
if (select_lex->next_select())
|
||||||
engine= new subselect_union_engine(thd, select_lex->master_unit(), result,
|
engine= new subselect_union_engine(thd, select_lex->master_unit(), result,
|
||||||
this);
|
this);
|
||||||
@ -67,7 +72,7 @@ Item_subselect::~Item_subselect()
|
|||||||
delete engine;
|
delete engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_subselect::select_transformer(st_select_lex_unit *unit)
|
void Item_subselect::select_transformer(THD *thd, st_select_lex_unit *unit)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Item_subselect::select_transformer");
|
DBUG_ENTER("Item_subselect::select_transformer");
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -146,7 +151,8 @@ void Item_singlerow_subselect::reset()
|
|||||||
value->null_value= 1;
|
value->null_value= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit)
|
void Item_singlerow_subselect::select_transformer(THD *thd,
|
||||||
|
st_select_lex_unit *unit)
|
||||||
{
|
{
|
||||||
SELECT_LEX *select_lex= unit->first_select();
|
SELECT_LEX *select_lex= unit->first_select();
|
||||||
|
|
||||||
@ -155,7 +161,6 @@ void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit)
|
|||||||
{
|
{
|
||||||
|
|
||||||
have_to_be_excluded= 1;
|
have_to_be_excluded= 1;
|
||||||
THD *thd= current_thd;
|
|
||||||
if (thd->lex.describe)
|
if (thd->lex.describe)
|
||||||
{
|
{
|
||||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||||
@ -178,21 +183,13 @@ void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit)
|
|||||||
cond= select_lex->having;
|
cond= select_lex->having;
|
||||||
else
|
else
|
||||||
if (!(cond= new Item_cond_and(select_lex->having, select_lex->where)))
|
if (!(cond= new Item_cond_and(select_lex->having, select_lex->where)))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (!(substitution= new Item_func_if(cond, substitution,
|
if (!(substitution= new Item_func_if(cond, substitution,
|
||||||
new Item_null())))
|
new Item_null())))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Item_singlerow_subselect::store(uint i, Item *item)
|
void Item_singlerow_subselect::store(uint i, Item *item)
|
||||||
{
|
{
|
||||||
@ -210,21 +207,13 @@ void Item_singlerow_subselect::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
engine->fix_length_and_dec(row= &value);
|
engine->fix_length_and_dec(row= &value);
|
||||||
if (!(value= Item_cache::get_cache(engine->type())))
|
if (!(value= Item_cache::get_cache(engine->type())))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns)))
|
if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns)))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
engine->fix_length_and_dec(row);
|
engine->fix_length_and_dec(row);
|
||||||
value= *row;
|
value= *row;
|
||||||
}
|
}
|
||||||
@ -443,7 +432,8 @@ Item_allany_subselect::Item_allany_subselect(Item_allany_subselect *item):
|
|||||||
func= item->func;
|
func= item->func;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
|
void Item_in_subselect::single_value_transformer(THD *thd,
|
||||||
|
st_select_lex_unit *unit,
|
||||||
Item *left_expr,
|
Item *left_expr,
|
||||||
compare_func_creator func)
|
compare_func_creator func)
|
||||||
{
|
{
|
||||||
@ -457,10 +447,8 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
|
|||||||
Item_in_optimizer *optimizer;
|
Item_in_optimizer *optimizer;
|
||||||
substitution= optimizer= new Item_in_optimizer(left_expr, this);
|
substitution= optimizer= new Item_in_optimizer(left_expr, this);
|
||||||
if (!optimizer)
|
if (!optimizer)
|
||||||
{
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
As far as Item_ref_in_optimizer do not substitude itself on fix_fields
|
As far as Item_ref_in_optimizer do not substitude itself on fix_fields
|
||||||
we can use same item for all selects.
|
we can use same item for all selects.
|
||||||
@ -497,15 +485,9 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
|
|||||||
(char *)"<no matter>",
|
(char *)"<no matter>",
|
||||||
(char*)"<result>"));
|
(char*)"<result>"));
|
||||||
if (sl->having || sl->with_sum_func || sl->group_list.first)
|
if (sl->having || sl->with_sum_func || sl->group_list.first)
|
||||||
if (sl->having)
|
sl->having= and_items(sl->having, item);
|
||||||
sl->having= new Item_cond_and(sl->having, item);
|
|
||||||
else
|
else
|
||||||
sl->having= item;
|
sl->where= and_items(sl->where, item);
|
||||||
else
|
|
||||||
if (sl->where)
|
|
||||||
sl->where= new Item_cond_and(sl->where, item);
|
|
||||||
else
|
|
||||||
sl->where= item;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -516,10 +498,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
|
|||||||
item= (*func)(expr, new Item_asterisk_remover(this, item,
|
item= (*func)(expr, new Item_asterisk_remover(this, item,
|
||||||
(char *)"<no matter>",
|
(char *)"<no matter>",
|
||||||
(char*)"<result>"));
|
(char*)"<result>"));
|
||||||
if (sl->where)
|
sl->where= and_items(sl->where, item);
|
||||||
sl->where= new Item_cond_and(sl->where, item);
|
|
||||||
else
|
|
||||||
sl->where= item;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -546,7 +525,6 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
|
|||||||
item= (*func)(left_expr, item);
|
item= (*func)(left_expr, item);
|
||||||
substitution= item;
|
substitution= item;
|
||||||
have_to_be_excluded= 1;
|
have_to_be_excluded= 1;
|
||||||
THD *thd= current_thd;
|
|
||||||
if (thd->lex.describe)
|
if (thd->lex.describe)
|
||||||
{
|
{
|
||||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||||
@ -561,7 +539,8 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit,
|
void Item_in_subselect::row_value_transformer(THD *thd,
|
||||||
|
st_select_lex_unit *unit,
|
||||||
Item *left_expr)
|
Item *left_expr)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Item_in_subselect::row_value_transformer");
|
DBUG_ENTER("Item_in_subselect::row_value_transformer");
|
||||||
@ -575,10 +554,8 @@ void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit,
|
|||||||
Item_in_optimizer *optimizer;
|
Item_in_optimizer *optimizer;
|
||||||
substitution= optimizer= new Item_in_optimizer(left_expr, this);
|
substitution= optimizer= new Item_in_optimizer(left_expr, this);
|
||||||
if (!optimizer)
|
if (!optimizer)
|
||||||
{
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
|
||||||
unit->dependent= 1;
|
unit->dependent= 1;
|
||||||
uint n= left_expr->cols();
|
uint n= left_expr->cols();
|
||||||
if (optimizer->preallocate_row() || (*optimizer->get_cache())->allocate(n))
|
if (optimizer->preallocate_row() || (*optimizer->get_cache())->allocate(n))
|
||||||
@ -608,40 +585,32 @@ void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit,
|
|||||||
(char *)"<no matter>",
|
(char *)"<no matter>",
|
||||||
(char *)"<left expr>"),
|
(char *)"<left expr>"),
|
||||||
func);
|
func);
|
||||||
if (!item)
|
item= and_items(item, func);
|
||||||
item= func;
|
|
||||||
else
|
|
||||||
item= new Item_cond_and(item, func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sl->having || sl->with_sum_func || sl->group_list.first ||
|
if (sl->having || sl->with_sum_func || sl->group_list.first ||
|
||||||
!sl->table_list.elements)
|
!sl->table_list.elements)
|
||||||
if (sl->having)
|
sl->having= and_items(sl->having, item);
|
||||||
sl->having= new Item_cond_and(sl->having, item);
|
|
||||||
else
|
else
|
||||||
sl->having= item;
|
sl->where= and_items(sl->where, item);
|
||||||
else
|
|
||||||
if (sl->where)
|
|
||||||
sl->where= new Item_cond_and(sl->where, item);
|
|
||||||
else
|
|
||||||
sl->where= item;
|
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_in_subselect::select_transformer(st_select_lex_unit *unit)
|
void Item_in_subselect::select_transformer(THD *thd, st_select_lex_unit *unit)
|
||||||
{
|
{
|
||||||
if (left_expr->cols() == 1)
|
if (left_expr->cols() == 1)
|
||||||
single_value_transformer(unit, left_expr,
|
single_value_transformer(thd, unit, left_expr,
|
||||||
&Item_bool_func2::eq_creator);
|
&Item_bool_func2::eq_creator);
|
||||||
else
|
else
|
||||||
row_value_transformer(unit, left_expr);
|
row_value_transformer(thd, unit, left_expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_allany_subselect::select_transformer(st_select_lex_unit *unit)
|
void Item_allany_subselect::select_transformer(THD *thd,
|
||||||
|
st_select_lex_unit *unit)
|
||||||
{
|
{
|
||||||
single_value_transformer(unit, left_expr, func);
|
single_value_transformer(thd, unit, left_expr, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
subselect_single_select_engine::subselect_single_select_engine(THD *thd,
|
subselect_single_select_engine::subselect_single_select_engine(THD *thd,
|
||||||
@ -726,11 +695,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item,
|
|||||||
if (row)
|
if (row)
|
||||||
{
|
{
|
||||||
if (!(row[i]= Item_cache::get_cache(res_type)))
|
if (!(row[i]= Item_cache::get_cache(res_type)))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return STRING_RESULT; // we should return something
|
return STRING_RESULT; // we should return something
|
||||||
}
|
|
||||||
row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals);
|
row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,7 +728,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row)
|
|||||||
mlen= len;
|
mlen= len;
|
||||||
if (!sel_item)
|
if (!sel_item)
|
||||||
sel_item= s_item;
|
sel_item= s_item;
|
||||||
maybe_null!= s_item->maybe_null;
|
maybe_null= s_item->maybe_null;
|
||||||
}
|
}
|
||||||
item->max_length= mlen;
|
item->max_length= mlen;
|
||||||
res_type= sel_item->result_type();
|
res_type= sel_item->result_type();
|
||||||
@ -771,11 +736,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row)
|
|||||||
if (row)
|
if (row)
|
||||||
{
|
{
|
||||||
if (!(row[0]= Item_cache::get_cache(res_type)))
|
if (!(row[0]= Item_cache::get_cache(res_type)))
|
||||||
{
|
|
||||||
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
||||||
current_thd->fatal_error= 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
row[0]->set_len_n_dec(mlen, sel_item->decimals);
|
row[0]->set_len_n_dec(mlen, sel_item->decimals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
{
|
{
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
}
|
}
|
||||||
virtual void select_transformer(st_select_lex_unit *unit);
|
virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
|
||||||
bool assigned() { return value_assigned; }
|
bool assigned() { return value_assigned; }
|
||||||
void assigned(bool a) { value_assigned= a; }
|
void assigned(bool a) { value_assigned= a; }
|
||||||
enum Type type() const;
|
enum Type type() const;
|
||||||
@ -106,7 +106,7 @@ public:
|
|||||||
decimals= item->decimals;
|
decimals= item->decimals;
|
||||||
}
|
}
|
||||||
void reset();
|
void reset();
|
||||||
void select_transformer(st_select_lex_unit *unit);
|
void select_transformer(THD *thd, st_select_lex_unit *unit);
|
||||||
void store(uint i, Item* item);
|
void store(uint i, Item* item);
|
||||||
double val();
|
double val();
|
||||||
longlong val_int ();
|
longlong val_int ();
|
||||||
@ -173,10 +173,11 @@ public:
|
|||||||
null_value= 0;
|
null_value= 0;
|
||||||
was_null= 0;
|
was_null= 0;
|
||||||
}
|
}
|
||||||
virtual void select_transformer(st_select_lex_unit *unit);
|
virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
|
||||||
void single_value_transformer(st_select_lex_unit *unit,
|
void single_value_transformer(THD *thd, st_select_lex_unit *unit,
|
||||||
Item *left_expr, compare_func_creator func);
|
Item *left_expr, compare_func_creator func);
|
||||||
void row_value_transformer(st_select_lex_unit *unit, Item *left_expr);
|
void row_value_transformer(THD *thd, st_select_lex_unit *unit,
|
||||||
|
Item *left_expr);
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
double val();
|
double val();
|
||||||
String *val_str(String*);
|
String *val_str(String*);
|
||||||
@ -195,7 +196,7 @@ public:
|
|||||||
Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f,
|
Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f,
|
||||||
st_select_lex *select_lex);
|
st_select_lex *select_lex);
|
||||||
Item_allany_subselect(Item_allany_subselect *item);
|
Item_allany_subselect(Item_allany_subselect *item);
|
||||||
virtual void select_transformer(st_select_lex_unit *unit);
|
virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
|
||||||
};
|
};
|
||||||
|
|
||||||
class subselect_engine: public Sql_alloc
|
class subselect_engine: public Sql_alloc
|
||||||
|
@ -2166,7 +2166,8 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
|
|||||||
{
|
{
|
||||||
tmp= param->table->file->
|
tmp= param->table->file->
|
||||||
records_in_range((int) keynr, (byte*)(param->min_key + 1),
|
records_in_range((int) keynr, (byte*)(param->min_key + 1),
|
||||||
min_key_length, (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG),
|
min_key_length,
|
||||||
|
(ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG),
|
||||||
(byte *)NullS, 0, HA_READ_KEY_EXACT);
|
(byte *)NullS, 0, HA_READ_KEY_EXACT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user