List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:July 13 2010 12:45pm
Subject:Re: bzr commit into mysql-next-mr-bugfixing branch (epotemkin:3200)
Bug#49771
View as plain text  
Hi Evgen,

Noticed a couple of other issues when looking at the new patch:

On 13.07.10 14:57, Evgeny Potemkin wrote:
> @@ -7476,8 +7465,51 @@ void Item_cache_datetime::store(Item *it
>   String *Item_cache_datetime::val_str(String *str)
>   {
>     DBUG_ASSERT(fixed == 1);
> -  if (!str_value_cached&&  !cache_value())
> -    return NULL;
> +  if (!str_value_cached)
> +  {
> +    /*
> +      When it's possible the Item_cache_datetime uses INT datetime
> +      representation due to speed reasons. But still, it always has the STRING
> +      result type and thus it can be asked to return a string value.
> +      It is possible that at this time cached item doesn't contain correct
> +      string value, thus we have to convert cached int value to string and
> +      return it.
> +    */
> +    if (value_cached)
> +    {
> +      MYSQL_TIME ltime;
> +      if (str_value.alloc(MAX_DATE_STRING_REP_LENGTH))
> +        return NULL;
> +      if (cached_field_type == MYSQL_TYPE_TIME)
> +      {
> +        ulonglong time= int_value;
> +        memset(&ltime, 0, sizeof(MYSQL_TIME));
> +        ltime.second= time % 100;
> +        time/= 100;
> +        ltime.minute= time % 100;
> +        time/= 100;
> +        ltime.hour= time % 100;
> +        DBUG_ASSERT(!(time/100));
> +        ltime.time_type= MYSQL_TIMESTAMP_TIME;
> +      }
> +      else
> +      {
> +        int was_cut;
> +        longlong res;
> +        /*
> +          get_date uses result type to determine the type of the source
> +          value. Tweak it to get datetime from cached int value.
> +        */

Obsolete comment.

> +        res= number_to_datetime(val_int(),&ltime,
> TIME_FUZZY_DATE,&was_cut);
> +        if (res == LL(-1))

Unnecessary typecast.

Best regards,
Alexey.
Thread
bzr commit into mysql-next-mr-bugfixing branch (epotemkin:3200)Bug#49771Evgeny Potemkin13 Jul
  • Re: bzr commit into mysql-next-mr-bugfixing branch (epotemkin:3200)Bug#49771Alexey Kopytov13 Jul
  • Re: bzr commit into mysql-next-mr-bugfixing branch (epotemkin:3200) Bug#49771Tor Didriksen14 Jul
  • Re: bzr commit into mysql-next-mr-bugfixing branch (epotemkin:3200) Bug#49771Tor Didriksen15 Jul