Commit ebf43374 authored by unknown's avatar unknown

Fix for Bug#2151:

"USE db"  affected the character set of further CREATE DATABASEs,
which should have not happened.


mysys/charset2html.c:
  It's earier to operate hex values when editing charset configuration file
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 060122db
......@@ -12,6 +12,7 @@ antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@co3064164-a.bitbike.com
arjen@fred.bitbike.com
arjen@george.bitbike.com
bar@bar.intranet.mysql.r18.ru
bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru
bar@gw.udmsearch.izhnet.ru
......
SET @@character_set_server=latin5;
CREATE DATABASE db1 DEFAULT CHARACTER SET cp1251;
USE db1;
CREATE DATABASE db2;
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET cp1251 */
SHOW CREATE DATABASE db2;
Database Create Database
db2 CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET latin5 */
DROP DATABASE db2;
USE db1;
CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
DROP TABLE t1;
DROP DATABASE db1;
#
# Test for various CREATE statements and character sets
#
# Check that the database charset is taken from server charset by default:
# - Change local character_set_server variable to latin5.
# - Create database with and without CHARACTER SET specification.
# At the same time check fix for the
# Bug#2151:
# "USE db" with non-default character set should never affect
# further CREATE DATABASEs.
SET @@character_set_server=latin5;
CREATE DATABASE db1 DEFAULT CHARACTER SET cp1251;
USE db1;
CREATE DATABASE db2;
#
# This should be cp1251
#
SHOW CREATE DATABASE db1;
#
# This should take the default latin5 value from server level.
#
SHOW CREATE DATABASE db2;
DROP DATABASE db2;
#
# Check that table value uses database level by default
#
USE db1;
CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP DATABASE db1;
......@@ -81,7 +81,7 @@ static void print_cs(CHARSET_INFO *cs)
printf("<TR bgcolor=#%s>",clr ? "DDDDDD" : "EEEE99");
printf("<TD>%02X",ch[i].cod);
printf("<TD>%04X",ch[i].uni);
printf("<TD>%d",ch[i].srt);
printf("<TD>%02X",ch[i].srt);
printf("<TD>%s%s%s%s%s%s%s%s",
ch[i].ctp & _U ? "U" : "",
......
......@@ -62,7 +62,7 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
ulong length;
CHARSET_INFO *cs= (create && create->default_table_charset) ?
create->default_table_charset :
thd->variables.collation_database;
thd->variables.collation_server;
length= my_sprintf(buf,(buf,
"default-character-set=%s\ndefault-collation=%s\n",
cs->csname,cs->name));
......@@ -101,7 +101,7 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
uint nbytes;
bzero((char*) create,sizeof(*create));
create->default_table_charset= global_system_variables.collation_database;
create->default_table_charset= thd->variables.collation_server;
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
......@@ -290,7 +290,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
{
thd->db_charset= (create_info && create_info->default_table_charset) ?
create_info->default_table_charset :
global_system_variables.collation_database;
thd->variables.collation_server;
thd->variables.collation_database= thd->db_charset;
}
......@@ -663,7 +663,7 @@ bool mysql_change_db(THD *thd, const char *name)
load_db_opt(thd, path, &create);
thd->db_charset= create.default_table_charset ?
create.default_table_charset :
global_system_variables.collation_database;
thd->variables.collation_server;
thd->variables.collation_database= thd->db_charset;
DBUG_RETURN(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment