Commit f20835c7 authored by unknown's avatar unknown

SET NAMES doesn't start recoding

SET CHARACTER SET does

parent 0695239a
......@@ -6,16 +6,16 @@ CREATE TABLE
);
SHOW TABLES;
Tables_in_test
таблица
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default ''
таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra
char(32) character set koi8r koi8r_general_ci
SET NAMES cp1251;
поле char(32) character set koi8r koi8r_general_ci
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test
......@@ -27,7 +27,7 @@ Table Create Table
SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra
char(32) character set koi8r koi8r_general_ci
SET NAMES utf8;
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test
таблица
......@@ -39,5 +39,5 @@ Table Create Table
SHOW FIELDS FROM таблица;
Field Type Collation Null Key Default Extra
поле char(32) character set koi8r koi8r_general_ci
SET NAMES koi8r;
SET CHARACTER SET koi8r;
DROP TABLE ;
......@@ -2,7 +2,7 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
SET NAMES latin1;
SET CHARACTER SET latin1;
CREATE TABLE t1 (
comment CHAR(32) ASCII NOT NULL,
......@@ -137,12 +137,12 @@ INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT YU');
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT YA');
SET NAMES utf8;
SET CHARACTER SET utf8;
SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL;
UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
SET NAMES koi8r;
SET CHARACTER SET koi8r;
SELECT * FROM t1;
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
......@@ -165,7 +165,7 @@ FROM t1 t11,t1 t12
WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r)
ORDER BY t12.utf8_f,t11.comment,t12.comment;
SET NAMES utf8;
SET CHARACTER SET utf8;
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
......@@ -199,7 +199,7 @@ UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _lati
UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
SELECT * FROM t1;
SET NAMES 'binary';
SET CHARACTER SET 'binary';
SELECT * FROM t1;
SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
DROP TABLE t1;
......@@ -13,16 +13,16 @@ SHOW TABLES;
SHOW CREATE TABLE ;
SHOW FIELDS FROM ;
SET NAMES cp1251;
SET CHARACTER SET cp1251;
SHOW TABLES;
SHOW CREATE TABLE ;
SHOW FIELDS FROM ;
SET NAMES utf8;
SET CHARACTER SET utf8;
SHOW TABLES;
SHOW CREATE TABLE таблица;
SHOW FIELDS FROM таблица;
SET NAMES koi8r;
SET CHARACTER SET koi8r;
DROP TABLE ;
......@@ -1237,7 +1237,7 @@ void sys_var_client_collation::set_default(THD *thd, enum_var_type type)
global_system_variables.client_collation= default_charset_info;
else
{
thd->variables.client_collation= thd->db_charset;
thd->variables.client_collation= global_system_variables.client_collation;
}
}
......@@ -1264,7 +1264,7 @@ void sys_var_literal_collation::set_default(THD *thd, enum_var_type type)
if (type == OPT_GLOBAL)
global_system_variables.literal_collation= default_charset_info;
else
thd->variables.literal_collation= thd->db_charset;
thd->variables.literal_collation= global_system_variables.literal_collation;
}
......@@ -1274,7 +1274,8 @@ void sys_var_literal_collation::set_default(THD *thd, enum_var_type type)
int set_var_client_collation::check(THD *thd)
{
client_charset= client_charset ? client_charset : thd->db_charset;
client_charset= client_charset ?
client_charset : global_system_variables.client_collation;
client_collation= client_collation ? client_collation : client_charset;
if (!my_charset_same(client_charset, client_collation))
{
......@@ -1288,7 +1289,8 @@ int set_var_client_collation::check(THD *thd)
int set_var_client_collation::update(THD *thd)
{
thd->variables.client_collation= client_collation;
thd->variables.literal_collation= client_collation;
thd->variables.literal_collation= convert_result_charset ?
thd->db_charset: client_collation;
thd->variables.convert_result_charset= convert_result_charset;
thd->protocol_simple.init(thd);
thd->protocol_prep.init(thd);
......
......@@ -602,7 +602,6 @@ bool mysql_change_db(THD *thd, const char *name)
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
load_db_opt(path, &create);
thd->db_charset= create.table_charset ? create.table_charset : default_charset_info;
thd->variables.client_collation=thd->db_charset ? thd->db_charset : default_charset_info;
DBUG_RETURN(0);
}
......
......@@ -4411,7 +4411,7 @@ option_value:
| NAMES_SYM charset_name_or_default opt_collate
{
LEX *lex= Lex;
lex->var_list.push_back(new set_var_client_collation($2,$3,1));
lex->var_list.push_back(new set_var_client_collation($2,$3,0));
}
| PASSWORD equal text_or_password
{
......
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