1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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:
unknown
2002-12-28 01:01:05 +02:00
parent 7388e9bd5b
commit 3ab0ddc294
23 changed files with 137 additions and 210 deletions

View File

@ -12,12 +12,14 @@ int GTextReadStream::get_next_toc_type() const
return eostream;
}
if(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_'))
if (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) ||
(*cur=='_'))
{
return word;
}
if(((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || (*cur=='.'))
if (((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') ||
(*cur=='.'))
{
return numeric;
}
@ -63,8 +65,8 @@ const char *GTextReadStream::get_next_word(int *word_len)
++cur;
while(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_') ||
((*cur>='0') && (*cur<='9')))
while (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) ||
(*cur=='_') || ((*cur>='0') && (*cur<='9')))
{
++cur;
}

View File

@ -502,18 +502,17 @@ bool Item_ref_on_list_position::fix_fields(THD *thd,
struct st_table_list *tables,
Item ** reference)
{
ref= 0;
List_iterator<Item> li(list);
Item *item;
uint i= 0;
for (; (item= li++) && i < pos; i++);
if (i == pos)
for (uint i= 0; (item= li++) && i < pos; i++);
if (item)
{
ref= li.ref();
return Item_ref_null_helper::fix_fields(thd, tables, reference);
}
else
{
ref= 0;
my_error(ER_CARDINALITY_COL, MYF(0), pos);
return 1;
}
@ -1280,29 +1279,20 @@ longlong Item_cache_str::val_int()
bool Item_cache_row::allocate(uint num)
{
n= num;
item_count= num;
THD *thd= current_thd;
if (!(values= (Item_cache **) thd->calloc(sizeof(Item_cache *)*n)))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
thd->fatal_error= 1;
return 1;
}
return 0;
return (!(values=
(Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count)));
}
bool Item_cache_row::setup(Item * item)
{
if (!values && allocate(item->cols()))
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())))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
current_thd->fatal_error= 1;
return 1;
}
values[i]->setup(item->el(i));
}
return 0;
@ -1312,7 +1302,7 @@ void Item_cache_row::store(Item * item)
{
null_value= 0;
item->bring_value();
for(uint i= 0; i < n; i++)
for (uint i= 0; i < item_count; i++)
{
values[i]->store(item->el(i));
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)
{
if (c != n)
if (c != item_count)
{
my_error(ER_CARDINALITY_COL, MYF(0), c);
return 1;
@ -1340,7 +1330,7 @@ bool Item_cache_row::check_cols(uint c)
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)
{
@ -1359,7 +1349,7 @@ bool Item_cache_row::null_inside()
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();
return;
}

View File

@ -731,9 +731,9 @@ public:
class Item_cache_row: public Item_cache
{
Item_cache **values;
uint n;
uint item_count;
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
@ -768,7 +768,7 @@ public:
};
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** addr(uint i) { return (Item **) (values + i); }
bool check_cols(uint c);

View File

@ -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));
}
else
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
current_thd->fatal_error= 1;
return 1;
}
}
return 0;
}
@ -276,11 +272,7 @@ int Arg_comparator::compare_e_row()
bool Item_in_optimizer::preallocate_row()
{
if ((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;
return (!(cache= Item_cache::get_cache(ROW_RESULT)));
}
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();
const_item_cache= args[0]->const_item();
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;
}
cache->setup(args[0]);
if (args[1]->fix_fields(thd, tables, args))
return 1;
@ -1246,19 +1234,11 @@ void cmp_item_row::store_value(Item *item)
item->null_value|= item->el(i)->null_value;
}
else
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
thd->fatal_error= 1;
return;
}
}
else
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
thd->fatal_error= 1;
return;
}
}
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;
}
else
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
current_thd->fatal_error= 1;
return;
}
}
else
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
current_thd->fatal_error= 1;
return;
}
}
int cmp_item_row::cmp(Item *arg)
{

View File

@ -32,6 +32,11 @@ SUBSELECT TODO:
#include "mysql_priv.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_result_field(), engine_owner(1), value_assigned(0), substitution(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_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())
engine= new subselect_union_engine(thd, select_lex->master_unit(), result,
this);
@ -67,7 +72,7 @@ Item_subselect::~Item_subselect()
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_VOID_RETURN;
@ -146,7 +151,8 @@ void Item_singlerow_subselect::reset()
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();
@ -155,7 +161,6 @@ void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit)
{
have_to_be_excluded= 1;
THD *thd= current_thd;
if (thd->lex.describe)
{
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;
else
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;
}
if (!(substitution= new Item_func_if(cond, substitution,
new Item_null())))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
thd->fatal_error= 1;
return;
}
}
}
}
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);
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;
}
}
else
{
THD *thd= current_thd;
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;
}
engine->fix_length_and_dec(row);
value= *row;
}
@ -443,7 +432,8 @@ Item_allany_subselect::Item_allany_subselect(Item_allany_subselect *item):
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,
compare_func_creator func)
{
@ -457,10 +447,8 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
Item_in_optimizer *optimizer;
substitution= optimizer= new Item_in_optimizer(left_expr, this);
if (!optimizer)
{
current_thd->fatal_error= 1;
DBUG_VOID_RETURN;
}
/*
As far as Item_ref_in_optimizer do not substitude itself on fix_fields
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*)"<result>"));
if (sl->having || sl->with_sum_func || sl->group_list.first)
if (sl->having)
sl->having= new Item_cond_and(sl->having, item);
sl->having= and_items(sl->having, item);
else
sl->having= item;
else
if (sl->where)
sl->where= new Item_cond_and(sl->where, item);
else
sl->where= item;
sl->where= and_items(sl->where, item);
}
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,
(char *)"<no matter>",
(char*)"<result>"));
if (sl->where)
sl->where= new Item_cond_and(sl->where, item);
else
sl->where= item;
sl->where= and_items(sl->where, item);
}
else
{
@ -546,7 +525,6 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit,
item= (*func)(left_expr, item);
substitution= item;
have_to_be_excluded= 1;
THD *thd= current_thd;
if (thd->lex.describe)
{
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;
}
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)
{
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;
substitution= optimizer= new Item_in_optimizer(left_expr, this);
if (!optimizer)
{
current_thd->fatal_error= 1;
DBUG_VOID_RETURN;
}
unit->dependent= 1;
uint n= left_expr->cols();
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 *)"<left expr>"),
func);
if (!item)
item= func;
else
item= new Item_cond_and(item, func);
item= and_items(item, func);
}
if (sl->having || sl->with_sum_func || sl->group_list.first ||
!sl->table_list.elements)
if (sl->having)
sl->having= new Item_cond_and(sl->having, item);
sl->having= and_items(sl->having, item);
else
sl->having= item;
else
if (sl->where)
sl->where= new Item_cond_and(sl->where, item);
else
sl->where= item;
sl->where= and_items(sl->where, item);
}
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)
single_value_transformer(unit, left_expr,
single_value_transformer(thd, unit, left_expr,
&Item_bool_func2::eq_creator);
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,
@ -726,11 +695,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item,
if (row)
{
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
}
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;
if (!sel_item)
sel_item= s_item;
maybe_null!= s_item->maybe_null;
maybe_null= s_item->maybe_null;
}
item->max_length= mlen;
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[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;
}
row[0]->set_len_n_dec(mlen, sel_item->decimals);
}
}

View File

@ -71,7 +71,7 @@ public:
{
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; }
void assigned(bool a) { value_assigned= a; }
enum Type type() const;
@ -106,7 +106,7 @@ public:
decimals= item->decimals;
}
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);
double val();
longlong val_int ();
@ -173,10 +173,11 @@ public:
null_value= 0;
was_null= 0;
}
virtual void select_transformer(st_select_lex_unit *unit);
void single_value_transformer(st_select_lex_unit *unit,
virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
void single_value_transformer(THD *thd, st_select_lex_unit *unit,
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();
double val();
String *val_str(String*);
@ -195,7 +196,7 @@ public:
Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f,
st_select_lex *select_lex);
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

View File

@ -2166,7 +2166,8 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
{
tmp= param->table->file->
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);
}
else