diff options
author | unknown <bell@sanja.is.com.ua> | 2002-12-28 01:01:05 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2002-12-28 01:01:05 +0200 |
commit | 3ab0ddc294891f31b65f92fb7af265047db15d52 (patch) | |
tree | 6675c15be87ddec825795b1d2a861d6bc696f109 | |
parent | 7388e9bd5b4604b351386e9d86888d94e4ac4d30 (diff) | |
download | mariadb-git-3ab0ddc294891f31b65f92fb7af265047db15d52.tar.gz |
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
-rw-r--r-- | sql/filesort.cc | 2 | ||||
-rw-r--r-- | sql/gstream.cc | 38 | ||||
-rw-r--r-- | sql/item.cc | 32 | ||||
-rw-r--r-- | sql/item.h | 6 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 30 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 4 | ||||
-rw-r--r-- | sql/item_func.h | 2 | ||||
-rw-r--r-- | sql/item_row.h | 2 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 6 | ||||
-rw-r--r-- | sql/item_subselect.cc | 113 | ||||
-rw-r--r-- | sql/item_subselect.h | 13 | ||||
-rw-r--r-- | sql/nt_servc.cc | 32 | ||||
-rw-r--r-- | sql/opt_range.cc | 11 | ||||
-rw-r--r-- | sql/password.c | 2 | ||||
-rw-r--r-- | sql/spatial.cc | 6 | ||||
-rw-r--r-- | sql/sql_help.cc | 14 | ||||
-rw-r--r-- | sql/sql_lex.cc | 6 | ||||
-rw-r--r-- | sql/sql_olap.cc | 12 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 | ||||
-rw-r--r-- | sql/sql_string.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/stacktrace.c | 6 |
23 files changed, 137 insertions, 210 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 8b55a2f4aa1..00ef12839cf 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -496,7 +496,7 @@ static void make_sortkey(register SORTPARAM *param, length=sort_field->length; } #ifdef USE_STRCOLL - if(use_strnxfrm(cs)) + if (use_strnxfrm(cs)) { if (item->binary()) { diff --git a/sql/gstream.cc b/sql/gstream.cc index 5a58fef6744..a97ed9cae03 100644 --- a/sql/gstream.cc +++ b/sql/gstream.cc @@ -3,36 +3,38 @@ int GTextReadStream::get_next_toc_type() const { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } - if(!(*cur)) + if (!(*cur)) { 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; } - if(*cur == '(') + if (*cur == '(') { return l_bra; } - if(*cur == ')') + if (*cur == ')') { return r_bra; } - if(*cur == ',') + if (*cur == ',') { return comma; } @@ -43,28 +45,28 @@ int GTextReadStream::get_next_toc_type() const const char *GTextReadStream::get_next_word(int *word_len) { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } m_last_text_position = cur; - if(!(*cur)) + if (!(*cur)) { return 0; } const char *wd_start = cur; - if(((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_')) + if (((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_')) { return NULL; } ++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; } @@ -79,19 +81,19 @@ const char *GTextReadStream::get_next_word(int *word_len) int GTextReadStream::get_next_number(double *d) { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } m_last_text_position = cur; - if(!(*cur)) + if (!(*cur)) { set_error_msg("Numeric constant expected"); return 1; } - if(((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.')) + if (((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.')) { set_error_msg("Numeric constant expected"); return 1; @@ -101,7 +103,7 @@ int GTextReadStream::get_next_number(double *d) *d = strtod(cur, &endptr); - if(endptr) + if (endptr) { m_cur = endptr; } @@ -112,11 +114,11 @@ int GTextReadStream::get_next_number(double *d) char GTextReadStream::get_next_symbol() { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } - if(!(*cur)) + if (!(*cur)) { return 0; } diff --git a/sql/item.cc b/sql/item.cc index 1603e179e5e..079767e68d2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -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; } diff --git a/sql/item.h b/sql/item.h index 508c737e7b9..046464da97d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -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); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 89ff5ef2822..94423642fa5 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -153,11 +153,7 @@ 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,18 +1234,10 @@ 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,18 +1261,10 @@ 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) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 603d7123a6f..2aca3e1fabb 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -544,8 +544,8 @@ public: cmp_item_row(): comparators(0), n(0) {} ~cmp_item_row() { - if(comparators) - for(uint i= 0; i < n; i++) + if (comparators) + for (uint i= 0; i < n; i++) if (comparators[i]) delete comparators[i]; } diff --git a/sql/item_func.h b/sql/item_func.h index 6ff2c7eef9d..522b954b7b5 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -995,7 +995,7 @@ public: { ft_handler->please->close_search(ft_handler); ft_handler=0; - if(join_key) + if (join_key) table->file->ft_handler=0; table->fulltext_searched=0; } diff --git a/sql/item_row.h b/sql/item_row.h index f33e0cc9821..82580797ebc 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -33,7 +33,7 @@ public: ~Item_row() { - if(array_holder && items) + if (array_holder && items) sql_element_free(items); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 78689bb3044..43eee0abf1c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1961,7 +1961,7 @@ String *Item_func_conv_charset::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while( s < se && d < de){ + while (s < se && d < de){ cnvres=from->mb_wc(from,&wc,s,se); if (cnvres>0) @@ -2035,7 +2035,7 @@ String *Item_func_conv_charset3::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while( s < se && d < de){ + while (s < se && d < de){ cnvres=from_charset->mb_wc(from_charset,&wc,s,se); if (cnvres>0) @@ -2655,7 +2655,7 @@ String *Item_func_spatial_collection::val_str(String *str) null_value=1; str->length(0); - if(str->reserve(9,512)) + if (str->reserve(9,512)) return 0; str->q_append((char)Geometry::wkbNDR); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index d14d2114d7e..8763701b7a3 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -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,18 +183,10 @@ 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; - } } } } @@ -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); - else - sl->having= item; + sl->having= and_items(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); - else - sl->having= item; + sl->having= and_items(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, @@ -678,7 +647,7 @@ subselect_union_engine::subselect_union_engine(THD *thd, subselect_engine(thd, item, result) { unit= u; - if( !result) + if (!result) { //out of memory thd->fatal_error= 1; @@ -694,13 +663,13 @@ int subselect_single_select_engine::prepare() prepared= 1; SELECT_LEX_NODE *save_select= thd->lex.current_select; thd->lex.current_select= select_lex; - if(join->prepare((TABLE_LIST*) select_lex->table_list.first, - select_lex->where, - (ORDER*) select_lex->order_list.first, - (ORDER*) select_lex->group_list.first, - select_lex->having, - (ORDER*) 0, select_lex, - select_lex->master_unit(), 0)) + if (join->prepare((TABLE_LIST*) select_lex->table_list.first, + select_lex->where, + (ORDER*) select_lex->order_list.first, + (ORDER*) select_lex->group_list.first, + select_lex->having, + (ORDER*) 0, select_lex, + select_lex->master_unit(), 0)) return 1; thd->lex.current_select= save_select; return 0; @@ -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); } } @@ -784,7 +745,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row) SELECT_LEX *sl= unit->first_select(); bool fake= 0; res_type= set_row(sl, item, row, &fake); - for(sl= sl->next_select(); sl; sl->next_select()) + for (sl= sl->next_select(); sl; sl->next_select()) { List_iterator_fast<Item> li(sl->item_list); Item *sel_item; diff --git a/sql/item_subselect.h b/sql/item_subselect.h index e15748cbebf..cf7f612224a 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -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 diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index b917c91ce15..93bae6f444d 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -431,7 +431,7 @@ BOOL NTService::SeekStatus(LPCSTR szInternName, int OperationType) if (ret_error == ERROR_ACCESS_DENIED) { printf("Install/Remove of the Service Denied!\n"); - if(!is_super_user()) + if (!is_super_user()) printf("That operation should be made by an user with Administrator privileges!\n"); } else @@ -530,13 +530,13 @@ BOOL NTService::is_super_user() UINT x; BOOL ret_value=FALSE; - if(!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) + if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) { - if(GetLastError() != ERROR_NO_TOKEN) - return FALSE; + if (GetLastError() != ERROR_NO_TOKEN) + return FALSE; - if(!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) - return FALSE; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) + return FALSE; } ret_value= GetTokenInformation(hAccessToken,TokenGroups,InfoBuffer, @@ -544,21 +544,21 @@ BOOL NTService::is_super_user() CloseHandle(hAccessToken); - if(!ret_value ) - return FALSE; + if (!ret_value ) + return FALSE; - if(!AllocateAndInitializeSid(&siaNtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, - &psidAdministrators)) - return FALSE; + if (!AllocateAndInitializeSid(&siaNtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &psidAdministrators)) + return FALSE; ret_value = FALSE; - for(x=0;x<ptgGroups->GroupCount;x++) + for (x=0;x<ptgGroups->GroupCount;x++) { - if( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) + if ( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) { ret_value = TRUE; break; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b117b6a5ea1..887ce6c561a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2162,12 +2162,13 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree, tmp=1; // Max one record else { - if(tmp_min_flag & GEOM_FLAG) + if (tmp_min_flag & GEOM_FLAG) { - 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), - (byte *)NullS,0,HA_READ_KEY_EXACT); + 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), + (byte *)NullS, 0, HA_READ_KEY_EXACT); } else { diff --git a/sql/password.c b/sql/password.c index 9fd3757106d..da7a499ba09 100644 --- a/sql/password.c +++ b/sql/password.c @@ -573,7 +573,7 @@ void get_hash_and_password(ulong* salt, uint8 pversion, char* hash, unsigned cha while (salt<salt_end) /* Iterate over these elements*/ { val=*salt; - for(t=3;t>=0;t--) + for (t=3;t>=0;t--) { bp[t]=val%256; diff --git a/sql/spatial.cc b/sql/spatial.cc index 1e2b9f1c512..5c6be3c221c 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -506,7 +506,7 @@ int GPolygon::get_data_as_text(String *txt) const for (; n_linear_rings>0; --n_linear_rings) { - if(no_data(data, 4)) + if (no_data(data, 4)) return 1; uint32 n_points = uint4korr(data); data += 4; @@ -593,7 +593,7 @@ int GPolygon::area(double *ar) const data += (8+8); } lr_area=fabs(lr_area)/2; - if(result==-1) result=lr_area; + if (result==-1) result=lr_area; else result-=lr_area; } *ar=fabs(result); @@ -1344,7 +1344,7 @@ int GGeometryCollection::get_mbr(MBR *mbr) const data += 4; for (; n_objects>0; --n_objects) { - if(no_data(data, WKB_HEADER_SIZE)) + if (no_data(data, WKB_HEADER_SIZE)) return 1; uint32 wkb_type = uint4korr(data + sizeof(char)); data += WKB_HEADER_SIZE; diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 5d12f023842..013101a0ecc 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -96,7 +96,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask, DBUG_ENTER("search_functions"); int count= 0; - if(mi_scan_init(file_leafs)) + if (mi_scan_init(file_leafs)) DBUG_RETURN(-1); help_leaf leaf; @@ -191,7 +191,7 @@ int search_categories(THD *thd, if (!(file_categories= open_help_file(thd,"function_category_name"))) DBUG_RETURN(-1); - if(mi_scan_init(file_categories)) + if (mi_scan_init(file_categories)) { mi_close(file_categories); DBUG_RETURN(-1); @@ -393,11 +393,11 @@ int mysqld_help(THD *thd, const char *mask) description->ptr(), example->ptr()))) goto end; } - else if((res= send_header_2(protocol)) || - (res= send_variant_2_list(protocol,&function_list,false)) || - (search_categories(thd, mask, &categories_list, 0)<0 && - (res=1)) || - (res= send_variant_2_list(protocol,&categories_list,true))) + else if ((res= send_header_2(protocol)) || + (res= send_variant_2_list(protocol,&function_list,false)) || + (search_categories(thd, mask, &categories_list, 0)<0 && + (res=1)) || + (res= send_variant_2_list(protocol,&categories_list,true))) { goto end; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ddbb562bdca..c2ebcdc1f28 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1036,7 +1036,7 @@ void st_select_lex_node::include_global(st_select_lex_node **plink) //excluding from global list (internal function) void st_select_lex_node::fast_exclude() { - if(link_prev) + if (link_prev) { if ((*link_prev= link_next)) link_next->link_prev= link_prev; @@ -1068,7 +1068,7 @@ void st_select_lex_node::exclude() void st_select_lex_unit::exclude_level() { SELECT_LEX_UNIT *units= 0, **units_last= &units; - for(SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) + for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) { if (sl->link_prev && (*sl->link_prev= sl->link_next)) sl->link_next->link_prev= sl->link_prev; @@ -1142,7 +1142,7 @@ void st_select_lex_node::mark_as_dependent(SELECT_LEX *last) for (SELECT_LEX_NODE *s= this; s &&s != last; s= s->outer_select()) - if( !s->dependent ) + if ( !s->dependent ) { // Select is dependent of outer select s->dependent= 1; diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 6eb4fbcaaf6..1f22073f556 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -62,7 +62,7 @@ static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new List_iterator<Item> list_it(select_lex->item_list); List_iterator<Item> new_it(new_fields); - while((item=list_it++)) + while ((item=list_it++)) { bool not_found=true; if (item->type()==Item::FIELD_ITEM) @@ -109,15 +109,15 @@ static int olap_combos(List<Item> old_fields, List<Item> new_fields, Item *item int num_new_fields) { int sl_return = 0; - if(position == num_new_fields) + if (position == num_new_fields) { - if(item) + if (item) new_fields.push_front(item); sl_return = make_new_olap_select(lex, select_lex, new_fields); } else { - if(item) + if (item) new_fields.push_front(item); while ((num_fields - num_new_fields >= selection - position) && !sl_return) { @@ -170,12 +170,12 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex) if (select_lex->olap == CUBE_TYPE) { - for( int i=count-1; i>=0 && !sl_return; i--) + for ( int i=count-1; i>=0 && !sl_return; i--) sl_return=olap_combos(item_list_copy, new_item_list, (Item *)0, lex, select_lex, 0, 0, count, i); } else if (select_lex->olap == ROLLUP_TYPE) { - for( int i=count-1; i>=0 && !sl_return; i--) + for ( int i=count-1; i>=0 && !sl_return; i--) { Item *item; item_list_copy.pop(); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9ee8af08ae4..83ccbada630 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1160,7 +1160,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds, if (thd->possible_loops) { Item *item; - while(thd->possible_loops->elements) + while (thd->possible_loops->elements) { item= thd->possible_loops->pop(); if (item->check_loop(thd->check_loops_counter++)) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ebade0111b0..3bf64d6c78f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1113,8 +1113,8 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(" USING BTREE", 12); // +BAR: send USING only in non-default case: non-spatial rtree - if((key_info->algorithm == HA_KEY_ALG_RTREE) && - !(key_info->flags & HA_SPATIAL)) + if ((key_info->algorithm == HA_KEY_ALG_RTREE) && + !(key_info->flags & HA_SPATIAL)) packet->append(" USING RTREE",12); packet->append(" (", 2); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 51b2386ae62..5b84b86c277 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -254,7 +254,7 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *from, CHARSET break; outp: - if((cnvres=to->wc_mb(to,wc,d,de)) >0 ) + if ((cnvres=to->wc_mb(to,wc,d,de)) >0 ) { d+=cnvres; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1ab84531e40..0d4d8743628 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -398,7 +398,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, it.rewind(); while ((sql_field=it++)) { - if(!sql_field->charset) + if (!sql_field->charset) sql_field->charset = create_info->table_charset ? create_info->table_charset : thd->db_charset? thd->db_charset : diff --git a/sql/stacktrace.c b/sql/stacktrace.c index f5c0a59b572..762c45e7184 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -38,7 +38,7 @@ void safe_print_str(const char* name, const char* val, int max_len) } fprintf(stderr, "= "); - for(; max_len && PTR_SANE(val) && *val; --max_len) + for (; max_len && PTR_SANE(val) && *val; --max_len) fputc(*val++, stderr); fputc('\n', stderr); } @@ -59,7 +59,7 @@ void safe_print_str(const char* name, const char* val, int max_len) inline uchar** find_prev_fp(uint32* pc, uchar** fp) { int i; - for(i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) { uchar* p = (uchar*)pc; if (p[2] == 222 && p[3] == 35) @@ -73,7 +73,7 @@ inline uchar** find_prev_fp(uint32* pc, uchar** fp) inline uint32* find_prev_pc(uint32* pc, uchar** fp) { int i; - for(i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) { char* p = (char*)pc; if (p[1] == 0 && p[2] == 94 && p[3] == -73) |