Commit 05adb8da authored by unknown's avatar unknown

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

into genie.(none):/home/hf/work/mysql-4.1.lck

parents 4809dc74 2dc27531
......@@ -203,7 +203,6 @@ extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
/* charsets */
extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *system_charset_info;
extern CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
......
......@@ -199,10 +199,17 @@ bool Item::set_charset(CHARSET_INFO *cs1, enum coercion co1,
{
if (cs1 != cs2)
{
CHARSET_INFO *bin= get_charset_by_csname(cs1->csname, MY_CS_BINSORT,MYF(0));
if (!bin)
return 1;
set_charset(bin, COER_NOCOLL);
if (co1 == COER_EXPLICIT)
{
return 1;
}
else
{
CHARSET_INFO *bin= get_charset_by_csname(cs1->csname, MY_CS_BINSORT,MYF(0));
if (!bin)
return 1;
set_charset(bin, COER_NOCOLL);
}
}
else
set_charset(cs2, co2);
......@@ -987,6 +994,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length)
str+=2;
}
*ptr=0; // Keep purify happy
coercibility= COER_COERCIBLE;
}
longlong Item_varbinary::val_int()
......
......@@ -111,7 +111,21 @@ bool Item_bool_func2::set_cmp_charset(CHARSET_INFO *cs1, enum coercion co1,
if (cs1 == cs2)
cmp_charset= cs1;
else
return 1;
{
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
return 1;
}
else
return 1;
}
}
return 0;
}
......
......@@ -62,7 +62,9 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#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
......
......@@ -29,6 +29,9 @@
#endif
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 void sql_element_free(void *ptr);
static uint32
......
......@@ -1134,10 +1134,10 @@ type:
$$=FIELD_TYPE_STRING; }
| nchar '(' NUM ')' { Lex->length=$3.str;
$$=FIELD_TYPE_STRING;
Lex->charset=&my_charset_utf8; }
Lex->charset=national_charset_info; }
| nchar { Lex->length=(char*) "1";
$$=FIELD_TYPE_STRING;
Lex->charset=&my_charset_utf8; }
Lex->charset=national_charset_info; }
| BINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_STRING; }
......@@ -1145,7 +1145,7 @@ type:
$$=FIELD_TYPE_VAR_STRING; }
| nvarchar '(' NUM ')' { Lex->length=$3.str;
$$=FIELD_TYPE_VAR_STRING;
Lex->charset= &my_charset_utf8; }
Lex->charset=national_charset_info; }
| VARBINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_VAR_STRING; }
......@@ -3865,9 +3865,9 @@ text_literal:
$$ = new Item_string($1.str,$1.length,cs);
}
| 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
{ $$ = 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
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
......@@ -3913,9 +3913,8 @@ literal:
{
Item *tmp= new Item_varbinary($2.str,$2.length);
String *str= tmp ? tmp->val_str((String*) 0) : (String*) 0;
$$ = new Item_string(str ? str->ptr() : "",
str ? str->length() : 0,
Lex->charset,Item::COER_IMPLICIT);
$$ = new Item_string(str ? str->ptr() : "", str ? str->length() : 0,
Lex->charset);
}
| DATE_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