List:Commits« Previous MessageNext Message »
From:bar Date:June 30 2006 11:48am
Subject:bk commit into 4.1 tree (bar:1.2524) BUG#7192
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2524 06/06/30 16:48:18 bar@stripped +1 -0
  Bug#7192 Specify --with-collation doesn't work for connections?
  --with-collation worked only on the server side.
  Client side ignored this argument, so collation_connection
  was not properly set (remained latin1_swedish_ci).

  sql-common/client.c
    1.90 06/06/30 16:48:13 bar@stripped +31 -2
    - Take into account MYSQL_DEFAULT_COLLATION_NAME if
    character set is not set using mysql_option(), to
    honor --with-collation argument to configure.
    - Use default collation for the character set when it's
    not set using mysql_option().

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-4.1.b7192

--- 1.89/sql-common/client.c	2006-06-19 22:10:15 +05:00
+++ 1.90/sql-common/client.c	2006-06-30 16:48:13 +05:00
@@ -1543,11 +1543,18 @@ C_MODE_START
 int mysql_init_character_set(MYSQL *mysql)
 {
   NET		*net= &mysql->net;
+  const char *default_collation_name;
+  
   /* Set character set */
-  if (!mysql->options.charset_name &&
-      !(mysql->options.charset_name= 
+  if (!mysql->options.charset_name)
+  {
+    default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
+    if (!(mysql->options.charset_name= 
        my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
     return 1;
+  }
+  else
+    default_collation_name= NULL;
   
   {
     const char *save= charsets_dir;
@@ -1555,6 +1562,28 @@ int mysql_init_character_set(MYSQL *mysq
       charsets_dir=mysql->options.charset_dir;
     mysql->charset=get_charset_by_csname(mysql->options.charset_name,
                                          MY_CS_PRIMARY, MYF(MY_WME));
+    if (mysql->charset && default_collation_name)
+    {
+      CHARSET_INFO *collation;
+      if ((collation= 
+           get_charset_by_name(default_collation_name, MYF(MY_WME))))
+      {
+        if (!my_charset_same(mysql->charset, collation))
+        {
+          my_printf_error(ER_UNKNOWN_ERROR, 
+                         "COLLATION %s is not valid for CHARACTER SET %s",
+                         MYF(0),
+                         default_collation_name, mysql->options.charset_name);
+          mysql->charset= NULL;
+        }
+        else
+        {
+          mysql->charset= collation;
+        }
+      }
+      else
+        mysql->charset= NULL;
+    }
     charsets_dir= save;
   }
   
Thread
bk commit into 4.1 tree (bar:1.2524) BUG#7192bar30 Jun