Commit 13d28097 authored by unknown's avatar unknown

Merge abarkov@build.mysql.com:/home/bk/mysql-4.1

into bar.mysql.r18.ru:/usr/home/bar/mysql-4.1

parents a6e8de84 fa2dfa01
...@@ -5163,7 +5163,7 @@ void Field_set::sql_type(String &res) const ...@@ -5163,7 +5163,7 @@ void Field_set::sql_type(String &res) const
bool Field::eq_def(Field *field) bool Field::eq_def(Field *field)
{ {
if (real_type() != field->real_type() || binary() != field->binary() || if (real_type() != field->real_type() || charset() != field->charset() ||
pack_length() != field->pack_length()) pack_length() != field->pack_length())
return 0; return 0;
return 1; return 1;
......
...@@ -507,8 +507,7 @@ static void make_sortkey(register SORTPARAM *param, ...@@ -507,8 +507,7 @@ static void make_sortkey(register SORTPARAM *param,
if (res->ptr() != (char*) to) if (res->ptr() != (char*) to)
memcpy(to,res->ptr(),length); memcpy(to,res->ptr(),length);
bzero((char *)to+length,diff); bzero((char *)to+length,diff);
if (!item->binary()) my_tosort(cs, (char*) to,length);
my_tosort(cs, (char*) to,length);
} }
break; break;
} }
...@@ -918,6 +917,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset) ...@@ -918,6 +917,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
{ {
reg2 uint length; reg2 uint length;
THD *thd= current_thd; THD *thd= current_thd;
CHARSET_INFO *cs;
*multi_byte_charset= 0; *multi_byte_charset= 0;
length=0; length=0;
...@@ -926,20 +926,17 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset) ...@@ -926,20 +926,17 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
sortorder->need_strxnfrm= 0; sortorder->need_strxnfrm= 0;
if (sortorder->field) if (sortorder->field)
{ {
if (sortorder->field->type() == FIELD_TYPE_BLOB) if (sortorder->field->type() == FIELD_TYPE_BLOB)
sortorder->length= thd->variables.max_sort_length; sortorder->length= thd->variables.max_sort_length;
else else
{ {
sortorder->length=sortorder->field->pack_length(); sortorder->length=sortorder->field->pack_length();
if (!sortorder->field->binary()) if (use_strnxfrm((cs=sortorder->field->charset())))
{ {
CHARSET_INFO *cs=sortorder->field->charset(); sortorder->need_strxnfrm= 1;
if (use_strnxfrm(cs)) *multi_byte_charset= 1;
{ sortorder->length= sortorder->length*cs->strxfrm_multiply;
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
sortorder->length= sortorder->length*cs->strxfrm_multiply;
}
} }
} }
if (sortorder->field->maybe_null()) if (sortorder->field->maybe_null())
...@@ -950,15 +947,11 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset) ...@@ -950,15 +947,11 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
switch ((sortorder->result_type=sortorder->item->result_type())) { switch ((sortorder->result_type=sortorder->item->result_type())) {
case STRING_RESULT: case STRING_RESULT:
sortorder->length=sortorder->item->max_length; sortorder->length=sortorder->item->max_length;
if (!sortorder->item->binary()) if (use_strnxfrm((cs=sortorder->item->charset())))
{ {
CHARSET_INFO *cs=sortorder->item->charset(); sortorder->length= sortorder->length*cs->strxfrm_multiply;
if (use_strnxfrm(cs)) sortorder->need_strxnfrm= 1;
{ *multi_byte_charset= 1;
sortorder->length= sortorder->length*cs->strxfrm_multiply;
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
}
} }
break; break;
case INT_RESULT: case INT_RESULT:
......
...@@ -1024,7 +1024,7 @@ longlong Item_func_char_length::val_int() ...@@ -1024,7 +1024,7 @@ longlong Item_func_char_length::val_int()
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
} }
null_value=0; null_value=0;
return (longlong) (!args[0]->binary()) ? res->numchars() : res->length(); return (longlong) res->numchars();
} }
longlong Item_func_coercibility::val_int() longlong Item_func_coercibility::val_int()
...@@ -1156,7 +1156,7 @@ longlong Item_func_ord::val_int() ...@@ -1156,7 +1156,7 @@ longlong Item_func_ord::val_int()
null_value=0; null_value=0;
if (!res->length()) return 0; if (!res->length()) return 0;
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->charset()) && !args[0]->binary()) if (use_mb(res->charset()))
{ {
register const char *str=res->ptr(); register const char *str=res->ptr();
register uint32 n=0, l=my_ismbchar(res->charset(),str,str+res->length()); register uint32 n=0, l=my_ismbchar(res->charset(),str,str+res->length());
......
...@@ -650,7 +650,7 @@ String *Item_func_reverse::val_str(String *str) ...@@ -650,7 +650,7 @@ String *Item_func_reverse::val_str(String *str)
ptr = (char *) res->ptr(); ptr = (char *) res->ptr();
end=ptr+res->length(); end=ptr+res->length();
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->charset()) && !binary()) if (use_mb(res->charset()))
{ {
String tmpstr; String tmpstr;
tmpstr.copy(*res); tmpstr.copy(*res);
...@@ -1015,7 +1015,7 @@ String *Item_func_substr_index::val_str(String *str) ...@@ -1015,7 +1015,7 @@ String *Item_func_substr_index::val_str(String *str)
return &empty_string; // Wrong parameters return &empty_string; // Wrong parameters
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->charset()) && !binary()) if (use_mb(res->charset()))
{ {
const char *ptr=res->ptr(); const char *ptr=res->ptr();
const char *strend = ptr+res->length(); const char *strend = ptr+res->length();
...@@ -1169,7 +1169,7 @@ String *Item_func_rtrim::val_str(String *str) ...@@ -1169,7 +1169,7 @@ String *Item_func_rtrim::val_str(String *str)
{ {
char chr=(*remove_str)[0]; char chr=(*remove_str)[0];
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->charset()) && !binary()) if (use_mb(res->charset()))
{ {
while (ptr < end) while (ptr < end)
{ {
...@@ -1186,7 +1186,7 @@ String *Item_func_rtrim::val_str(String *str) ...@@ -1186,7 +1186,7 @@ String *Item_func_rtrim::val_str(String *str)
{ {
const char *r_ptr=remove_str->ptr(); const char *r_ptr=remove_str->ptr();
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->charset()) && !binary()) if (use_mb(res->charset()))
{ {
loop: loop:
while (ptr + remove_length < end) while (ptr + remove_length < end)
...@@ -1237,7 +1237,7 @@ String *Item_func_trim::val_str(String *str) ...@@ -1237,7 +1237,7 @@ String *Item_func_trim::val_str(String *str)
while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length)) while (ptr+remove_length <= end && !memcmp(ptr,r_ptr,remove_length))
ptr+=remove_length; ptr+=remove_length;
#ifdef USE_MB #ifdef USE_MB
if (use_mb(res->charset()) && !binary()) if (use_mb(res->charset()))
{ {
char *p=ptr; char *p=ptr;
register uint32 l; register uint32 l;
......
...@@ -732,7 +732,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) ...@@ -732,7 +732,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
{ {
if (must_be_blob) if (must_be_blob)
{ {
if (item->binary()) if (item->charset() == &my_charset_bin)
answer->append("TINYBLOB", 8); answer->append("TINYBLOB", 8);
else else
answer->append("TINYTEXT", 8); answer->append("TINYTEXT", 8);
...@@ -750,21 +750,21 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows) ...@@ -750,21 +750,21 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
} }
else if (max_length < (1L << 16)) else if (max_length < (1L << 16))
{ {
if (item->binary()) if (item->charset() == &my_charset_bin)
answer->append("BLOB", 4); answer->append("BLOB", 4);
else else
answer->append("TEXT", 4); answer->append("TEXT", 4);
} }
else if (max_length < (1L << 24)) else if (max_length < (1L << 24))
{ {
if (item->binary()) if (item->charset() == &my_charset_bin)
answer->append("MEDIUMBLOB", 10); answer->append("MEDIUMBLOB", 10);
else else
answer->append("MEDIUMTEXT", 10); answer->append("MEDIUMTEXT", 10);
} }
else else
{ {
if (item->binary()) if (item->charset() == &my_charset_bin)
answer->append("LONGBLOB", 8); answer->append("LONGBLOB", 8);
else else
answer->append("LONGTEXT", 8); answer->append("LONGTEXT", 8);
......
...@@ -359,8 +359,6 @@ static char *get_text(LEX *lex) ...@@ -359,8 +359,6 @@ static char *get_text(LEX *lex)
*to=0; *to=0;
lex->yytoklen=(uint) (to-start); lex->yytoklen=(uint) (to-start);
} }
if (lex->convert_set)
lex->convert_set->convert((char*) start,lex->yytoklen);
return (char*) start; return (char*) start;
} }
} }
...@@ -849,6 +847,8 @@ int yylex(void *arg, void *yythd) ...@@ -849,6 +847,8 @@ int yylex(void *arg, void *yythd)
break; break;
} }
yylval->lex_str.length=lex->yytoklen; yylval->lex_str.length=lex->yytoklen;
if (lex->convert_set)
lex->convert_set->convert((char*) yylval->lex_str.str,lex->yytoklen);
return(TEXT_STRING); return(TEXT_STRING);
case STATE_COMMENT: // Comment case STATE_COMMENT: // Comment
......
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