diff options
author | holyfoot@hf-ibm.(none) <> | 2005-05-05 20:06:49 +0500 |
---|---|---|
committer | holyfoot@hf-ibm.(none) <> | 2005-05-05 20:06:49 +0500 |
commit | 2c8e9df232ae55b7319fe4b52ebaf8972fc04912 (patch) | |
tree | 28239d480c5b5f518077513738c6718aafd3584d /sql/item_cmpfunc.h | |
parent | 68dd50b10a9d7a10a81f07dfc296381df3ece211 (diff) | |
download | mariadb-git-2c8e9df232ae55b7319fe4b52ebaf8972fc04912.tar.gz |
A lot of fixes to Precision math
Mostly about precision/decimals of the results of the operations
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index e917e13c5aa..78357c457cb 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -95,6 +95,7 @@ public: Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} bool is_bool_func() { return 1; } void fix_length_and_dec() { decimals=0; max_length=1; } + uint decimal_precision() const { return 1; } }; class Item_cache; @@ -208,6 +209,7 @@ public: bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); } bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; } + uint decimal_precision() const { return 1; } friend class Arg_comparator; }; @@ -411,6 +413,7 @@ public: void fix_length_and_dec(); void print(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } + uint decimal_precision() const { return 1; } }; @@ -445,6 +448,7 @@ public: longlong val_int(); void fix_length_and_dec(); const char *func_name() const { return "interval"; } + uint decimal_precision() const { return 2; } }; @@ -485,6 +489,7 @@ public: void fix_length_and_dec(); const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); + uint decimal_precision() const; }; @@ -507,6 +512,7 @@ public: return Item_func::fix_fields(thd, tlist, ref); } void fix_length_and_dec(); + uint decimal_precision() const; const char *func_name() const { return "if"; } table_map not_null_tables() const { return 0; } }; @@ -525,6 +531,7 @@ public: my_decimal *val_decimal(my_decimal *); enum Item_result result_type () const { return cached_result_type; } void fix_length_and_dec(); + uint decimal_precision() const { return args[0]->decimal_precision(); } const char *func_name() const { return "nullif"; } void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } @@ -563,6 +570,7 @@ public: String *val_str(String *); my_decimal *val_decimal(my_decimal *); void fix_length_and_dec(); + uint decimal_precision() const; table_map not_null_tables() const { return 0; } enum Item_result result_type () const { return cached_result_type; } const char *func_name() const { return "case"; } @@ -825,6 +833,7 @@ class Item_func_in :public Item_int_func } longlong val_int(); void fix_length_and_dec(); + uint decimal_precision() const { return 1; } void cleanup() { DBUG_ENTER("Item_func_in::cleanup"); |