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