Commit 1b7471a4 authored by unknown's avatar unknown

remove default_charset_info


sql/field.h:
  New function to get charset
parent 9a0253ff
......@@ -251,6 +251,7 @@ public:
friend class create_field;
void make_field(Send_field *);
uint size_of() const { return sizeof(*this); }
inline CHARSET_INFO *charset() const { return field_charset; }
inline int cmp_image(char *buff,uint length)
{
if (binary())
......
......@@ -205,7 +205,7 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
err:
#ifdef USE_STRCOLL
if (use_strcoll(default_charset_info))
if (param.tmp_buffer)
x_free(param.tmp_buffer);
#endif
x_free((gptr) sort_keys);
......@@ -470,6 +470,9 @@ static void make_sortkey(register SORTPARAM *param,
switch (sort_field->result_type) {
case STRING_RESULT:
{
// BAR TODO: need checking that it is really Field_str based class
CHARSET_INFO *cs=((Field_str*)(sort_field->field))->charset();
if (item->maybe_null)
*to++=1;
/* All item->str() to use some extra byte for end null.. */
......@@ -495,7 +498,7 @@ static void make_sortkey(register SORTPARAM *param,
length=sort_field->length;
}
#ifdef USE_STRCOLL
if (use_strcoll(default_charset_info))
if(use_strcoll(cs))
{
if (item->binary)
{
......@@ -512,8 +515,7 @@ static void make_sortkey(register SORTPARAM *param,
memcpy(param->tmp_buffer,from,length);
from=param->tmp_buffer;
}
uint tmp_length=my_strnxfrm(default_charset_info,
to,sort_field->length,
uint tmp_length=my_strnxfrm(cs,to,sort_field->length,
(unsigned char *) from, length);
if (tmp_length < sort_field->length)
bzero((char*) to+tmp_length,sort_field->length-tmp_length);
......@@ -526,7 +528,7 @@ static void make_sortkey(register SORTPARAM *param,
memcpy(to,res->ptr(),length);
bzero((char *)to+length,diff);
if (!item->binary)
case_sort(default_charset_info, (char*) to,length);
case_sort(cs, (char*) to,length);
#ifdef USE_STRCOLL
}
#endif
......@@ -923,8 +925,10 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
{
sortorder->length=sortorder->field->pack_length();
#ifdef USE_STRCOLL
if (use_strcoll(default_charset_info) && !sortorder->field->binary())
sortorder->length= sortorder->length*default_charset_info->strxfrm_multiply;
// BAR TODO: need checking that it is really Field_str based class
CHARSET_INFO *cs=((Field_str*)(sortorder->field))->charset();
if (use_strcoll(cs) && !sortorder->field->binary())
sortorder->length= sortorder->length*cs->strxfrm_multiply;
#endif
}
if (sortorder->field->maybe_null())
......@@ -932,12 +936,16 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
}
else
{
#ifdef USE_STRCOLL
// BAR TODO: need checking that it is really Field_str based class
CHARSET_INFO *cs=((Field_str*)(sortorder->field))->charset();
#endif
switch ((sortorder->result_type=sortorder->item->result_type())) {
case STRING_RESULT:
sortorder->length=sortorder->item->max_length;
#ifdef USE_STRCOLL
if (use_strcoll(default_charset_info) && !sortorder->item->binary)
sortorder->length= sortorder->length*default_charset_info->strxfrm_multiply;
if (use_strcoll(cs) && !sortorder->item->binary)
sortorder->length= sortorder->length*cs->strxfrm_multiply;
#endif
break;
case INT_RESULT:
......
......@@ -974,9 +974,10 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
&min_length,&max_length);
else
{
CHARSET_INFO *charset=((Field_str*)(field))->charset();
#ifdef USE_STRCOLL
if (use_strcoll(default_charset_info))
like_error= my_like_range(default_charset_info,
if (use_strcoll(charset))
like_error= my_like_range(charset,
res->ptr(),res->length(),wild_prefix,
field_length, min_str+maybe_null,
max_str+maybe_null,&min_length,&max_length);
......@@ -985,7 +986,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
like_error=like_range(res->ptr(),res->length(),wild_prefix,
field_length,
min_str+offset,max_str+offset,
default_charset_info->max_sort_char,
charset->max_sort_char,
&min_length,&max_length);
}
if (like_error) // Can't optimize with LIKE
......
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