diff options
author | unknown <hf@deer.(none)> | 2005-02-16 11:19:47 +0400 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2005-02-16 11:19:47 +0400 |
commit | 04bae3c0ebe100e78d5e04189df88f972d72b5bd (patch) | |
tree | 71c6fd720e3ecfa248dbf0e8799f0a85b9d1fe63 /sql/item_cmpfunc.cc | |
parent | b1f5ed9dd728e1e87fcd36dee2305545ea580649 (diff) | |
download | mariadb-git-04bae3c0ebe100e78d5e04189df88f972d72b5bd.tar.gz |
Fix - to not to call val_xxx in Item_func_interval twice
sql/item_cmpfunc.cc:
code fixed not to call val_x twice
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0fa7ffcdda8..3884cce8451 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -895,15 +895,24 @@ void Item_func_interval::fix_length_and_dec() longlong Item_func_interval::val_int() { DBUG_ASSERT(fixed == 1); - double value= row->el(0)->val_real(); + double value; my_decimal dec_buf, *dec= NULL; uint i; if (use_decimal_comparison) + { dec= row->el(0)->val_decimal(&dec_buf); + if (row->el(0)->null_value) + return -1; + my_decimal2double(E_DEC_FATAL_ERROR, dec, &value); + } + else + { + value= row->el(0)->val_real(); + if (row->el(0)->null_value) + return -1; + } - if (row->el(0)->null_value) - return -1; // -1 if null if (intervals) { // Use binary search to find interval uint start,end; |