Hi!
On 4 February 2008 11:42:36 Sergei Golubchik wrote:
> No, this is wrong.
>
> opt_charset specifies whether SET NAMES should be in the output.
> It does not affect what is used for mysqldump<->server communications,
> indeed, when a user can select what level of details he wants in the
> dump, for communicating with the server we should always use the most
> secure and robust settings.
Agreed. opt_set_charset has nothing to do with it.
> The contributed patch was correct in this regard - it tried to switch
> the charset, but ignored the error for old servers.
Well, technically, it was. But let's not do it this way. Here we mixed
two absolutely different things -- "command to dump SET NAMES"
(opt_set_charset) and "server version". Sure, if server version is less than
4.1, SET NAMES does not make sense. But let's not use opt_set_charset as
a flag that "server version is less than 4.1".
I think, you didn't propose that, but just in case. :)
> Alternatively you can only use switch_character_set_results() for
> new servers.
Yes. I believe this is the right approach. Get server version using
mysql_get_server_version() and call switch_character_set_results() only if
server_version >= 4.1.
--
Alexander Nozdrin, Software Developer
MySQL AB, Moscow, Russia, www.mysql.com