Commit 54666184 authored by Evgeny Potemkin's avatar Evgeny Potemkin

Post-merge fix.

parent bc2d4e62
......@@ -7275,16 +7275,17 @@ longlong Item_cache_int::val_int()
return value;
}
void Item_cache_datetime::cache_value_int()
bool Item_cache_datetime::cache_value_int()
{
if (!example)
return;
return FALSE;
value_cached= TRUE;
/* Assume here that the underlying item will do correct conversion.*/
int_value= example->val_int_result();
null_value= example->null_value;
unsigned_flag= example->unsigned_flag;
return TRUE;
}
......@@ -7316,8 +7317,8 @@ void Item_cache_datetime::store(Item *item, longlong val_arg)
String *Item_cache_datetime::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
if (!str_value_cached)
cache_value();
if (!str_value_cached && !cache_value())
return NULL;
return &str_value;
}
......@@ -7325,8 +7326,8 @@ String *Item_cache_datetime::val_str(String *str)
my_decimal *Item_cache_datetime::val_decimal(my_decimal *decimal_val)
{
DBUG_ASSERT(fixed == 1);
if (!value_cached)
cache_value_int();
if (!value_cached && !cache_value_int())
return NULL;
int2my_decimal(E_DEC_FATAL_ERROR, int_value, unsigned_flag, decimal_val);
return decimal_val;
}
......@@ -7334,16 +7335,16 @@ my_decimal *Item_cache_datetime::val_decimal(my_decimal *decimal_val)
double Item_cache_datetime::val_real()
{
DBUG_ASSERT(fixed == 1);
if (!value_cached)
cache_value_int();
if (!value_cached && !cache_value_int())
return 0.0;
return (double) int_value;
}
longlong Item_cache_datetime::val_int()
{
DBUG_ASSERT(fixed == 1);
if (!value_cached)
cache_value_int();
if (!value_cached && !cache_value_int())
return 0;
return int_value;
}
......
......@@ -3177,7 +3177,7 @@ public:
completely relies on the ability of the underlying item to do the
correct conversion.
*/
void cache_value_int();
bool cache_value_int();
bool cache_value();
};
......
......@@ -1207,6 +1207,7 @@ void Item_sum_hybrid::setup(Item *item, Item *value_arg)
{
value= Item_cache::get_cache(item);
value->setup(item);
if (value_arg)
value->store(value_arg);
cmp= new Arg_comparator();
cmp->set_cmp_func(this, args, (Item**)&value, FALSE);
......
......@@ -876,12 +876,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
const char *start= str;
for (value=0; str != end && my_isdigit(cs,*str) ; str++)
value= value*LL(10) + (longlong) (*str - '0');
if (transform_msec && i == count - 1) // microseconds always last
{
int msec_length= 6 - (str - start);
if (msec_length > 0)
value*= (long)log_10_int[msec_length];
}
msec_length= 6 - (str - start);
values[i]= value;
while (str != end && !my_isdigit(cs,*str))
str++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment