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