summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <mysql@home.(none)>2003-04-05 18:56:15 +0500
committerunknown <mysql@home.(none)>2003-04-05 18:56:15 +0500
commit0ee981674c3c8a1533b72ae0b893352144c788bb (patch)
tree6b95474d3e263ca261628c0539e1ce1ac421cb7d /sql/set_var.cc
parenta00dbd11926b5d88e1e2b833a60274054cccd9c4 (diff)
downloadmariadb-git-0ee981674c3c8a1533b72ae0b893352144c788bb.tar.gz
Some optimization in SET NAMES
mysql-test/r/ctype_collate.result: SET NAMES charset COLLATE collation is new syntax mysql-test/r/variables.result: SET NAMES charset COLLATE collation is new syntax mysql-test/t/ctype_collate.test: SET NAMES charset COLLATE collation is new syntax mysql-test/t/variables.test: SET NAMES charset COLLATE collation is new syntax
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a47fdbfb63f..127988b8c4e 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1175,7 +1175,7 @@ static my_old_conv old_conv[]=
{ NULL , NULL }
};
-static CHARSET_INFO *get_old_charset_by_name(const char *name)
+CHARSET_INFO *get_old_charset_by_name(const char *name)
{
my_old_conv *c;
@@ -1662,22 +1662,23 @@ int set_var_password::update(THD *thd)
int set_var_client_collation::check(THD *thd)
{
+ client_charset= client_charset ? client_charset : thd->db_charset;
+ client_collation= client_collation ? client_collation : client_charset;
+ if (!my_charset_same(client_charset, client_collation))
+ {
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ client_collation->name, client_charset->csname);
+ return -1;
+ }
return 0;
}
int set_var_client_collation::update(THD *thd)
{
-#if 0
- if (var->type == OPT_GLOBAL)
- global_system_variables.thd_charset= var->save_result.charset;
- else
-#endif
- {
- thd->variables.thd_charset= client_collation;
- thd->variables.convert_result_charset= convert_result_charset;
- thd->protocol_simple.init(thd);
- thd->protocol_prep.init(thd);
- }
+ thd->variables.thd_charset= client_collation;
+ thd->variables.convert_result_charset= convert_result_charset;
+ thd->protocol_simple.init(thd);
+ thd->protocol_prep.init(thd);
return 0;
}