mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Fix - to not to call val_xxx in Item_func_interval twice
sql/item_cmpfunc.cc: code fixed not to call val_x twice
This commit is contained in:
parent
b1f5ed9dd7
commit
04bae3c0eb
1 changed files with 12 additions and 3 deletions
|
@ -895,15 +895,24 @@ void Item_func_interval::fix_length_and_dec()
|
||||||
longlong Item_func_interval::val_int()
|
longlong Item_func_interval::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
double value= row->el(0)->val_real();
|
double value;
|
||||||
my_decimal dec_buf, *dec= NULL;
|
my_decimal dec_buf, *dec= NULL;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
if (use_decimal_comparison)
|
if (use_decimal_comparison)
|
||||||
|
{
|
||||||
dec= row->el(0)->val_decimal(&dec_buf);
|
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)
|
if (intervals)
|
||||||
{ // Use binary search to find interval
|
{ // Use binary search to find interval
|
||||||
uint start,end;
|
uint start,end;
|
||||||
|
|
Loading…
Add table
Reference in a new issue