mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Rename: Item::val -> Item::val_real().
This commit is contained in:
parent
ea97ce50b9
commit
e5f4c7a0bd
24 changed files with 306 additions and 294 deletions
|
@ -707,7 +707,7 @@ static void make_sortkey(register SORTPARAM *param,
|
|||
}
|
||||
case REAL_RESULT:
|
||||
{
|
||||
double value=item->val();
|
||||
double value= item->val_real();
|
||||
if ((maybe_null=item->null_value))
|
||||
{
|
||||
bzero((char*) to,sort_field->length+1);
|
||||
|
|
27
sql/item.cc
27
sql/item.cc
|
@ -711,7 +711,7 @@ String *Item_field::val_str(String *str)
|
|||
return field->val_str(str,&str_value);
|
||||
}
|
||||
|
||||
double Item_field::val()
|
||||
double Item_field::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if ((null_value=field->is_null()))
|
||||
|
@ -904,7 +904,7 @@ void Item_string::print(String *str)
|
|||
|
||||
bool Item_null::eq(const Item *item, bool binary_cmp) const
|
||||
{ return item->type() == type(); }
|
||||
double Item_null::val()
|
||||
double Item_null::val_real()
|
||||
{
|
||||
// following assert is redundant, because fixed=1 assigned in constructor
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
@ -1221,7 +1221,7 @@ bool Item_param::get_date(TIME *res, uint fuzzydate)
|
|||
}
|
||||
|
||||
|
||||
double Item_param::val()
|
||||
double Item_param::val_real()
|
||||
{
|
||||
switch (state) {
|
||||
case REAL_VALUE:
|
||||
|
@ -1469,7 +1469,7 @@ bool Item::fix_fields(THD *thd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
double Item_ref_null_helper::val()
|
||||
double Item_ref_null_helper::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double tmp= (*ref)->val_result();
|
||||
|
@ -2385,7 +2385,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
|
|||
}
|
||||
else if (result_type() == REAL_RESULT)
|
||||
{
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return set_field_to_null(field);
|
||||
field->set_notnull();
|
||||
|
@ -2467,7 +2467,7 @@ Item_real::Item_real(const char *str_arg, uint length)
|
|||
|
||||
int Item_real::save_in_field(Field *field, bool no_conversions)
|
||||
{
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return set_field_to_null(field);
|
||||
field->set_notnull();
|
||||
|
@ -2629,15 +2629,14 @@ bool Item::send(Protocol *protocol, String *buffer)
|
|||
case MYSQL_TYPE_FLOAT:
|
||||
{
|
||||
float nr;
|
||||
nr= (float) val();
|
||||
nr= (float) val_real();
|
||||
if (!null_value)
|
||||
result= protocol->store(nr, decimals, buffer);
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
{
|
||||
double nr;
|
||||
nr= val();
|
||||
double nr= val_real();
|
||||
if (!null_value)
|
||||
result= protocol->store(nr, decimals, buffer);
|
||||
break;
|
||||
|
@ -2961,7 +2960,7 @@ double Item_ref::val_result()
|
|||
return 0.0;
|
||||
return result_field->val_real();
|
||||
}
|
||||
return val();
|
||||
return val_real();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3263,7 +3262,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||
}
|
||||
else
|
||||
{ // It must REAL_RESULT
|
||||
double result=item->val();
|
||||
double result= item->val_real();
|
||||
uint length=item->max_length,decimals=item->decimals;
|
||||
bool null_value=item->null_value;
|
||||
new_item= (null_value ? (Item*) new Item_null(name) : (Item*)
|
||||
|
@ -3298,7 +3297,7 @@ bool field_is_equal_to_item(Field *field,Item *item)
|
|||
}
|
||||
if (res_type == INT_RESULT)
|
||||
return 1; // Both where of type int
|
||||
double result=item->val();
|
||||
double result= item->val_real();
|
||||
if (item->null_value)
|
||||
return 1;
|
||||
return result == field->val_real();
|
||||
|
@ -3371,7 +3370,7 @@ void Item_cache_str::store(Item *item)
|
|||
}
|
||||
|
||||
|
||||
double Item_cache_str::val()
|
||||
double Item_cache_str::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
int err;
|
||||
|
@ -3639,7 +3638,7 @@ uint32 Item_type_holder::real_length(Item *item)
|
|||
}
|
||||
}
|
||||
|
||||
double Item_type_holder::val()
|
||||
double Item_type_holder::val_real()
|
||||
{
|
||||
DBUG_ASSERT(0); // should never be called
|
||||
return 0.0;
|
||||
|
|
40
sql/item.h
40
sql/item.h
|
@ -186,7 +186,7 @@ public:
|
|||
virtual enum_field_types field_type() const;
|
||||
virtual enum Type type() const =0;
|
||||
/* valXXX methods must return NULL or 0 or 0.0 if null_value is set. */
|
||||
virtual double val()=0;
|
||||
virtual double val_real()=0;
|
||||
virtual longlong val_int()=0;
|
||||
/*
|
||||
Return string representation of this item object.
|
||||
|
@ -217,7 +217,7 @@ public:
|
|||
virtual Field *get_tmp_table_field() { return 0; }
|
||||
virtual Field *tmp_table_field(TABLE *t_arg) { return 0; }
|
||||
virtual const char *full_name() const { return name ? name : "???"; }
|
||||
virtual double val_result() { return val(); }
|
||||
virtual double val_result() { return val_real(); }
|
||||
virtual longlong val_int_result() { return val_int(); }
|
||||
virtual String *str_result(String* tmp) { return val_str(tmp); }
|
||||
/* bit map of tables used by item */
|
||||
|
@ -362,10 +362,10 @@ public:
|
|||
// the item in the frame
|
||||
enum Type type() const;
|
||||
|
||||
inline double val()
|
||||
inline double val_real()
|
||||
{
|
||||
Item *it= this_item();
|
||||
double ret= it->val();
|
||||
double ret= it->val_real();
|
||||
Item::null_value= it->null_value;
|
||||
return ret;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ public:
|
|||
Item_field(Field *field);
|
||||
enum Type type() const { return FIELD_ITEM; }
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String*);
|
||||
double val_result();
|
||||
|
@ -580,7 +580,7 @@ public:
|
|||
}
|
||||
enum Type type() const { return NULL_ITEM; }
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
|
@ -669,7 +669,7 @@ public:
|
|||
enum Type type() const { return item_type; }
|
||||
enum_field_types field_type() const { return param_type; }
|
||||
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String*);
|
||||
bool get_time(TIME *tm);
|
||||
|
@ -726,7 +726,7 @@ public:
|
|||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
String *val_str(String*);
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
bool basic_const_item() const { return 1; }
|
||||
|
@ -755,7 +755,7 @@ public:
|
|||
Item_uint(const char *str_arg, uint length);
|
||||
Item_uint(uint32 i) :Item_int((longlong) i, 10)
|
||||
{ unsigned_flag= 1; }
|
||||
double val()
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
|
||||
String *val_str(String*);
|
||||
Item *new_item() { return new Item_uint(name,max_length); }
|
||||
|
@ -784,7 +784,7 @@ public:
|
|||
int save_in_field(Field *field, bool no_conversions);
|
||||
enum Type type() const { return REAL_ITEM; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
longlong val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
@ -855,7 +855,7 @@ public:
|
|||
fixed= 1;
|
||||
}
|
||||
enum Type type() const { return STRING_ITEM; }
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
int err;
|
||||
|
@ -945,7 +945,7 @@ class Item_varbinary :public Item
|
|||
public:
|
||||
Item_varbinary(const char *str,uint str_length);
|
||||
enum Type type() const { return VARBIN_ITEM; }
|
||||
double val()
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_varbinary::val_int(); }
|
||||
longlong val_int();
|
||||
bool basic_const_item() const { return 1; }
|
||||
|
@ -997,7 +997,7 @@ public:
|
|||
enum Type type() const { return REF_ITEM; }
|
||||
bool eq(const Item *item, bool binary_cmp) const
|
||||
{ return ref && (*ref)->eq(item, binary_cmp); }
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
double tmp=(*ref)->val_result();
|
||||
null_value=(*ref)->null_value;
|
||||
|
@ -1062,7 +1062,7 @@ public:
|
|||
Item_ref_null_helper(Item_in_subselect* master, Item **item,
|
||||
const char *table_name_par, const char *field_name_par):
|
||||
Item_ref(item, table_name_par, field_name_par), owner(master) {}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String* val_str(String* s);
|
||||
bool get_date(TIME *ltime, uint fuzzydate);
|
||||
|
@ -1130,7 +1130,7 @@ public:
|
|||
enum Type type() const { return COPY_STR_ITEM; }
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return cached_field_type; }
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
int err;
|
||||
return (null_value ? 0.0 :
|
||||
|
@ -1358,7 +1358,7 @@ public:
|
|||
Item_cache_int(): Item_cache() {}
|
||||
|
||||
void store(Item *item);
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
String* val_str(String *str)
|
||||
{
|
||||
|
@ -1376,7 +1376,7 @@ public:
|
|||
Item_cache_real(): Item_cache() {}
|
||||
|
||||
void store(Item *item);
|
||||
double val() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
longlong val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
@ -1398,7 +1398,7 @@ public:
|
|||
Item_cache_str(): Item_cache() { }
|
||||
|
||||
void store(Item *item);
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String* val_str(String *) { DBUG_ASSERT(fixed == 1); return value; }
|
||||
enum Item_result result_type() const { return STRING_RESULT; }
|
||||
|
@ -1430,7 +1430,7 @@ public:
|
|||
{
|
||||
illegal_method_call((const char*)"make_field");
|
||||
};
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
illegal_method_call((const char*)"val");
|
||||
return 0;
|
||||
|
@ -1481,7 +1481,7 @@ public:
|
|||
|
||||
Item_result result_type () const { return item_type; }
|
||||
enum Type type() const { return TYPE_HOLDER; }
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String*);
|
||||
bool join_types(THD *thd, Item *);
|
||||
|
|
|
@ -70,7 +70,7 @@ Item_str_buff::~Item_str_buff()
|
|||
|
||||
bool Item_real_buff::cmp(void)
|
||||
{
|
||||
double nr=item->val();
|
||||
double nr= item->val_real();
|
||||
if (null_value != item->null_value || nr != value)
|
||||
{
|
||||
null_value= item->null_value;
|
||||
|
|
|
@ -104,7 +104,7 @@ Item_bool_func2* Le_creator::create(Item *a, Item *b) const
|
|||
longlong Item_func_not::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return !null_value && value == 0 ? 1 : 0;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ longlong Item_func_not::val_int()
|
|||
longlong Item_func_not_all::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value= args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if (abort_on_null)
|
||||
{
|
||||
null_value= 0;
|
||||
|
@ -384,10 +384,10 @@ int Arg_comparator::compare_e_binary_string()
|
|||
|
||||
int Arg_comparator::compare_real()
|
||||
{
|
||||
double val1= (*a)->val();
|
||||
double val1= (*a)->val_real();
|
||||
if (!(*a)->null_value)
|
||||
{
|
||||
double val2= (*b)->val();
|
||||
double val2= (*b)->val_real();
|
||||
if (!(*b)->null_value)
|
||||
{
|
||||
owner->null_value= 0;
|
||||
|
@ -402,8 +402,8 @@ int Arg_comparator::compare_real()
|
|||
|
||||
int Arg_comparator::compare_e_real()
|
||||
{
|
||||
double val1= (*a)->val();
|
||||
double val2= (*b)->val();
|
||||
double val1= (*a)->val_real();
|
||||
double val2= (*b)->val_real();
|
||||
if ((*a)->null_value || (*b)->null_value)
|
||||
return test((*a)->null_value && (*b)->null_value);
|
||||
return test(val1 == val2);
|
||||
|
@ -754,7 +754,7 @@ void Item_func_interval::fix_length_and_dec()
|
|||
(intervals=(double*) sql_alloc(sizeof(double)*(row->cols()-1))))
|
||||
{
|
||||
for (uint i=1 ; i < row->cols(); i++)
|
||||
intervals[i-1]=row->el(i)->val();
|
||||
intervals[i-1]= row->el(i)->val_real();
|
||||
}
|
||||
}
|
||||
maybe_null= 0;
|
||||
|
@ -776,7 +776,7 @@ void Item_func_interval::fix_length_and_dec()
|
|||
longlong Item_func_interval::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value= row->el(0)->val();
|
||||
double value= row->el(0)->val_real();
|
||||
uint i;
|
||||
|
||||
if (row->el(0)->null_value)
|
||||
|
@ -799,7 +799,7 @@ longlong Item_func_interval::val_int()
|
|||
|
||||
for (i=1 ; i < row->cols() ; i++)
|
||||
{
|
||||
if (row->el(i)->val() > value)
|
||||
if (row->el(i)->val_real() > value)
|
||||
return i-1;
|
||||
}
|
||||
return i-1;
|
||||
|
@ -873,7 +873,7 @@ longlong Item_func_between::val_int()
|
|||
}
|
||||
else if (cmp_type == INT_RESULT)
|
||||
{
|
||||
longlong value=args[0]->val_int(),a,b;
|
||||
longlong value=args[0]->val_int(), a, b;
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
a=args[1]->val_int();
|
||||
|
@ -893,11 +893,11 @@ longlong Item_func_between::val_int()
|
|||
}
|
||||
else
|
||||
{
|
||||
double value=args[0]->val(),a,b;
|
||||
double value= args[0]->val_real(),a,b;
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
a=args[1]->val();
|
||||
b=args[2]->val();
|
||||
a= args[1]->val_real();
|
||||
b= args[2]->val_real();
|
||||
if (!args[1]->null_value && !args[2]->null_value)
|
||||
return (value >= a && value <= b) ? 1 : 0;
|
||||
if (args[1]->null_value && args[2]->null_value)
|
||||
|
@ -954,16 +954,16 @@ Field *Item_func_ifnull::tmp_table_field(TABLE *table)
|
|||
}
|
||||
|
||||
double
|
||||
Item_func_ifnull::val()
|
||||
Item_func_ifnull::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
null_value=0;
|
||||
return value;
|
||||
}
|
||||
value=args[1]->val();
|
||||
value= args[1]->val_real();
|
||||
if ((null_value=args[1]->null_value))
|
||||
return 0.0;
|
||||
return value;
|
||||
|
@ -1042,11 +1042,11 @@ Item_func_if::fix_length_and_dec()
|
|||
|
||||
|
||||
double
|
||||
Item_func_if::val()
|
||||
Item_func_if::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
Item *arg= args[0]->val_int() ? args[1] : args[2];
|
||||
double value=arg->val();
|
||||
double value= arg->val_real();
|
||||
null_value=arg->null_value;
|
||||
return value;
|
||||
}
|
||||
|
@ -1095,7 +1095,7 @@ Item_func_nullif::fix_length_and_dec()
|
|||
*/
|
||||
|
||||
double
|
||||
Item_func_nullif::val()
|
||||
Item_func_nullif::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value;
|
||||
|
@ -1104,7 +1104,7 @@ Item_func_nullif::val()
|
|||
null_value=1;
|
||||
return 0.0;
|
||||
}
|
||||
value=args[0]->val();
|
||||
value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return value;
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ Item *Item_func_case::find_item(String *str)
|
|||
return else_expr_num != -1 ? args[else_expr_num] : 0;
|
||||
break;
|
||||
case REAL_RESULT:
|
||||
first_expr_real= args[first_expr_num]->val();
|
||||
first_expr_real= args[first_expr_num]->val_real();
|
||||
if (args[first_expr_num]->null_value)
|
||||
return else_expr_num != -1 ? args[else_expr_num] : 0;
|
||||
break;
|
||||
|
@ -1212,7 +1212,7 @@ Item *Item_func_case::find_item(String *str)
|
|||
return args[i+1];
|
||||
break;
|
||||
case REAL_RESULT:
|
||||
if (args[i]->val()==first_expr_real && !args[i]->null_value)
|
||||
if (args[i]->val_real() == first_expr_real && !args[i]->null_value)
|
||||
return args[i+1];
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
|
@ -1264,7 +1264,7 @@ longlong Item_func_case::val_int()
|
|||
return res;
|
||||
}
|
||||
|
||||
double Item_func_case::val()
|
||||
double Item_func_case::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
|
@ -1277,7 +1277,7 @@ double Item_func_case::val()
|
|||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
res=item->val();
|
||||
res= item->val_real();
|
||||
null_value=item->null_value;
|
||||
return res;
|
||||
}
|
||||
|
@ -1400,13 +1400,13 @@ longlong Item_func_coalesce::val_int()
|
|||
return 0;
|
||||
}
|
||||
|
||||
double Item_func_coalesce::val()
|
||||
double Item_func_coalesce::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
null_value=0;
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
double res=args[i]->val();
|
||||
double res= args[i]->val_real();
|
||||
if (!args[i]->null_value)
|
||||
return res;
|
||||
}
|
||||
|
@ -1559,12 +1559,12 @@ in_double::in_double(uint elements)
|
|||
|
||||
void in_double::set(uint pos,Item *item)
|
||||
{
|
||||
((double*) base)[pos]=item->val();
|
||||
((double*) base)[pos]= item->val_real();
|
||||
}
|
||||
|
||||
byte *in_double::get_value(Item *item)
|
||||
{
|
||||
tmp= item->val();
|
||||
tmp= item->val_real();
|
||||
if (item->null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
return (byte*) &tmp;
|
||||
|
|
|
@ -420,7 +420,7 @@ public:
|
|||
Item_func_ifnull(Item *a,Item *b)
|
||||
:Item_func(a,b), cached_result_type(INT_RESULT)
|
||||
{}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return cached_result_type; }
|
||||
|
@ -439,7 +439,7 @@ public:
|
|||
Item_func_if(Item *a,Item *b,Item *c)
|
||||
:Item_func(a,b,c), cached_result_type(INT_RESULT)
|
||||
{}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return cached_result_type; }
|
||||
|
@ -462,7 +462,7 @@ public:
|
|||
Item_func_nullif(Item *a,Item *b)
|
||||
:Item_bool_func2(a,b), cached_result_type(INT_RESULT)
|
||||
{}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return cached_result_type; }
|
||||
|
@ -481,7 +481,7 @@ public:
|
|||
Item_func_coalesce(List<Item> &list)
|
||||
:Item_func(list),cached_result_type(INT_RESULT)
|
||||
{}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
|
@ -517,7 +517,7 @@ public:
|
|||
}
|
||||
set_arguments(list);
|
||||
}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
|
@ -674,11 +674,11 @@ class cmp_item_real :public cmp_item
|
|||
public:
|
||||
void store_value(Item *item)
|
||||
{
|
||||
value= item->val();
|
||||
value= item->val_real();
|
||||
}
|
||||
int cmp(Item *arg)
|
||||
{
|
||||
return value != arg->val();
|
||||
return value != arg->val_real();
|
||||
}
|
||||
int compare(cmp_item *c)
|
||||
{
|
||||
|
|
150
sql/item_func.cc
150
sql/item_func.cc
|
@ -516,7 +516,7 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
|
|||
String *Item_real_func::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set(nr,decimals, &my_charset_bin);
|
||||
|
@ -539,7 +539,7 @@ String *Item_num_func::val_str(String *str)
|
|||
}
|
||||
else
|
||||
{
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set(nr,decimals,&my_charset_bin);
|
||||
|
@ -616,7 +616,7 @@ String *Item_num_op::val_str(String *str)
|
|||
}
|
||||
else
|
||||
{
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set(nr,decimals,&my_charset_bin);
|
||||
|
@ -643,10 +643,10 @@ void Item_func_unsigned::print(String *str)
|
|||
}
|
||||
|
||||
|
||||
double Item_func_plus::val()
|
||||
double Item_func_plus::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val()+args[1]->val();
|
||||
double value= args[0]->val_real() + args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return value;
|
||||
|
@ -662,7 +662,7 @@ longlong Item_func_plus::val_int()
|
|||
return 0;
|
||||
return value;
|
||||
}
|
||||
return (longlong) Item_func_plus::val();
|
||||
return (longlong) Item_func_plus::val_real();
|
||||
}
|
||||
|
||||
|
||||
|
@ -680,10 +680,10 @@ void Item_func_minus::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_minus::val()
|
||||
double Item_func_minus::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val() - args[1]->val();
|
||||
double value= args[0]->val_real() - args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return value;
|
||||
|
@ -699,14 +699,14 @@ longlong Item_func_minus::val_int()
|
|||
return 0;
|
||||
return value;
|
||||
}
|
||||
return (longlong) Item_func_minus::val();
|
||||
return (longlong) Item_func_minus::val_real();
|
||||
}
|
||||
|
||||
|
||||
double Item_func_mul::val()
|
||||
double Item_func_mul::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val()*args[1]->val();
|
||||
double value= args[0]->val_real() * args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return value;
|
||||
|
@ -722,15 +722,15 @@ longlong Item_func_mul::val_int()
|
|||
return 0; /* purecov: inspected */
|
||||
return value;
|
||||
}
|
||||
return (longlong) Item_func_mul::val();
|
||||
return (longlong) Item_func_mul::val_real();
|
||||
}
|
||||
|
||||
|
||||
double Item_func_div::val()
|
||||
double Item_func_div::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double val2=args[1]->val();
|
||||
double value= args[0]->val_real();
|
||||
double val2= args[1]->val_real();
|
||||
if ((null_value= args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
if (val2 == 0.0)
|
||||
|
@ -758,7 +758,7 @@ longlong Item_func_div::val_int()
|
|||
}
|
||||
return value/val2;
|
||||
}
|
||||
return (longlong) Item_func_div::val();
|
||||
return (longlong) Item_func_div::val_real();
|
||||
}
|
||||
|
||||
|
||||
|
@ -800,11 +800,11 @@ void Item_func_int_div::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_mod::val()
|
||||
double Item_func_mod::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value= args[0]->val();
|
||||
double val2= args[1]->val();
|
||||
double value= args[0]->val_real();
|
||||
double val2= args[1]->val_real();
|
||||
if ((null_value= args[0]->null_value || args[1]->null_value))
|
||||
return 0.0; /* purecov: inspected */
|
||||
if (val2 == 0.0)
|
||||
|
@ -836,10 +836,10 @@ void Item_func_mod::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_neg::val()
|
||||
double Item_func_neg::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return -value;
|
||||
}
|
||||
|
@ -879,10 +879,10 @@ void Item_func_neg::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_abs::val()
|
||||
double Item_func_abs::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return fabs(value);
|
||||
}
|
||||
|
@ -911,10 +911,10 @@ void Item_func_abs::fix_length_and_dec()
|
|||
|
||||
|
||||
/* Gateway to natural LOG function */
|
||||
double Item_func_ln::val()
|
||||
double Item_func_ln::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || value <= 0.0)))
|
||||
return 0.0;
|
||||
return log(value);
|
||||
|
@ -925,15 +925,15 @@ double Item_func_ln::val()
|
|||
We have to check if all values are > zero and first one is not one
|
||||
as these are the cases then result is not a number.
|
||||
*/
|
||||
double Item_func_log::val()
|
||||
double Item_func_log::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || value <= 0.0)))
|
||||
return 0.0;
|
||||
if (arg_count == 2)
|
||||
{
|
||||
double value2= args[1]->val();
|
||||
double value2= args[1]->val_real();
|
||||
if ((null_value=(args[1]->null_value || value2 <= 0.0 || value == 1.0)))
|
||||
return 0.0;
|
||||
return log(value2) / log(value);
|
||||
|
@ -941,47 +941,47 @@ double Item_func_log::val()
|
|||
return log(value);
|
||||
}
|
||||
|
||||
double Item_func_log2::val()
|
||||
double Item_func_log2::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || value <= 0.0)))
|
||||
return 0.0;
|
||||
return log(value) / M_LN2;
|
||||
}
|
||||
|
||||
double Item_func_log10::val()
|
||||
double Item_func_log10::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || value <= 0.0)))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return log10(value);
|
||||
}
|
||||
|
||||
double Item_func_exp::val()
|
||||
double Item_func_exp::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return exp(value);
|
||||
}
|
||||
|
||||
double Item_func_sqrt::val()
|
||||
double Item_func_sqrt::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || value < 0)))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return sqrt(value);
|
||||
}
|
||||
|
||||
double Item_func_pow::val()
|
||||
double Item_func_pow::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double val2=args[1]->val();
|
||||
double value= args[0]->val_real();
|
||||
double val2= args[1]->val_real();
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return pow(value,val2);
|
||||
|
@ -989,35 +989,35 @@ double Item_func_pow::val()
|
|||
|
||||
// Trigonometric functions
|
||||
|
||||
double Item_func_acos::val()
|
||||
double Item_func_acos::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
// the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug)
|
||||
volatile double value=args[0]->val();
|
||||
volatile double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
|
||||
return 0.0;
|
||||
return fix_result(acos(value));
|
||||
}
|
||||
|
||||
double Item_func_asin::val()
|
||||
double Item_func_asin::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
// the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug)
|
||||
volatile double value=args[0]->val();
|
||||
volatile double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
|
||||
return 0.0;
|
||||
return fix_result(asin(value));
|
||||
}
|
||||
|
||||
double Item_func_atan::val()
|
||||
double Item_func_atan::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
if (arg_count == 2)
|
||||
{
|
||||
double val2= args[1]->val();
|
||||
double val2= args[1]->val_real();
|
||||
if ((null_value=args[1]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(atan2(value,val2));
|
||||
|
@ -1025,28 +1025,28 @@ double Item_func_atan::val()
|
|||
return fix_result(atan(value));
|
||||
}
|
||||
|
||||
double Item_func_cos::val()
|
||||
double Item_func_cos::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(cos(value));
|
||||
}
|
||||
|
||||
double Item_func_sin::val()
|
||||
double Item_func_sin::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(sin(value));
|
||||
}
|
||||
|
||||
double Item_func_tan::val()
|
||||
double Item_func_tan::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(tan(value));
|
||||
|
@ -1110,7 +1110,7 @@ void Item_func_integer::fix_length_and_dec()
|
|||
longlong Item_func_ceiling::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return (longlong) ceil(value);
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ longlong Item_func_floor::val_int()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
// the volatile's for BUG #3051 to calm optimizer down (because of gcc's bug)
|
||||
volatile double value=args[0]->val();
|
||||
volatile double value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return (longlong) floor(value);
|
||||
}
|
||||
|
@ -1138,10 +1138,10 @@ void Item_func_round::fix_length_and_dec()
|
|||
}
|
||||
}
|
||||
|
||||
double Item_func_round::val()
|
||||
double Item_func_round::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
int dec=(int) args[1]->val_int();
|
||||
uint abs_dec=abs(dec);
|
||||
double tmp;
|
||||
|
@ -1224,7 +1224,7 @@ void Item_func_rand::update_used_tables()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_rand::val()
|
||||
double Item_func_rand::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return my_rnd(rand);
|
||||
|
@ -1233,16 +1233,16 @@ double Item_func_rand::val()
|
|||
longlong Item_func_sign::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
null_value=args[0]->null_value;
|
||||
return value < 0.0 ? -1 : (value > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
double Item_func_units::val()
|
||||
double Item_func_units::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=args[0]->val();
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0;
|
||||
return value*mul+add;
|
||||
|
@ -1288,7 +1288,7 @@ String *Item_func_min_max::val_str(String *str)
|
|||
}
|
||||
case REAL_RESULT:
|
||||
{
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set(nr,decimals,&my_charset_bin);
|
||||
|
@ -1332,7 +1332,7 @@ String *Item_func_min_max::val_str(String *str)
|
|||
}
|
||||
|
||||
|
||||
double Item_func_min_max::val()
|
||||
double Item_func_min_max::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value=0.0;
|
||||
|
@ -1341,12 +1341,12 @@ double Item_func_min_max::val()
|
|||
{
|
||||
if (null_value)
|
||||
{
|
||||
value=args[i]->val();
|
||||
value= args[i]->val_real();
|
||||
null_value=args[i]->null_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
double tmp=args[i]->val();
|
||||
double tmp= args[i]->val_real();
|
||||
if (!args[i]->null_value && (tmp < value ? cmp_sign : -cmp_sign) > 0)
|
||||
value=tmp;
|
||||
}
|
||||
|
@ -1502,10 +1502,10 @@ longlong Item_func_field::val_int()
|
|||
}
|
||||
else
|
||||
{
|
||||
double val= args[0]->val();
|
||||
double val= args[0]->val_real();
|
||||
for (uint i=1; i < arg_count ; i++)
|
||||
{
|
||||
if (val == args[i]->val())
|
||||
if (val == args[i]->val_real())
|
||||
return (longlong) (i);
|
||||
}
|
||||
}
|
||||
|
@ -1818,7 +1818,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
}
|
||||
break;
|
||||
case Item::REAL_ITEM:
|
||||
*((double*) to) = arguments[i]->val();
|
||||
*((double*) to)= arguments[i]->val_real();
|
||||
if (!arguments[i]->null_value)
|
||||
{
|
||||
f_args.args[i]=to;
|
||||
|
@ -1885,7 +1885,7 @@ bool udf_handler::get_arguments()
|
|||
}
|
||||
break;
|
||||
case REAL_RESULT:
|
||||
*((double*) to) = args[i]->val();
|
||||
*((double*) to)= args[i]->val_real();
|
||||
if (!args[i]->null_value)
|
||||
{
|
||||
f_args.args[i]=to;
|
||||
|
@ -1940,7 +1940,7 @@ String *udf_handler::val_str(String *str,String *save_str)
|
|||
|
||||
|
||||
|
||||
double Item_func_udf_float::val()
|
||||
double Item_func_udf_float::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
DBUG_ENTER("Item_func_udf_float::val");
|
||||
|
@ -1953,7 +1953,7 @@ double Item_func_udf_float::val()
|
|||
String *Item_func_udf_float::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set(nr,decimals,&my_charset_bin);
|
||||
|
@ -2374,7 +2374,7 @@ longlong Item_func_benchmark::val_int()
|
|||
{
|
||||
switch (args[0]->result_type()) {
|
||||
case REAL_RESULT:
|
||||
(void) args[0]->val();
|
||||
(void) args[0]->val_real();
|
||||
break;
|
||||
case INT_RESULT:
|
||||
(void) args[0]->val_int();
|
||||
|
@ -2658,7 +2658,7 @@ Item_func_set_user_var::check()
|
|||
switch (cached_result_type) {
|
||||
case REAL_RESULT:
|
||||
{
|
||||
save_result.vreal= args[0]->val();
|
||||
save_result.vreal= args[0]->val_real();
|
||||
break;
|
||||
}
|
||||
case INT_RESULT:
|
||||
|
@ -2739,7 +2739,7 @@ Item_func_set_user_var::update()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_set_user_var::val()
|
||||
double Item_func_set_user_var::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
check();
|
||||
|
@ -2795,7 +2795,7 @@ Item_func_get_user_var::val_str(String *str)
|
|||
}
|
||||
|
||||
|
||||
double Item_func_get_user_var::val()
|
||||
double Item_func_get_user_var::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (!var_entry)
|
||||
|
@ -3266,7 +3266,7 @@ bool Item_func_match::eq(const Item *item, bool binary_cmp) const
|
|||
}
|
||||
|
||||
|
||||
double Item_func_match::val()
|
||||
double Item_func_match::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
DBUG_ENTER("Item_func_match::val");
|
||||
|
|
|
@ -165,7 +165,8 @@ public:
|
|||
Item_real_func(Item *a,Item *b) :Item_func(a,b) {}
|
||||
Item_real_func(List<Item> &list) :Item_func(list) {}
|
||||
String *val_str(String*str);
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return (longlong) val(); }
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return (longlong) val_real(); }
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
|
||||
};
|
||||
|
@ -179,10 +180,11 @@ public:
|
|||
Item_num_func(Item *a) :Item_func(a),hybrid_type(REAL_RESULT) {}
|
||||
Item_num_func(Item *a,Item *b) :Item_func(a,b),hybrid_type(REAL_RESULT) {}
|
||||
String *val_str(String*str);
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return (longlong) val(); }
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return (longlong) val_real(); }
|
||||
enum Item_result result_type () const { return hybrid_type; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
bool is_null() { (void) val(); return null_value; }
|
||||
bool is_null() { (void) val_real(); return null_value; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -197,7 +199,7 @@ class Item_num_op :public Item_func
|
|||
enum Item_result result_type () const { return hybrid_type; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); }
|
||||
void find_num_type(void);
|
||||
bool is_null() { (void) val(); return null_value; }
|
||||
bool is_null() { (void) val_real(); return null_value; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -210,7 +212,7 @@ public:
|
|||
Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { max_length=21; }
|
||||
Item_int_func(List<Item> &list) :Item_func(list) { max_length=21; }
|
||||
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String*str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
void fix_length_and_dec() {}
|
||||
|
@ -222,9 +224,9 @@ class Item_func_signed :public Item_int_func
|
|||
public:
|
||||
Item_func_signed(Item *a) :Item_int_func(a) {}
|
||||
const char *func_name() const { return "cast_as_signed"; }
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
double tmp= args[0]->val();
|
||||
double tmp= args[0]->val_real();
|
||||
null_value= args[0]->null_value;
|
||||
return tmp;
|
||||
}
|
||||
|
@ -256,7 +258,7 @@ class Item_func_plus :public Item_num_op
|
|||
public:
|
||||
Item_func_plus(Item *a,Item *b) :Item_num_op(a,b) {}
|
||||
const char *func_name() const { return "+"; }
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
};
|
||||
|
||||
|
@ -265,7 +267,7 @@ class Item_func_minus :public Item_num_op
|
|||
public:
|
||||
Item_func_minus(Item *a,Item *b) :Item_num_op(a,b) {}
|
||||
const char *func_name() const { return "-"; }
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
|
@ -276,7 +278,7 @@ class Item_func_mul :public Item_num_op
|
|||
public:
|
||||
Item_func_mul(Item *a,Item *b) :Item_num_op(a,b) {}
|
||||
const char *func_name() const { return "*"; }
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
};
|
||||
|
||||
|
@ -285,7 +287,7 @@ class Item_func_div :public Item_num_op
|
|||
{
|
||||
public:
|
||||
Item_func_div(Item *a,Item *b) :Item_num_op(a,b) {}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "/"; }
|
||||
void fix_length_and_dec();
|
||||
|
@ -297,7 +299,7 @@ class Item_func_int_div :public Item_num_op
|
|||
public:
|
||||
Item_func_int_div(Item *a,Item *b) :Item_num_op(a,b)
|
||||
{ hybrid_type=INT_RESULT; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "DIV"; }
|
||||
void fix_length_and_dec();
|
||||
|
@ -308,7 +310,7 @@ class Item_func_mod :public Item_num_op
|
|||
{
|
||||
public:
|
||||
Item_func_mod(Item *a,Item *b) :Item_num_op(a,b) {}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "%"; }
|
||||
void fix_length_and_dec();
|
||||
|
@ -319,7 +321,7 @@ class Item_func_neg :public Item_num_func
|
|||
{
|
||||
public:
|
||||
Item_func_neg(Item *a) :Item_num_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "-"; }
|
||||
void fix_length_and_dec();
|
||||
|
@ -331,7 +333,7 @@ class Item_func_abs :public Item_num_func
|
|||
public:
|
||||
Item_func_abs(Item *a) :Item_num_func(a) {}
|
||||
const char *func_name() const { return "abs"; }
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
enum Item_result result_type () const
|
||||
{ return args[0]->result_type() == INT_RESULT ? INT_RESULT : REAL_RESULT; }
|
||||
|
@ -368,7 +370,7 @@ class Item_func_exp :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_exp(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "exp"; }
|
||||
};
|
||||
|
||||
|
@ -377,7 +379,7 @@ class Item_func_ln :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_ln(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "ln"; }
|
||||
};
|
||||
|
||||
|
@ -387,7 +389,7 @@ class Item_func_log :public Item_dec_func
|
|||
public:
|
||||
Item_func_log(Item *a) :Item_dec_func(a) {}
|
||||
Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "log"; }
|
||||
};
|
||||
|
||||
|
@ -396,7 +398,7 @@ class Item_func_log2 :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_log2(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "log2"; }
|
||||
};
|
||||
|
||||
|
@ -405,7 +407,7 @@ class Item_func_log10 :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_log10(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "log10"; }
|
||||
};
|
||||
|
||||
|
@ -414,7 +416,7 @@ class Item_func_sqrt :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_sqrt(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "sqrt"; }
|
||||
};
|
||||
|
||||
|
@ -423,7 +425,7 @@ class Item_func_pow :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "pow"; }
|
||||
};
|
||||
|
||||
|
@ -432,7 +434,7 @@ class Item_func_acos :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_acos(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "acos"; }
|
||||
};
|
||||
|
||||
|
@ -440,7 +442,7 @@ class Item_func_asin :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_asin(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "asin"; }
|
||||
};
|
||||
|
||||
|
@ -449,7 +451,7 @@ class Item_func_atan :public Item_dec_func
|
|||
public:
|
||||
Item_func_atan(Item *a) :Item_dec_func(a) {}
|
||||
Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "atan"; }
|
||||
};
|
||||
|
||||
|
@ -457,7 +459,7 @@ class Item_func_cos :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_cos(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "cos"; }
|
||||
};
|
||||
|
||||
|
@ -465,7 +467,7 @@ class Item_func_sin :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_sin(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "sin"; }
|
||||
};
|
||||
|
||||
|
@ -473,7 +475,7 @@ class Item_func_tan :public Item_dec_func
|
|||
{
|
||||
public:
|
||||
Item_func_tan(Item *a) :Item_dec_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "tan"; }
|
||||
};
|
||||
|
||||
|
@ -511,7 +513,7 @@ public:
|
|||
Item_func_round(Item *a,Item *b,bool trunc_arg)
|
||||
:Item_real_func(a,b),truncate(trunc_arg) {}
|
||||
const char *func_name() const { return truncate ? "truncate" : "round"; }
|
||||
double val();
|
||||
double val_real();
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
|
||||
|
@ -522,7 +524,7 @@ class Item_func_rand :public Item_real_func
|
|||
public:
|
||||
Item_func_rand(Item *a) :Item_real_func(a), rand(0) {}
|
||||
Item_func_rand() :Item_real_func() {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "rand"; }
|
||||
bool const_item() const { return 0; }
|
||||
void update_used_tables();
|
||||
|
@ -546,7 +548,7 @@ class Item_func_units :public Item_real_func
|
|||
public:
|
||||
Item_func_units(char *name_arg,Item *a,double mul_arg,double add_arg)
|
||||
:Item_real_func(a),name(name_arg),mul(mul_arg),add(add_arg) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return name; }
|
||||
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
|
||||
};
|
||||
|
@ -560,7 +562,7 @@ class Item_func_min_max :public Item_func
|
|||
public:
|
||||
Item_func_min_max(List<Item> &list,int cmp_sign_arg) :Item_func(list),
|
||||
cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg) {}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
|
@ -799,8 +801,11 @@ class Item_func_udf_float :public Item_udf_func
|
|||
Item_func_udf_float(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_func(udf_arg,list) {}
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return (longlong) Item_func_udf_float::val(); }
|
||||
double val();
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return (longlong) Item_func_udf_float::val_real();
|
||||
}
|
||||
double val_real();
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
};
|
||||
|
@ -813,7 +818,7 @@ public:
|
|||
Item_func_udf_int(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_func(udf_arg,list) {}
|
||||
longlong val_int();
|
||||
double val() { return (double) Item_func_udf_int::val_int(); }
|
||||
double val_real() { return (double) Item_func_udf_int::val_int(); }
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=21; }
|
||||
|
@ -827,7 +832,7 @@ public:
|
|||
Item_func_udf_str(udf_func *udf_arg, List<Item> &list)
|
||||
:Item_udf_func(udf_arg,list) {}
|
||||
String *val_str(String *);
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
int err;
|
||||
String *res; res=val_str(&str_value);
|
||||
|
@ -850,7 +855,7 @@ class Item_func_udf_float :public Item_real_func
|
|||
public:
|
||||
Item_func_udf_float(udf_func *udf_arg) :Item_real_func() {}
|
||||
Item_func_udf_float(udf_func *udf_arg, List<Item> &list) :Item_real_func(list) {}
|
||||
double val() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -870,7 +875,7 @@ public:
|
|||
Item_func_udf_str(udf_func *udf_arg, List<Item> &list) :Item_func(list) {}
|
||||
String *val_str(String *)
|
||||
{ DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); null_value= 1; return 0.0; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
void fix_length_and_dec() { maybe_null=1; max_length=0; }
|
||||
|
@ -945,7 +950,7 @@ public:
|
|||
Item_func_set_user_var(LEX_STRING a,Item *b)
|
||||
:Item_func(b), cached_result_type(INT_RESULT), name(a)
|
||||
{}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
bool update_hash(void *ptr, uint length, enum Item_result type,
|
||||
|
@ -971,7 +976,7 @@ public:
|
|||
Item_func(), name(a) {}
|
||||
enum Functype functype() const { return GUSERVAR_FUNC; }
|
||||
LEX_STRING get_name() { return name; }
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String* str);
|
||||
void fix_length_and_dec();
|
||||
|
@ -1044,8 +1049,8 @@ public:
|
|||
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref);
|
||||
bool eq(const Item *, bool binary_cmp) const;
|
||||
/* The following should be safe, even if we compare doubles */
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return val()!=0.0; }
|
||||
double val();
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return val_real() != 0.0; }
|
||||
double val_real();
|
||||
void print(String *str);
|
||||
|
||||
bool fix_index();
|
||||
|
@ -1134,10 +1139,10 @@ public:
|
|||
|
||||
longlong val_int()
|
||||
{
|
||||
return (longlong)Item_func_sp::val();
|
||||
return (longlong)Item_func_sp::val_real();
|
||||
}
|
||||
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
Item *it;
|
||||
double d;
|
||||
|
@ -1147,7 +1152,7 @@ public:
|
|||
null_value= 1;
|
||||
return 0.0;
|
||||
}
|
||||
d= it->val();
|
||||
d= it->val_real();
|
||||
null_value= it->null_value;
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -320,8 +320,8 @@ err:
|
|||
String *Item_func_point::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double x= args[0]->val();
|
||||
double y= args[1]->val();
|
||||
double x= args[0]->val_real();
|
||||
double y= args[1]->val_real();
|
||||
|
||||
if ((null_value= (args[0]->null_value ||
|
||||
args[1]->null_value ||
|
||||
|
@ -628,7 +628,7 @@ longlong Item_func_numpoints::val_int()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_x::val()
|
||||
double Item_func_x::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double res= 0.0; // In case of errors
|
||||
|
@ -645,7 +645,7 @@ double Item_func_x::val()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_y::val()
|
||||
double Item_func_y::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double res= 0; // In case of errors
|
||||
|
@ -662,7 +662,7 @@ double Item_func_y::val()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_area::val()
|
||||
double Item_func_area::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double res= 0; // In case of errors
|
||||
|
@ -679,7 +679,7 @@ double Item_func_area::val()
|
|||
return res;
|
||||
}
|
||||
|
||||
double Item_func_glength::val()
|
||||
double Item_func_glength::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double res= 0; // In case of errors
|
||||
|
|
|
@ -263,7 +263,7 @@ class Item_func_x: public Item_real_func
|
|||
String value;
|
||||
public:
|
||||
Item_func_x(Item *a): Item_real_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "x"; }
|
||||
};
|
||||
|
||||
|
@ -273,7 +273,7 @@ class Item_func_y: public Item_real_func
|
|||
String value;
|
||||
public:
|
||||
Item_func_y(Item *a): Item_real_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "y"; }
|
||||
};
|
||||
|
||||
|
@ -316,7 +316,7 @@ class Item_func_area: public Item_real_func
|
|||
String value;
|
||||
public:
|
||||
Item_func_area(Item *a): Item_real_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "area"; }
|
||||
};
|
||||
|
||||
|
@ -326,7 +326,7 @@ class Item_func_glength: public Item_real_func
|
|||
String value;
|
||||
public:
|
||||
Item_func_glength(Item *a): Item_real_func(a) {}
|
||||
double val();
|
||||
double val_real();
|
||||
const char *func_name() const { return "glength"; }
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
{
|
||||
illegal_method_call((const char*)"make_field");
|
||||
};
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
illegal_method_call((const char*)"val");
|
||||
return 0;
|
||||
|
|
|
@ -59,7 +59,7 @@ uint nr_of_decimals(const char *str)
|
|||
return 0;
|
||||
}
|
||||
|
||||
double Item_str_func::val()
|
||||
double Item_str_func::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
int err;
|
||||
|
@ -1629,7 +1629,7 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org)
|
|||
String *Item_func_format::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr =args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
uint32 diff,length,str_length;
|
||||
uint dec;
|
||||
if ((null_value=args[0]->null_value))
|
||||
|
@ -1697,14 +1697,14 @@ void Item_func_elt::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
double Item_func_elt::val()
|
||||
double Item_func_elt::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
uint tmp;
|
||||
null_value=1;
|
||||
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
|
||||
return 0.0;
|
||||
double result= args[tmp]->val();
|
||||
double result= args[tmp]->val_real();
|
||||
null_value= args[tmp]->null_value;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
Item_str_func(Item *a,Item *b,Item *c,Item *d, Item* e) :Item_func(a,b,c,d,e) {decimals=NOT_FIXED_DEC; }
|
||||
Item_str_func(List<Item> &list) :Item_func(list) {decimals=NOT_FIXED_DEC; }
|
||||
longlong val_int();
|
||||
double val();
|
||||
double val_real();
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
void left_right_max_length();
|
||||
};
|
||||
|
@ -377,7 +377,7 @@ class Item_func_elt :public Item_str_func
|
|||
{
|
||||
public:
|
||||
Item_func_elt(List<Item> &list) :Item_str_func(list) {}
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec();
|
||||
|
|
|
@ -441,13 +441,13 @@ void Item_singlerow_subselect::bring_value()
|
|||
exec();
|
||||
}
|
||||
|
||||
double Item_singlerow_subselect::val()
|
||||
double Item_singlerow_subselect::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (!exec() && !value->null_value)
|
||||
{
|
||||
null_value= 0;
|
||||
return value->val();
|
||||
return value->val_real();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -565,7 +565,7 @@ void Item_exists_subselect::fix_length_and_dec()
|
|||
max_columns= engine->cols();
|
||||
}
|
||||
|
||||
double Item_exists_subselect::val()
|
||||
double Item_exists_subselect::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (exec())
|
||||
|
@ -599,7 +599,7 @@ String *Item_exists_subselect::val_str(String *str)
|
|||
return str;
|
||||
}
|
||||
|
||||
double Item_in_subselect::val()
|
||||
double Item_in_subselect::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (exec())
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
void reset();
|
||||
trans_res select_transformer(JOIN *join);
|
||||
void store(uint i, Item* item);
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int ();
|
||||
String *val_str (String *);
|
||||
enum Item_result result_type() const;
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
|
||||
enum Item_result result_type() const { return INT_RESULT;}
|
||||
longlong val_int();
|
||||
double val();
|
||||
double val_real();
|
||||
String *val_str(String*);
|
||||
void fix_length_and_dec();
|
||||
void print(String *str);
|
||||
|
@ -224,7 +224,7 @@ public:
|
|||
Comp_creator *func);
|
||||
trans_res row_value_transformer(JOIN * join);
|
||||
longlong val_int();
|
||||
double val();
|
||||
double val_real();
|
||||
String *val_str(String*);
|
||||
void top_level_item() { abort_on_null=1; }
|
||||
bool test_limit(st_select_lex_unit *unit);
|
||||
|
|
|
@ -143,7 +143,7 @@ String *
|
|||
Item_sum_num::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0;
|
||||
str->set(nr,decimals, &my_charset_bin);
|
||||
|
@ -267,14 +267,14 @@ void Item_sum_sum::clear()
|
|||
|
||||
bool Item_sum_sum::add()
|
||||
{
|
||||
sum+=args[0]->val();
|
||||
sum+= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
null_value= 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
double Item_sum_sum::val()
|
||||
double Item_sum_sum::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return sum;
|
||||
|
@ -359,8 +359,8 @@ void Item_sum_sum_distinct::clear()
|
|||
|
||||
bool Item_sum_sum_distinct::add()
|
||||
{
|
||||
/* args[0]->val() may reset args[0]->null_value */
|
||||
double val= args[0]->val();
|
||||
/* args[0]->val_real() may reset args[0]->null_value */
|
||||
double val= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
DBUG_ASSERT(tree);
|
||||
|
@ -383,7 +383,7 @@ static int sum_sum_distinct(void *element, element_count num_of_dups,
|
|||
|
||||
C_MODE_END
|
||||
|
||||
double Item_sum_sum_distinct::val()
|
||||
double Item_sum_sum_distinct::val_real()
|
||||
{
|
||||
/*
|
||||
We don't have a tree only if 'setup()' hasn't been called;
|
||||
|
@ -456,7 +456,7 @@ void Item_sum_avg::clear()
|
|||
|
||||
bool Item_sum_avg::add()
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
sum+=nr;
|
||||
|
@ -465,7 +465,7 @@ bool Item_sum_avg::add()
|
|||
return 0;
|
||||
}
|
||||
|
||||
double Item_sum_avg::val()
|
||||
double Item_sum_avg::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (!count)
|
||||
|
@ -482,10 +482,10 @@ double Item_sum_avg::val()
|
|||
Standard deviation
|
||||
*/
|
||||
|
||||
double Item_sum_std::val()
|
||||
double Item_sum_std::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double tmp= Item_sum_variance::val();
|
||||
double tmp= Item_sum_variance::val_real();
|
||||
return tmp <= 0.0 ? 0.0 : sqrt(tmp);
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ void Item_sum_variance::clear()
|
|||
|
||||
bool Item_sum_variance::add()
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
sum+=nr;
|
||||
|
@ -523,7 +523,7 @@ bool Item_sum_variance::add()
|
|||
return 0;
|
||||
}
|
||||
|
||||
double Item_sum_variance::val()
|
||||
double Item_sum_variance::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (!count)
|
||||
|
@ -540,7 +540,7 @@ double Item_sum_variance::val()
|
|||
|
||||
void Item_sum_variance::reset_field()
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
char *res=result_field->ptr;
|
||||
|
||||
if (args[0]->null_value)
|
||||
|
@ -565,7 +565,7 @@ void Item_sum_variance::update_field()
|
|||
float8get(old_sqr, res+sizeof(double));
|
||||
field_count=sint8korr(res+sizeof(double)*2);
|
||||
|
||||
nr=args[0]->val();
|
||||
nr= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
old_nr+=nr;
|
||||
|
@ -587,7 +587,7 @@ void Item_sum_hybrid::clear()
|
|||
null_value= 1;
|
||||
}
|
||||
|
||||
double Item_sum_hybrid::val()
|
||||
double Item_sum_hybrid::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
int err;
|
||||
|
@ -620,7 +620,7 @@ longlong Item_sum_hybrid::val_int()
|
|||
return 0;
|
||||
if (hybrid_type == INT_RESULT)
|
||||
return sum_int;
|
||||
return (longlong) Item_sum_hybrid::val();
|
||||
return (longlong) Item_sum_hybrid::val_real();
|
||||
}
|
||||
|
||||
|
||||
|
@ -696,7 +696,7 @@ bool Item_sum_min::add()
|
|||
break;
|
||||
case REAL_RESULT:
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
if (!args[0]->null_value && (null_value || nr < sum))
|
||||
{
|
||||
sum=nr;
|
||||
|
@ -749,7 +749,7 @@ bool Item_sum_max::add()
|
|||
break;
|
||||
case REAL_RESULT:
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
if (!args[0]->null_value && (null_value || nr > sum))
|
||||
{
|
||||
sum=nr;
|
||||
|
@ -829,7 +829,7 @@ bool Item_sum_and::add()
|
|||
|
||||
void Item_sum_num::reset_field()
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
char *res=result_field->ptr;
|
||||
|
||||
if (maybe_null)
|
||||
|
@ -883,7 +883,7 @@ void Item_sum_hybrid::reset_field()
|
|||
}
|
||||
else // REAL_RESULT
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
|
||||
if (maybe_null)
|
||||
{
|
||||
|
@ -902,7 +902,7 @@ void Item_sum_hybrid::reset_field()
|
|||
|
||||
void Item_sum_sum::reset_field()
|
||||
{
|
||||
double nr=args[0]->val(); // Nulls also return 0
|
||||
double nr= args[0]->val_real(); // Nulls also return 0
|
||||
float8store(result_field->ptr,nr);
|
||||
if (args[0]->null_value)
|
||||
result_field->set_null();
|
||||
|
@ -930,7 +930,7 @@ void Item_sum_count::reset_field()
|
|||
|
||||
void Item_sum_avg::reset_field()
|
||||
{
|
||||
double nr=args[0]->val();
|
||||
double nr= args[0]->val_real();
|
||||
char *res=result_field->ptr;
|
||||
|
||||
if (args[0]->null_value)
|
||||
|
@ -968,7 +968,7 @@ void Item_sum_sum::update_field()
|
|||
char *res=result_field->ptr;
|
||||
|
||||
float8get(old_nr,res);
|
||||
nr=args[0]->val();
|
||||
nr= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
old_nr+=nr;
|
||||
|
@ -1005,7 +1005,7 @@ void Item_sum_avg::update_field()
|
|||
float8get(old_nr,res);
|
||||
field_count=sint8korr(res+sizeof(double));
|
||||
|
||||
nr=args[0]->val();
|
||||
nr= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
old_nr+=nr;
|
||||
|
@ -1051,7 +1051,7 @@ Item_sum_hybrid::min_max_update_real_field()
|
|||
double nr,old_nr;
|
||||
|
||||
old_nr=result_field->val_real();
|
||||
nr=args[0]->val();
|
||||
nr= args[0]->val_real();
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
if (result_field->is_null(0) ||
|
||||
|
@ -1103,7 +1103,7 @@ Item_avg_field::Item_avg_field(Item_sum_avg *item)
|
|||
}
|
||||
|
||||
|
||||
double Item_avg_field::val()
|
||||
double Item_avg_field::val_real()
|
||||
{
|
||||
// fix_fields() never calls for this Item
|
||||
double nr;
|
||||
|
@ -1124,7 +1124,7 @@ double Item_avg_field::val()
|
|||
String *Item_avg_field::val_str(String *str)
|
||||
{
|
||||
// fix_fields() never calls for this Item
|
||||
double nr=Item_avg_field::val();
|
||||
double nr= Item_avg_field::val_real();
|
||||
if (null_value)
|
||||
return 0;
|
||||
str->set(nr,decimals, &my_charset_bin);
|
||||
|
@ -1136,10 +1136,10 @@ Item_std_field::Item_std_field(Item_sum_std *item)
|
|||
{
|
||||
}
|
||||
|
||||
double Item_std_field::val()
|
||||
double Item_std_field::val_real()
|
||||
{
|
||||
// fix_fields() never calls for this Item
|
||||
double tmp= Item_variance_field::val();
|
||||
double tmp= Item_variance_field::val_real();
|
||||
return tmp <= 0.0 ? 0.0 : sqrt(tmp);
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ Item_variance_field::Item_variance_field(Item_sum_variance *item)
|
|||
maybe_null=1;
|
||||
}
|
||||
|
||||
double Item_variance_field::val()
|
||||
double Item_variance_field::val_real()
|
||||
{
|
||||
// fix_fields() never calls for this Item
|
||||
double sum,sum_sqr;
|
||||
|
@ -1175,7 +1175,7 @@ double Item_variance_field::val()
|
|||
String *Item_variance_field::val_str(String *str)
|
||||
{
|
||||
// fix_fields() never calls for this Item
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0;
|
||||
str->set(nr,decimals, &my_charset_bin);
|
||||
|
@ -1553,7 +1553,7 @@ Item *Item_sum_udf_float::copy_or_same(THD* thd)
|
|||
return new (thd->mem_root) Item_sum_udf_float(thd, this);
|
||||
}
|
||||
|
||||
double Item_sum_udf_float::val()
|
||||
double Item_sum_udf_float::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
DBUG_ENTER("Item_sum_udf_float::val");
|
||||
|
@ -1565,7 +1565,7 @@ double Item_sum_udf_float::val()
|
|||
String *Item_sum_udf_float::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr=val();
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set(nr,decimals, &my_charset_bin);
|
||||
|
|
|
@ -107,7 +107,10 @@ public:
|
|||
Item_sum_num(THD *thd, Item_sum_num *item) :Item_sum(thd, item) {}
|
||||
bool fix_fields(THD *, TABLE_LIST *, Item **);
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return (longlong) val(); } /* Real as default */
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return (longlong) val_real(); /* Real as default */
|
||||
}
|
||||
String *val_str(String*str);
|
||||
void reset_field();
|
||||
};
|
||||
|
@ -119,7 +122,7 @@ public:
|
|||
Item_sum_int(Item *item_par) :Item_sum_num(item_par) {}
|
||||
Item_sum_int(List<Item> &list) :Item_sum_num(list) {}
|
||||
Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {}
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String*str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
void fix_length_and_dec()
|
||||
|
@ -139,7 +142,7 @@ class Item_sum_sum :public Item_sum_num
|
|||
enum Sumfunctype sum_func () const {return SUM_FUNC;}
|
||||
void clear();
|
||||
bool add();
|
||||
double val();
|
||||
double val_real();
|
||||
void reset_field();
|
||||
void update_field();
|
||||
void no_rows_in_result() {}
|
||||
|
@ -169,7 +172,7 @@ public:
|
|||
bool setup(THD *thd);
|
||||
void clear();
|
||||
bool add();
|
||||
double val();
|
||||
double val_real();
|
||||
|
||||
inline void add(double val) { sum+= val; }
|
||||
enum Sumfunctype sum_func () const { return SUM_DISTINCT_FUNC; }
|
||||
|
@ -302,8 +305,9 @@ public:
|
|||
Field *field;
|
||||
Item_avg_field(Item_sum_avg *item);
|
||||
enum Type type() const { return FIELD_AVG_ITEM; }
|
||||
double val();
|
||||
longlong val_int() { /* can't be fix_fields()ed */ return (longlong) val(); }
|
||||
double val_real();
|
||||
longlong val_int()
|
||||
{ /* can't be fix_fields()ed */ return (longlong) val_real(); }
|
||||
bool is_null() { (void) val_int(); return null_value; }
|
||||
String *val_str(String*);
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
|
@ -329,7 +333,7 @@ class Item_sum_avg :public Item_sum_num
|
|||
enum Sumfunctype sum_func () const {return AVG_FUNC;}
|
||||
void clear();
|
||||
bool add();
|
||||
double val();
|
||||
double val_real();
|
||||
void reset_field();
|
||||
void update_field();
|
||||
Item *result_item(Field *field)
|
||||
|
@ -347,8 +351,9 @@ public:
|
|||
Field *field;
|
||||
Item_variance_field(Item_sum_variance *item);
|
||||
enum Type type() const {return FIELD_VARIANCE_ITEM; }
|
||||
double val();
|
||||
longlong val_int() { /* can't be fix_fields()ed */ return (longlong) val(); }
|
||||
double val_real();
|
||||
longlong val_int()
|
||||
{ /* can't be fix_fields()ed */ return (longlong) val_real(); }
|
||||
String *val_str(String*);
|
||||
bool is_null() { (void) val_int(); return null_value; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
|
@ -386,7 +391,7 @@ class Item_sum_variance : public Item_sum_num
|
|||
enum Sumfunctype sum_func () const { return VARIANCE_FUNC; }
|
||||
void clear();
|
||||
bool add();
|
||||
double val();
|
||||
double val_real();
|
||||
void reset_field();
|
||||
void update_field();
|
||||
Item *result_item(Field *field)
|
||||
|
@ -403,7 +408,7 @@ class Item_std_field :public Item_variance_field
|
|||
public:
|
||||
Item_std_field(Item_sum_std *item);
|
||||
enum Type type() const { return FIELD_STD_ITEM; }
|
||||
double val();
|
||||
double val_real();
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -418,7 +423,7 @@ class Item_sum_std :public Item_sum_variance
|
|||
:Item_sum_variance(thd, item)
|
||||
{}
|
||||
enum Sumfunctype sum_func () const { return STD_FUNC; }
|
||||
double val();
|
||||
double val_real();
|
||||
Item *result_item(Field *field)
|
||||
{ return new Item_std_field(this); }
|
||||
const char *func_name() const { return "std"; }
|
||||
|
@ -456,7 +461,7 @@ class Item_sum_hybrid :public Item_sum
|
|||
bool const_item() const { return !used_table_cache; }
|
||||
|
||||
void clear();
|
||||
double val();
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
void reset_field();
|
||||
String *val_str(String *);
|
||||
|
@ -594,8 +599,11 @@ class Item_sum_udf_float :public Item_udf_sum
|
|||
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return (longlong) Item_sum_udf_float::val(); }
|
||||
double val();
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return (longlong) Item_sum_udf_float::val_real();
|
||||
}
|
||||
double val_real();
|
||||
String *val_str(String*str);
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
Item *copy_or_same(THD* thd);
|
||||
|
@ -611,7 +619,7 @@ public:
|
|||
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
longlong val_int();
|
||||
double val()
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_sum_udf_int::val_int(); }
|
||||
String *val_str(String*str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
|
@ -629,7 +637,7 @@ public:
|
|||
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
|
||||
:Item_udf_sum(thd, item) {}
|
||||
String *val_str(String *);
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
int err;
|
||||
String *res; res=val_str(&str_value);
|
||||
|
@ -657,7 +665,7 @@ class Item_sum_udf_float :public Item_sum_num
|
|||
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
void clear() {}
|
||||
bool add() { return 0; }
|
||||
void update_field() {}
|
||||
|
@ -673,7 +681,7 @@ public:
|
|||
:Item_sum_num(thd, item) {}
|
||||
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return 0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0; }
|
||||
void clear() {}
|
||||
bool add() { return 0; }
|
||||
void update_field() {}
|
||||
|
@ -689,7 +697,7 @@ public:
|
|||
:Item_sum_num(thd, item) {}
|
||||
String *val_str(String *)
|
||||
{ DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
void fix_length_and_dec() { maybe_null=1; max_length=0; }
|
||||
|
@ -761,7 +769,7 @@ class Item_func_group_concat : public Item_sum
|
|||
bool setup(THD *thd);
|
||||
void make_unique();
|
||||
virtual void update_field() {}
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
String *res; res=val_str(&str_value);
|
||||
return res ? my_atof(res->c_ptr()) : 0.0;
|
||||
|
|
|
@ -88,7 +88,7 @@ class Item_func_month :public Item_func
|
|||
public:
|
||||
Item_func_month(Item *a) :Item_func(a) {}
|
||||
longlong val_int();
|
||||
double val()
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
||||
String *val_str(String *str)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ public:
|
|||
Item_func_weekday(Item *a,bool type_arg)
|
||||
:Item_func(a), odbc_type(type_arg) {}
|
||||
longlong val_int();
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
@ -326,7 +326,7 @@ public:
|
|||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
String *val_str(String *str);
|
||||
longlong val_int();
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
const char *func_name() const { return "date"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ public:
|
|||
Item_func_curtime(Item *a) :Item_func(a) {}
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec();
|
||||
|
@ -452,7 +452,7 @@ public:
|
|||
Item_func_now() :Item_date_func() {}
|
||||
Item_func_now(Item *a) :Item_date_func(a) {}
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
int save_in_field(Field *to, bool no_conversions);
|
||||
String *val_str(String *str);
|
||||
|
@ -512,7 +512,7 @@ class Item_func_from_unixtime :public Item_date_func
|
|||
THD *thd;
|
||||
public:
|
||||
Item_func_from_unixtime(Item *a) :Item_date_func(a) {}
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return (double) Item_func_from_unixtime::val_int();
|
||||
|
@ -552,7 +552,7 @@ class Item_func_convert_tz :public Item_date_func
|
|||
Item_func_convert_tz(Item *a, Item *b, Item *c):
|
||||
Item_date_func(a, b, c) {}
|
||||
longlong val_int();
|
||||
double val() { return (double) val_int(); }
|
||||
double val_real() { return (double) val_int(); }
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "convert_tz"; }
|
||||
bool fix_fields(THD *, struct st_table_list *, Item **);
|
||||
|
@ -565,7 +565,7 @@ class Item_func_sec_to_time :public Item_str_func
|
|||
{
|
||||
public:
|
||||
Item_func_sec_to_time(Item *item) :Item_str_func(item) {}
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
return (double) Item_func_sec_to_time::val_int();
|
||||
|
@ -615,7 +615,7 @@ public:
|
|||
const char *func_name() const { return "date_add_interval"; }
|
||||
void fix_length_and_dec();
|
||||
enum_field_types field_type() const { return cached_field_type; }
|
||||
double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
longlong val_int();
|
||||
bool get_date(TIME *res, uint fuzzy_date);
|
||||
void print(String *str);
|
||||
|
|
|
@ -27,7 +27,7 @@ class Item_func_unique_users :public Item_real_func
|
|||
public:
|
||||
Item_func_unique_users(Item *name_arg,int start,int end,List<Item> &list)
|
||||
:Item_real_func(list) {}
|
||||
double val() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=6; }
|
||||
void print(String *str) { str->append("0.0", 3); }
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
:Item_sum_num(item_arg) {}
|
||||
Item_sum_unique_users(THD *thd, Item_sum_unique_users *item)
|
||||
:Item_sum_num(thd, item) {}
|
||||
double val() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
|
||||
enum Sumfunctype sum_func () const {return UNIQUE_USERS_FUNC;}
|
||||
void clear() {}
|
||||
bool add() { return 0; }
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
void set(longlong nr) { value=(double) nr; }
|
||||
void set(const char *str,uint length,CHARSET_INFO *cs)
|
||||
{ int err; value=my_strntod(cs,(char*) str,length,(char**)0,&err); }
|
||||
double val() { return value; }
|
||||
double val_real() { return value; }
|
||||
longlong val_int() { return (longlong) value; }
|
||||
String *val_str(String *s) { s->set(value,decimals,default_charset()); return s; }
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
void set(longlong nr) { value=nr; }
|
||||
void set(const char *str,uint length, CHARSET_INFO *cs)
|
||||
{ int err; value=my_strntoll(cs,str,length,10,NULL,&err); }
|
||||
double val() { return (double) value; }
|
||||
double val_real() { return (double) value; }
|
||||
longlong val_int() { return value; }
|
||||
String *val_str(String *s) { s->set(value, default_charset()); return s; }
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
void set(longlong nr) { str_value.set(nr, default_charset()); }
|
||||
void set(const char *str, uint length, CHARSET_INFO *cs)
|
||||
{ str_value.copy(str,length,cs); }
|
||||
double val()
|
||||
double val_real()
|
||||
{
|
||||
int err;
|
||||
CHARSET_INFO *cs=str_value.charset();
|
||||
|
|
|
@ -134,7 +134,7 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type)
|
|||
}
|
||||
case REAL_RESULT:
|
||||
{
|
||||
double d= it->val();
|
||||
double d= it->val_real();
|
||||
|
||||
if (it->null_value)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type)
|
|||
uint8 decimals= it->decimals;
|
||||
uint32 max_length= it->max_length;
|
||||
DBUG_PRINT("info", ("REAL_RESULT: %g", d));
|
||||
it= new Item_real(it->val());
|
||||
it= new Item_real(it->val_real());
|
||||
it->decimals= decimals;
|
||||
it->max_length= max_length;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
{
|
||||
// first parameter
|
||||
if ((*param->item)->type() != Item::INT_ITEM ||
|
||||
(*param->item)->val() < 0)
|
||||
(*param->item)->val_real() < 0)
|
||||
{
|
||||
delete pc;
|
||||
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
|
||||
|
@ -93,7 +93,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
}
|
||||
// second parameter
|
||||
if ((*param->item)->type() != Item::INT_ITEM ||
|
||||
(*param->item)->val() < 0)
|
||||
(*param->item)->val_real() < 0)
|
||||
{
|
||||
delete pc;
|
||||
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
|
||||
|
@ -102,7 +102,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||
pc->max_treemem = (uint) (*param->item)->val_int();
|
||||
}
|
||||
else if ((*param->item)->type() != Item::INT_ITEM ||
|
||||
(*param->item)->val() < 0)
|
||||
(*param->item)->val_real() < 0)
|
||||
{
|
||||
delete pc;
|
||||
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
|
||||
|
@ -364,7 +364,7 @@ void field_str::add()
|
|||
void field_real::add()
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH], *ptr, *end;
|
||||
double num = item->val();
|
||||
double num= item->val_real();
|
||||
uint length, zero_count, decs;
|
||||
TREE_ELEMENT *element;
|
||||
|
||||
|
|
|
@ -1345,7 +1345,7 @@ bool select_max_min_finder_subselect::send_data(List<Item> &items)
|
|||
bool select_max_min_finder_subselect::cmp_real()
|
||||
{
|
||||
Item *maxmin= ((Item_singlerow_subselect *)item)->el(0);
|
||||
double val1= cache->val(), val2= maxmin->val();
|
||||
double val1= cache->val_real(), val2= maxmin->val_real();
|
||||
if (fmax)
|
||||
return (cache->null_value && !maxmin->null_value) ||
|
||||
(!cache->null_value && !maxmin->null_value &&
|
||||
|
|
|
@ -2936,14 +2936,14 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
|
|||
Item_func *arg0=(Item_func *)(func->arguments()[0]),
|
||||
*arg1=(Item_func *)(func->arguments()[1]);
|
||||
if (arg1->const_item() &&
|
||||
((functype == Item_func::GE_FUNC && arg1->val()> 0) ||
|
||||
(functype == Item_func::GT_FUNC && arg1->val()>=0)) &&
|
||||
((functype == Item_func::GE_FUNC && arg1->val_real() > 0) ||
|
||||
(functype == Item_func::GT_FUNC && arg1->val_real() >=0)) &&
|
||||
arg0->type() == Item::FUNC_ITEM &&
|
||||
arg0->functype() == Item_func::FT_FUNC)
|
||||
cond_func=(Item_func_match *) arg0;
|
||||
else if (arg0->const_item() &&
|
||||
((functype == Item_func::LE_FUNC && arg0->val()> 0) ||
|
||||
(functype == Item_func::LT_FUNC && arg0->val()>=0)) &&
|
||||
((functype == Item_func::LE_FUNC && arg0->val_real() > 0) ||
|
||||
(functype == Item_func::LT_FUNC && arg0->val_real() >=0)) &&
|
||||
arg1->type() == Item::FUNC_ITEM &&
|
||||
arg1->functype() == Item_func::FT_FUNC)
|
||||
cond_func=(Item_func_match *) arg1;
|
||||
|
|
Loading…
Reference in a new issue