List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:October 12 2007 8:04pm
Subject:Re: bk commit into 5.0 tree (kaa:1.2527) BUG#26788
View as plain text  
Hi!

On Oct 08, Alexey Kopytov wrote:
> ChangeSet@stripped, 2007-10-08 12:12:16+04:00, kaa@polly.(none) +3 -0
>   Fix for bug #26788 "mysqld (debug) aborts when inserting specific
>   numbers into char fields".
>   
>   Rewrote the code that determines what 'precision' argument should be
>   passed to sprintf() to fit the string representation of the input
>   number into the field.  We get finer control over conversion by
>   pre-calculating the exponent, so we are able to determine which
>   conversion format, 'e' or 'f', will be used by sprintf().

ok to push
 
> diff -Nrup a/sql/field.cc b/sql/field.cc
> --- a/sql/field.cc	2007-08-06 15:57:26 +04:00
> +++ b/sql/field.cc	2007-10-08 12:12:12 +04:00
...
> +  if (exp >= (int) digits || exp < -4)
> +#ifdef __WIN__
> +    /* Windows always zero-pads the exponent to 3 digits */
> +    digits= max(0, (int) (max_length - 6));
> +#else
> +    digits= max(0, (int) (max_length - 5 - (exp >= 100 || exp <= -100)));
> +#endif

Here you can use IF_WIN macro, makes the code simpler:

    digits= max(0, (int) (max_length - 5 - IF_WIN(1, (exp >= 100 || exp <= -100))));
  
> +  length= (uint) my_sprintf(buff, (buff, "%-.*g", digits, nr));
> 
Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Dachauer Str. 37, D-80335 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
bk commit into 5.0 tree (kaa:1.2527) BUG#26788Alexey Kopytov8 Oct
  • Re: bk commit into 5.0 tree (kaa:1.2527) BUG#26788Sergei Golubchik12 Oct