diff options
author | ramil/ram@mysql.com/ramil.myoffice.izhnet.ru <> | 2007-01-31 09:51:05 +0400 |
---|---|---|
committer | ramil/ram@mysql.com/ramil.myoffice.izhnet.ru <> | 2007-01-31 09:51:05 +0400 |
commit | eb415e4920339b834277c507d746eaf0a3296ac7 (patch) | |
tree | a5f943c8d9507c74c1eef53b811a4f4a696bf8d7 /sql/field.h | |
parent | ba6e6d07543b458239bb06b0be81e1d62cb0ef68 (diff) | |
download | mariadb-git-eb415e4920339b834277c507d746eaf0a3296ac7.tar.gz |
fix for bug #19690: ORDER BY eliminates rows from the result
Depending on the queries we use different data processing methods
and can lose some data in case of double (and decimal in 4.1) fields.
The fix consists of two parts:
1. double comparison changed, now double a is equal to double b
if (a-b) is less than 5*0.1^(1 + max(a->decimals, b->decimals)).
For example, if a->decimals==1, b->decimals==2, a==b if (a-b)<0.005
2. if we use a temporary table, store double values there as is
to avoid any data conversion (rounding).
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/field.h b/sql/field.h index e4991ba1961..b10d950163c 100644 --- a/sql/field.h +++ b/sql/field.h @@ -616,6 +616,7 @@ public: class Field_double :public Field_num { public: + my_bool not_fixed; Field_double(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, @@ -623,12 +624,20 @@ public: uint8 dec_arg,bool zero_arg,bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, table_arg, - dec_arg, zero_arg,unsigned_arg) + dec_arg, zero_arg, unsigned_arg), + not_fixed(dec_arg >= NOT_FIXED_DEC) {} Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, struct st_table *table_arg, uint8 dec_arg) - :Field_num((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, - NONE, field_name_arg, table_arg,dec_arg,0,0) + :Field_num((char *) 0, len_arg, maybe_null_arg ? (uchar *) "" : 0, (uint) 0, + NONE, field_name_arg, table_arg,dec_arg, 0, 0), + not_fixed(dec_arg >= NOT_FIXED_DEC) + {} + Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, + struct st_table *table_arg, uint8 dec_arg, my_bool not_fixed_srg) + :Field_num((char *) 0, len_arg, maybe_null_arg ? (uchar *) "" : 0, (uint) 0, + NONE, field_name_arg, table_arg, dec_arg, 0, 0), + not_fixed(not_fixed_srg) {} enum_field_types type() const { return FIELD_TYPE_DOUBLE;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; } |