diff options
author | unknown <holyfoot@hf-ibm.(none)> | 2005-05-05 20:06:49 +0500 |
---|---|---|
committer | unknown <holyfoot@hf-ibm.(none)> | 2005-05-05 20:06:49 +0500 |
commit | 6de14a23f7de447e4e6c4b82e2be032b05214c9a (patch) | |
tree | 28239d480c5b5f518077513738c6718aafd3584d /sql/item.h | |
parent | c0f355762547c01192478b60659038b7751a1ced (diff) | |
download | mariadb-git-6de14a23f7de447e4e6c4b82e2be032b05214c9a.tar.gz |
A lot of fixes to Precision math
Mostly about precision/decimals of the results of the operations
include/decimal.h:
decimal interface changed a little
sql/field.cc:
a lot of precision/decimals related changes to the Field_new_decimal
sql/field.h:
Field_new_decimal interface changed
sql/ha_ndbcluster.cc:
f->precision should be used here
sql/item.cc:
precision/decimals counting related changes
sql/item.h:
precision/decimals counting related changes
sql/item_cmpfunc.cc:
precision/decimals counting related changes
sql/item_cmpfunc.h:
precision/decimals counting related changes
sql/item_func.cc:
precision/decimals counting related changes
sql/item_func.h:
precision/decimals counting related changes
sql/item_sum.cc:
precision/decimals counting related changes
sql/item_sum.h:
precision/decimals counting related changes
sql/my_decimal.cc:
precision/decimals counting related changes
sql/my_decimal.h:
precision/decimals counting related changes
sql/mysqld.cc:
precision/decimals counting related changes
sql/set_var.cc:
precision/decimals counting related changes
sql/sp_head.cc:
dbug_decimal_print was replaced with dbug_decimal_as_string
sql/sql_class.h:
div_precincrement variable added
sql/sql_parse.cc:
precision/decimals counting related changes
sql/sql_select.cc:
precision/decimals counting related changes
sql/sql_show.cc:
Field::representation_length was removed
strings/decimal.c:
decimal_actual_fraction was introduced
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/item.h b/sql/item.h index f762896ba34..e5ec68d606e 100644 --- a/sql/item.h +++ b/sql/item.h @@ -258,7 +258,7 @@ public: Item *next; uint32 max_length; uint name_length; /* Length of name */ - uint8 marker,decimals; + uint8 marker, decimals; my_bool maybe_null; /* If item may be null */ my_bool null_value; /* if item is null */ my_bool unsigned_flag; @@ -442,6 +442,9 @@ public: virtual cond_result eq_cmp_result() const { return COND_OK; } inline uint float_length(uint decimals_par) const { return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;} + virtual uint decimal_precision() const; + inline int decimal_int_part() const + { return my_decimal_int_part(decimal_precision(), decimals); } /* Returns true if this is constant (during query execution, i.e. its value will not change until next fix_fields) and its value is known. @@ -937,7 +940,7 @@ public: { max_length=length; fixed= 1; } #ifdef HAVE_LONG_LONG Item_int(longlong i,uint length=21) :value(i) - { max_length=length; fixed= 1;} + { max_length=length; fixed= 1; } #endif Item_int(const char *str_arg,longlong i,uint length) :value(i) { max_length=length; name=(char*) str_arg; fixed= 1; } @@ -956,6 +959,7 @@ public: void cleanup() {} void print(String *str); Item_num *neg() { value= -value; return this; } + uint decimal_precision() const { return (uint)(max_length - test(value < 0)); } }; @@ -983,6 +987,7 @@ public: int save_in_field(Field *field, bool no_conversions); void print(String *str); Item_num *neg (); + uint decimal_precision() const { return max_length; } }; @@ -1022,6 +1027,7 @@ public: unsigned_flag= !decimal_value.sign(); return this; } + uint decimal_precision() const { return decimal_value.precision(); } }; class Item_float :public Item_num @@ -1784,6 +1790,9 @@ protected: enum_field_types fld_type; void get_full_info(Item *item); + + /* It is used to count decimal precision in join_types */ + int prev_decimal_int_part; public: Item_type_holder(THD*, Item*); |