diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 18 | ||||
-rw-r--r-- | sql/item_sum.cc | 7 |
2 files changed, 13 insertions, 12 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0daba495f62..bdfa4664a6f 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -417,12 +417,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) break; } case DECIMAL_RESULT: - case REAL_RESULT: break; - default: - DBUG_ASSERT(0); - } - else if (type == REAL_RESULT) + case REAL_RESULT: { if ((*a)->decimals < NOT_FIXED_DEC && (*b)->decimals < NOT_FIXED_DEC) { @@ -432,6 +428,10 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) else if (func == &Arg_comparator::compare_e_real) func= &Arg_comparator::compare_e_real_fixed; } + break; + } + default: + DBUG_ASSERT(0); } return 0; } @@ -577,10 +577,10 @@ int Arg_comparator::compare_real_fixed() performing the comparison. */ volatile double val1, val2; - val1= (*a)->val(); + val1= (*a)->val_real(); if (!(*a)->null_value) { - val2= (*b)->val(); + val2= (*b)->val_real(); if (!(*b)->null_value) { owner->null_value= 0; @@ -598,8 +598,8 @@ int Arg_comparator::compare_real_fixed() int Arg_comparator::compare_e_real_fixed() { - 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 || fabs(val1 - val2) < precision); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 8bfac058936..28a9a1f4dbf 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -398,7 +398,8 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table, { switch (result_type()) { case REAL_RESULT: - return new Field_double(max_length,maybe_null,name,table,decimals); + return new Field_double(max_length, maybe_null, name, table, decimals, + TRUE); case INT_RESULT: return new Field_longlong(max_length,maybe_null,name,table,unsigned_flag); case STRING_RESULT: @@ -1123,7 +1124,7 @@ Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table, if (hybrid_type == DECIMAL_RESULT) return new Field_new_decimal(max_length, maybe_null, name, table, decimals, unsigned_flag); - return new Field_double(max_length, maybe_null, name, table, decimals); + return new Field_double(max_length, maybe_null, name, table, decimals, TRUE); } @@ -1317,7 +1318,7 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, */ return new Field_string(sizeof(double)*2 + sizeof(longlong), 0, name, table, &my_charset_bin); } - return new Field_double(max_length, maybe_null,name,table,decimals); + return new Field_double(max_length, maybe_null, name, table, decimals, TRUE); } |