List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:January 8 2009 5:38pm
Subject:Re: bzr commit into libmysql branch (jimw:2797) Bug#41071
View as plain text  
Hi, Jim!

On Dec 23, Jim Winstead wrote:
> #At file:///Users/jimw/my/libmysql-1.0/ based on
> revid:jimw@stripped
> 
>  2797 Jim Winstead	2008-12-23
>       Automatically fall back to 3-byte UTF-8 on pre-6.0 servers when connecting
>       (or changing users). (Bug #41071, patch by Georg Richter)
> 
> === modified file 'libmysql/client.c'
> --- a/libmysql/client.c	2008-12-23 18:33:52 +0000
> +++ b/libmysql/client.c	2008-12-23 20:52:19 +0000
> @@ -2257,6 +2257,15 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
>      int4store(buff,client_flag);
>      int4store(buff+4, net->max_packet_size);
>      buff[8]= (char) mysql->charset->number;
> +    /*
> +      Character set 45 (4-byte UTF-8) is not available on servers
> +      before version 6.0, so we need to go ahead and switch to utf8_mb3.
> +    */
> +    if (mysql->charset->number == 45 && mysql->server_version[0]
> < '6')
> +      buff[8]= 33;

Same question that I asked Georg - why you don't need to change
mysql->charset->number to be 33 here ?

> +    else
> +      buff[8]= (char)mysql->charset->number;

>      bzero(buff+9, 32-9);
>      end= buff+32;
>    }
> 
> === modified file 'libmysql/libmysql.c'
> --- a/libmysql/libmysql.c	2008-12-14 11:36:15 +0000
> +++ b/libmysql/libmysql.c	2008-12-23 20:52:19 +0000
> @@ -437,7 +437,14 @@ my_bool	STDCALL mysql_change_user(MYSQL 
>  
>    if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
>    {
> -    int2store(end, (ushort) mysql->charset->number);
> +    /*
> +      Character set 45 (4-byte UTF-8) is not available on servers
> +      before version 6.0, so we need to go ahead and switch to utf8_mb3.
> +    */
> +    if (mysql->charset->number == 45 && mysql->server_version[0]
> < '6')
> +      int2store(end, 33);

and here, of course

> +    else
> +      int2store(end, (ushort) mysql->charset->number);
>      end+= 2;
>    }
> 
> === modified file 'unittest/libmysql/basic-t.c'
> --- a/unittest/libmysql/basic-t.c	2008-12-16 18:25:17 +0000
> +++ b/unittest/libmysql/basic-t.c	2008-12-23 20:52:19 +0000

You're also using unit tests! Great!
Congratulations :)

Regards / Mit vielen Grüßen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
Re: bzr commit into libmysql branch (jimw:2797) Bug#41071Sergei Golubchik8 Jan
Re: bzr commit into libmysql branch (jimw:2797) Bug#41071Sergei Golubchik9 Jan