Commit 9a4258b4 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-in-4.1


sql/sql_yacc.yy:
  Auto merged
parents c801eb97 0ee98167
......@@ -546,14 +546,14 @@ client_collation koi8r_general_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET COLLATION koi8r_bin;
SET NAMES koi8r COLLATE koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET COLLATION DEFAULT;
SET NAMES koi8r COLLATE DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_general_ci
......
......@@ -155,18 +155,10 @@ set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1048576
set GLOBAL character set cp1251_koi8;
show global variables like "client_collation";
Variable_name Value
client_collation cp1251_bulgarian_ci
set character set cp1251_koi8;
show variables like "client_collation";
Variable_name Value
client_collation cp1251_bulgarian_ci
set global character set default, session character set default;
show variables like "client_collation";
Variable_name Value
client_collation latin1_swedish_ci
select @@timestamp>0;
@@timestamp>0
1
......@@ -195,10 +187,6 @@ set GLOBAL table_type=DEFAULT;
Variable 'table_type' doesn't have a default value
set client_collation=UNKNOWN_CHARACTER_SET;
Unknown character set: 'UNKNOWN_CHARACTER_SET'
set character set unknown;
Unknown character set: 'unknown'
set character set 0;
Wrong argument type to variable 'client_collation'
set global autocommit=1;
Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL
select @@global.timestamp;
......
......@@ -143,10 +143,10 @@ SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES koi8r;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET COLLATION koi8r_bin;
SET NAMES koi8r COLLATE koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET COLLATION DEFAULT;
SET NAMES koi8r COLLATE DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES DEFAULT;
......
......@@ -91,12 +91,8 @@ show variables like 'net_buffer_length';
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
set GLOBAL character set cp1251_koi8;
show global variables like "client_collation";
set character set cp1251_koi8;
show variables like "client_collation";
set global character set default, session character set default;
show variables like "client_collation";
select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
......@@ -124,10 +120,6 @@ set SESSION query_cache_size=10000;
set GLOBAL table_type=DEFAULT;
--error 1115
set client_collation=UNKNOWN_CHARACTER_SET;
--error 1115
set character set unknown;
--error 1232
set character set 0;
--error 1228
set global autocommit=1;
--error 1228
......
......@@ -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);
}
return 0;
}
......
......@@ -530,11 +530,14 @@ public:
class set_var_client_collation: public set_var_base
{
CHARSET_INFO *client_charset;
CHARSET_INFO *client_collation;
my_bool convert_result_charset;
public:
set_var_client_collation(CHARSET_INFO *coll_arg ,my_bool conv_arg)
:client_collation(coll_arg), convert_result_charset(conv_arg)
set_var_client_collation(CHARSET_INFO *cset_arg,
CHARSET_INFO *coll_arg ,my_bool conv_arg)
:client_charset(cset_arg), client_collation(coll_arg),
convert_result_charset(conv_arg)
{}
int check(THD *thd);
int update(THD *thd);
......@@ -552,3 +555,4 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);
extern sys_var_str sys_charset;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
......@@ -646,6 +646,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
opt_collate
charset_name
charset_name_or_default
old_or_new_charset_name
old_or_new_charset_name_or_default
collation_name
collation_name_or_default
......@@ -1354,6 +1356,24 @@ charset_name_or_default:
charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
old_or_new_charset_name:
ident_or_text
{
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str)))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
YYABORT;
}
}
| BINARY { $$= &my_charset_bin; }
;
old_or_new_charset_name_or_default:
old_or_new_charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
collation_name:
ident_or_text
{
......@@ -1366,7 +1386,7 @@ collation_name:
opt_collate:
/* empty */ { $$=NULL; }
| COLLATE_SYM collation_name { $$=$2; }
| COLLATE_SYM collation_name_or_default { $$=$2; }
;
collation_name_or_default:
......@@ -4383,56 +4403,15 @@ option_value:
find_sys_var("tx_isolation"),
new Item_int((int32) $4)));
}
| charset set_expr_or_default
{
THD *thd= YYTHD;
LEX *lex= &thd->lex;
if (!$2)
| charset old_or_new_charset_name_or_default
{
CHARSET_INFO *cl= thd->db_charset;
$2= new Item_string(cl->name, strlen(cl->name), &my_charset_latin1);
}
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("client_collation"),
$2));
LEX *lex= Lex;
lex->var_list.push_back(new set_var_client_collation($2,NULL,1));
}
| NAMES_SYM charset_name_or_default opt_collate
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
CHARSET_INFO *cs= $2 ? $2 : thd->db_charset;
CHARSET_INFO *cl= $3 ? $3 : cs;
if (!my_charset_same(cs,cl))
{
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
cl->name,cs->csname);
YYABORT;
}
lex->var_list.push_back(new set_var_client_collation(cl,1));
}
| COLLATION_SYM collation_name_or_default
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
CHARSET_INFO *cs= thd->variables.thd_charset;
CHARSET_INFO *cl= $2;
if (!cl)
{
if (!(cl=get_charset_by_csname(cs->csname,MY_CS_PRIMARY,MYF(0))))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"DEFAULT");
YYABORT;
}
}
else if (!my_charset_same(cs,cl))
{
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
cl->name,cs->csname);
YYABORT;
}
lex->var_list.push_back(new set_var_client_collation(cl,1));
LEX *lex= Lex;
lex->var_list.push_back(new set_var_client_collation($2,$3,1));
}
| 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