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