mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
made changes according to the review, mostly removing unused code and fixing code to follow the coding conventions
This commit is contained in:
parent
f04426f727
commit
f8e135c7df
4 changed files with 55 additions and 104 deletions
30
sql/item.h
30
sql/item.h
|
@ -5303,8 +5303,6 @@ public:
|
|||
/* Compare the cached value with the source value, without copying */
|
||||
virtual int cmp_read_only()=0;
|
||||
|
||||
virtual void clear()=0;
|
||||
|
||||
virtual ~Cached_item(); /*line -e1509 */
|
||||
};
|
||||
|
||||
|
@ -5322,11 +5320,6 @@ public:
|
|||
cmp();
|
||||
item= save;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
null_value= false;
|
||||
}
|
||||
};
|
||||
|
||||
class Cached_item_str :public Cached_item_item
|
||||
|
@ -5337,10 +5330,6 @@ public:
|
|||
Cached_item_str(THD *thd, Item *arg);
|
||||
bool cmp(void);
|
||||
int cmp_read_only();
|
||||
void clear()
|
||||
{
|
||||
null_value= false;
|
||||
}
|
||||
~Cached_item_str(); // Deallocate String:s
|
||||
};
|
||||
|
||||
|
@ -5353,11 +5342,6 @@ public:
|
|||
bool cmp(void);
|
||||
int cmp_read_only();
|
||||
double get_value(){ return value;}
|
||||
void clear()
|
||||
{
|
||||
value=0.0;
|
||||
null_value= false;
|
||||
}
|
||||
};
|
||||
|
||||
class Cached_item_int :public Cached_item_item
|
||||
|
@ -5368,11 +5352,6 @@ public:
|
|||
bool cmp(void);
|
||||
int cmp_read_only();
|
||||
longlong get_value(){ return value;}
|
||||
void clear()
|
||||
{
|
||||
value=0.0;
|
||||
null_value= false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -5384,11 +5363,6 @@ public:
|
|||
bool cmp(void);
|
||||
int cmp_read_only();
|
||||
my_decimal *get_value(){ return &value;};
|
||||
void clear()
|
||||
{
|
||||
null_value= false;
|
||||
my_decimal_set_zero(&value);
|
||||
}
|
||||
};
|
||||
|
||||
class Cached_item_field :public Cached_item
|
||||
|
@ -5406,10 +5380,6 @@ public:
|
|||
}
|
||||
bool cmp(void);
|
||||
int cmp_read_only();
|
||||
void clear()
|
||||
{
|
||||
null_value= false;
|
||||
}
|
||||
};
|
||||
|
||||
class Item_default_value : public Item_field
|
||||
|
|
|
@ -32,22 +32,13 @@ public:
|
|||
|
||||
Group_bound_tracker(THD *thd, SQL_I_List<ORDER> *list)
|
||||
{
|
||||
if (list)
|
||||
for (ORDER *curr = list->first; curr; curr=curr->next)
|
||||
{
|
||||
for (ORDER *curr = list->first; curr; curr=curr->next)
|
||||
{
|
||||
Cached_item *tmp= new_Cached_item(thd, curr->item[0], TRUE);
|
||||
group_fields.push_back(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Group_bound_tracker(THD *thd, Item *item)
|
||||
{
|
||||
Cached_item *tmp= new_Cached_item(thd, item, FALSE);
|
||||
group_fields.push_back(tmp);
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
first_check= true;
|
||||
|
@ -96,19 +87,6 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool compare_with_cache_for_null_values()
|
||||
{
|
||||
List_iterator<Cached_item> li(group_fields);
|
||||
Cached_item *ptr;
|
||||
while ((ptr= li++))
|
||||
{
|
||||
ptr->cmp();
|
||||
if (ptr->null_value)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
List<Cached_item> group_fields;
|
||||
/*
|
||||
|
@ -797,7 +775,7 @@ public:
|
|||
|
||||
double arg_val= arg->val_real();
|
||||
|
||||
if(prev_value != arg_val)
|
||||
if (prev_value != arg_val)
|
||||
{
|
||||
my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0));
|
||||
has_error= TRUE;
|
||||
|
@ -815,7 +793,7 @@ public:
|
|||
Item_sum_cume_dist::add();
|
||||
double val= Item_sum_cume_dist::val_real();
|
||||
|
||||
if(val >= prev_value && !val_calculated)
|
||||
if (val >= prev_value && !val_calculated)
|
||||
val_calculated= true;
|
||||
return false;
|
||||
}
|
||||
|
@ -918,7 +896,7 @@ public:
|
|||
}
|
||||
|
||||
double arg_val= arg->val_real();
|
||||
if(prev_value != arg_val)
|
||||
if (prev_value != arg_val)
|
||||
{
|
||||
my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0));
|
||||
has_error= TRUE;
|
||||
|
@ -1116,7 +1094,7 @@ public:
|
|||
|
||||
bool only_single_element_order_list() const
|
||||
{
|
||||
switch(window_func()->sum_func()){
|
||||
switch (window_func()->sum_func()){
|
||||
case Item_sum::PERCENTILE_CONT_FUNC:
|
||||
case Item_sum::PERCENTILE_DISC_FUNC:
|
||||
return true;
|
||||
|
@ -1127,7 +1105,7 @@ public:
|
|||
|
||||
void setting_handler_for_percentile_functions(Item_result rtype) const
|
||||
{
|
||||
switch(window_func()->sum_func()){
|
||||
switch (window_func()->sum_func()){
|
||||
case Item_sum::PERCENTILE_DISC_FUNC:
|
||||
((Item_sum_percentile_disc* ) window_func())->set_handler_by_cmp_type(rtype);
|
||||
break;
|
||||
|
|
|
@ -322,7 +322,7 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
|
|||
}
|
||||
|
||||
li.rewind();
|
||||
while((win_func_item= li++))
|
||||
while ((win_func_item= li++))
|
||||
{
|
||||
if (win_func_item->check_result_type_of_order_item())
|
||||
DBUG_RETURN(1);
|
||||
|
@ -911,7 +911,7 @@ class Partition_read_cursor : public Table_read_cursor
|
|||
{
|
||||
public:
|
||||
Partition_read_cursor(THD *thd, SQL_I_List<ORDER> *partition_list) :
|
||||
bound_tracker(thd, partition_list){}
|
||||
bound_tracker(thd, partition_list) {}
|
||||
|
||||
void init(READ_RECORD *info)
|
||||
{
|
||||
|
@ -968,10 +968,6 @@ public:
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
bool check_for_end_of_partition()
|
||||
{
|
||||
return end_of_partition;
|
||||
}
|
||||
|
||||
private:
|
||||
Group_bound_tracker bound_tracker;
|
||||
|
@ -1078,6 +1074,7 @@ protected:
|
|||
{
|
||||
if (perform_no_action)
|
||||
return;
|
||||
|
||||
List_iterator_fast<Item_sum> it(sum_functions);
|
||||
Item_sum *item_sum;
|
||||
while ((item_sum= it++))
|
||||
|
@ -1156,7 +1153,7 @@ public:
|
|||
Frame_cursor *cursor;
|
||||
while ((cursor= iter++))
|
||||
cursor->pre_next_row();
|
||||
|
||||
|
||||
iter.rewind();
|
||||
while ((cursor= iter++))
|
||||
cursor->next_row();
|
||||
|
@ -1693,7 +1690,7 @@ public:
|
|||
Frame_unbounded_following(THD *thd,
|
||||
SQL_I_List<ORDER> *partition_list,
|
||||
SQL_I_List<ORDER> *order_list) :
|
||||
cursor(thd, partition_list){}
|
||||
cursor(thd, partition_list) {}
|
||||
|
||||
void init(READ_RECORD *info)
|
||||
{
|
||||
|
@ -1736,7 +1733,7 @@ public:
|
|||
Frame_unbounded_following_set_count(
|
||||
THD *thd,
|
||||
SQL_I_List<ORDER> *partition_list, SQL_I_List<ORDER> *order_list) :
|
||||
Frame_unbounded_following(thd, partition_list, order_list){}
|
||||
Frame_unbounded_following(thd, partition_list, order_list) {}
|
||||
|
||||
void next_partition(ha_rows rownum)
|
||||
{
|
||||
|
@ -1747,9 +1744,7 @@ public:
|
|||
|
||||
/* Walk to the end of the partition, find how many rows there are. */
|
||||
while (!cursor.next())
|
||||
{
|
||||
num_rows_in_partition++;
|
||||
}
|
||||
|
||||
List_iterator_fast<Item_sum> it(sum_functions);
|
||||
Item_sum* item;
|
||||
|
@ -1773,7 +1768,7 @@ class Frame_unbounded_following_set_count_special: public Frame_unbounded_follow
|
|||
public:
|
||||
Frame_unbounded_following_set_count_special(THD *thd,
|
||||
SQL_I_List<ORDER> *partition_list,
|
||||
SQL_I_List<ORDER> *order_list, Item* arg) :
|
||||
SQL_I_List<ORDER> *order_list, Item* arg) :
|
||||
Frame_unbounded_following_set_count(thd,partition_list, order_list)
|
||||
{
|
||||
order_item= order_list->first->item[0];
|
||||
|
@ -1805,6 +1800,7 @@ public:
|
|||
{
|
||||
return cursor.get_rownum();
|
||||
}
|
||||
|
||||
private:
|
||||
Item* order_item;
|
||||
};
|
||||
|
|
|
@ -10191,6 +10191,11 @@ geometry_function:
|
|||
Item_func_spatial_precise_rel(thd, $3, $5,
|
||||
Item_func::SP_CONTAINS_FUNC));
|
||||
}
|
||||
| WITHIN '(' expr ',' expr ')'
|
||||
{
|
||||
$$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5,
|
||||
Item_func::SP_WITHIN_FUNC));
|
||||
}
|
||||
| GEOMETRYCOLLECTION '(' expr_list ')'
|
||||
{
|
||||
$$= GEOM_NEW(thd,
|
||||
|
@ -10237,6 +10242,7 @@ geometry_function:
|
|||
Geometry::wkb_polygon,
|
||||
Geometry::wkb_linestring));
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
/*
|
||||
|
@ -10699,45 +10705,45 @@ simple_window_func:
|
|||
;
|
||||
|
||||
inverse_distribution_function:
|
||||
inverse_distribution_function_def WITHIN GROUP_SYM
|
||||
'('
|
||||
{ Select->prepare_add_window_spec(thd); }
|
||||
order_by_single_element_list ')' OVER_SYM
|
||||
'(' opt_window_ref opt_window_partition_clause ')'
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
if (Select->add_window_spec(thd, lex->win_ref,
|
||||
Select->group_list,
|
||||
Select->order_list,
|
||||
NULL))
|
||||
MYSQL_YYABORT;
|
||||
$$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1,
|
||||
thd->lex->win_spec);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
if (Select->add_window_func((Item_window_func *) $$))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
inverse_distribution_function_def WITHIN GROUP_SYM
|
||||
'('
|
||||
{ Select->prepare_add_window_spec(thd); }
|
||||
order_by_single_element_list ')' OVER_SYM
|
||||
'(' opt_window_ref opt_window_partition_clause ')'
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
if (Select->add_window_spec(thd, lex->win_ref,
|
||||
Select->group_list,
|
||||
Select->order_list,
|
||||
NULL))
|
||||
MYSQL_YYABORT;
|
||||
$$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1,
|
||||
thd->lex->win_spec);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
if (Select->add_window_func((Item_window_func *) $$))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
inverse_distribution_function_def:
|
||||
PERCENTILE_CONT_SYM '(' expr ')'
|
||||
{
|
||||
$$= new (thd->mem_root) Item_sum_percentile_cont(thd, $3);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| PERCENTILE_DISC_SYM '(' expr ')'
|
||||
{
|
||||
$$= new (thd->mem_root) Item_sum_percentile_disc(thd, $3);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
PERCENTILE_CONT_SYM '(' expr ')'
|
||||
{
|
||||
$$= new (thd->mem_root) Item_sum_percentile_cont(thd, $3);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| PERCENTILE_DISC_SYM '(' expr ')'
|
||||
{
|
||||
$$= new (thd->mem_root) Item_sum_percentile_disc(thd, $3);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
order_by_single_element_list:
|
||||
ORDER_SYM BY order_list
|
||||
;
|
||||
ORDER_SYM BY order_list
|
||||
;
|
||||
|
||||
window_name:
|
||||
ident
|
||||
|
@ -14628,6 +14634,7 @@ keyword:
|
|||
| UNICODE_SYM {}
|
||||
| UNINSTALL_SYM {}
|
||||
| UNBOUNDED_SYM {}
|
||||
| WITHIN
|
||||
| WRAPPER_SYM {}
|
||||
| XA_SYM {}
|
||||
| UPGRADE_SYM {}
|
||||
|
|
Loading…
Reference in a new issue