diff options
author | unknown <bar@mysql.com> | 2006-07-07 16:27:38 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2006-07-07 16:27:38 +0500 |
commit | 0b399f1d3f7b25cf16c868650edb99d9eb0a1ac7 (patch) | |
tree | 02e9bcd38a0db08068f549be1b90fe318ef68590 /sql-common | |
parent | 4d71b8f8f91fae06641a4913c3cfba6ba8929f57 (diff) | |
parent | eebe37d0517bc7e4829ca4900491b1023d72d5c6 (diff) | |
download | mariadb-git-0b399f1d3f7b25cf16c868650edb99d9eb0a1ac7.tar.gz |
Merge mysql.com:/usr/home/bar/mysql-4.1.b7192
into mysql.com:/usr/home/bar/mysql-5.0-kt
sql-common/client.c:
Auto merged
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 31e85475f08..66d409cf1eb 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1673,11 +1673,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; @@ -1685,6 +1692,28 @@ int mysql_init_character_set(MYSQL *mysql) 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; } |