Commit 23a5413b authored by hf@genie.(none)'s avatar hf@genie.(none)

Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1

into genie.(none):/home/hf/work/mysql-4.1.lck
parents 43d34726 682435db
...@@ -203,7 +203,6 @@ extern int (*fatal_error_handler_hook)(uint my_err, const char *str, ...@@ -203,7 +203,6 @@ extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
/* charsets */ /* charsets */
extern CHARSET_INFO *default_charset_info; extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *system_charset_info;
extern CHARSET_INFO *all_charsets[256]; extern CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[]; extern CHARSET_INFO compiled_charsets[];
......
...@@ -198,12 +198,19 @@ bool Item::set_charset(CHARSET_INFO *cs1, enum coercion co1, ...@@ -198,12 +198,19 @@ bool Item::set_charset(CHARSET_INFO *cs1, enum coercion co1,
else // co2 == co1 else // co2 == co1
{ {
if (cs1 != cs2) if (cs1 != cs2)
{
if (co1 == COER_EXPLICIT)
{
return 1;
}
else
{ {
CHARSET_INFO *bin= get_charset_by_csname(cs1->csname, MY_CS_BINSORT,MYF(0)); CHARSET_INFO *bin= get_charset_by_csname(cs1->csname, MY_CS_BINSORT,MYF(0));
if (!bin) if (!bin)
return 1; return 1;
set_charset(bin, COER_NOCOLL); set_charset(bin, COER_NOCOLL);
} }
}
else else
set_charset(cs2, co2); set_charset(cs2, co2);
} }
...@@ -987,6 +994,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length) ...@@ -987,6 +994,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length)
str+=2; str+=2;
} }
*ptr=0; // Keep purify happy *ptr=0; // Keep purify happy
coercibility= COER_COERCIBLE;
} }
longlong Item_varbinary::val_int() longlong Item_varbinary::val_int()
......
...@@ -110,8 +110,22 @@ bool Item_bool_func2::set_cmp_charset(CHARSET_INFO *cs1, enum coercion co1, ...@@ -110,8 +110,22 @@ bool Item_bool_func2::set_cmp_charset(CHARSET_INFO *cs1, enum coercion co1,
{ {
if (cs1 == cs2) if (cs1 == cs2)
cmp_charset= cs1; cmp_charset= cs1;
else
{
if (co1 == COER_COERCIBLE)
{
CHARSET_INFO *c= get_charset_by_csname(cs1->csname,MY_CS_PRIMARY,MYF(0));
if (c)
{
cmp_charset= c;
return 0;
}
else else
return 1; return 1;
}
else
return 1;
}
} }
return 0; return 0;
} }
......
...@@ -62,7 +62,9 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); ...@@ -62,7 +62,9 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#endif #endif
#endif #endif
#define files_charset_info system_charset_info extern CHARSET_INFO *system_charset_info;
extern CHARSET_INFO *files_charset_info;
extern CHARSET_INFO *national_charset_info;
/*************************************************************************** /***************************************************************************
Configuration parameters Configuration parameters
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#endif #endif
CHARSET_INFO *system_charset_info= &my_charset_utf8; CHARSET_INFO *system_charset_info= &my_charset_utf8;
CHARSET_INFO *files_charset_info= &my_charset_utf8;
CHARSET_INFO *national_charset_info= &my_charset_utf8;
extern gptr sql_alloc(unsigned size); extern gptr sql_alloc(unsigned size);
extern void sql_element_free(void *ptr); extern void sql_element_free(void *ptr);
static uint32 static uint32
......
...@@ -1134,10 +1134,10 @@ type: ...@@ -1134,10 +1134,10 @@ type:
$$=FIELD_TYPE_STRING; } $$=FIELD_TYPE_STRING; }
| nchar '(' NUM ')' { Lex->length=$3.str; | nchar '(' NUM ')' { Lex->length=$3.str;
$$=FIELD_TYPE_STRING; $$=FIELD_TYPE_STRING;
Lex->charset=&my_charset_utf8; } Lex->charset=national_charset_info; }
| nchar { Lex->length=(char*) "1"; | nchar { Lex->length=(char*) "1";
$$=FIELD_TYPE_STRING; $$=FIELD_TYPE_STRING;
Lex->charset=&my_charset_utf8; } Lex->charset=national_charset_info; }
| BINARY '(' NUM ')' { Lex->length=$3.str; | BINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_STRING; } $$=FIELD_TYPE_STRING; }
...@@ -1145,7 +1145,7 @@ type: ...@@ -1145,7 +1145,7 @@ type:
$$=FIELD_TYPE_VAR_STRING; } $$=FIELD_TYPE_VAR_STRING; }
| nvarchar '(' NUM ')' { Lex->length=$3.str; | nvarchar '(' NUM ')' { Lex->length=$3.str;
$$=FIELD_TYPE_VAR_STRING; $$=FIELD_TYPE_VAR_STRING;
Lex->charset= &my_charset_utf8; } Lex->charset=national_charset_info; }
| VARBINARY '(' NUM ')' { Lex->length=$3.str; | VARBINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_VAR_STRING; } $$=FIELD_TYPE_VAR_STRING; }
...@@ -3865,9 +3865,9 @@ text_literal: ...@@ -3865,9 +3865,9 @@ text_literal:
$$ = new Item_string($1.str,$1.length,cs); $$ = new Item_string($1.str,$1.length,cs);
} }
| NCHAR_STRING | NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,&my_charset_utf8); } { $$= new Item_string($1.str,$1.length,national_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING | UNDERSCORE_CHARSET TEXT_STRING
{ $$ = new Item_string($2.str,$2.length,Lex->charset,Item::COER_IMPLICIT); } { $$ = new Item_string($2.str,$2.length,Lex->charset); }
| text_literal TEXT_STRING_db | text_literal TEXT_STRING_db
{ ((Item_string*) $1)->append($2.str,$2.length); } { ((Item_string*) $1)->append($2.str,$2.length); }
; ;
...@@ -3913,9 +3913,8 @@ literal: ...@@ -3913,9 +3913,8 @@ literal:
{ {
Item *tmp= new Item_varbinary($2.str,$2.length); Item *tmp= new Item_varbinary($2.str,$2.length);
String *str= tmp ? tmp->val_str((String*) 0) : (String*) 0; String *str= tmp ? tmp->val_str((String*) 0) : (String*) 0;
$$ = new Item_string(str ? str->ptr() : "", $$ = new Item_string(str ? str->ptr() : "", str ? str->length() : 0,
str ? str->length() : 0, Lex->charset);
Lex->charset,Item::COER_IMPLICIT);
} }
| DATE_SYM text_literal { $$ = $2; } | DATE_SYM text_literal { $$ = $2; }
| TIME_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; }
......
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