summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index c7a6d778953..da7a1187a47 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -228,7 +228,7 @@ static void do_conv_blob(Copy_field *copy)
{
copy->from_field->val_str(&copy->tmp,&copy->tmp);
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(),
- copy->tmp.length());
+ copy->tmp.length(),default_charset_info);
}
/* Save blob in copy->tmp for GROUP BY */
@@ -236,20 +236,20 @@ static void do_conv_blob(Copy_field *copy)
static void do_save_blob(Copy_field *copy)
{
char buff[MAX_FIELD_WIDTH];
- String res(buff,sizeof(buff));
+ String res(buff,sizeof(buff),default_charset_info);
copy->from_field->val_str(&res,&res);
copy->tmp.copy(res);
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(),
- copy->tmp.length());
+ copy->tmp.length(),default_charset_info);
}
static void do_field_string(Copy_field *copy)
{
char buff[MAX_FIELD_WIDTH];
- copy->tmp.set_quick(buff,sizeof(buff));
+ copy->tmp.set_quick(buff,sizeof(buff),default_charset_info);
copy->from_field->val_str(&copy->tmp,&copy->tmp);
- copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length());
+ copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(),default_charset_info);
}
@@ -276,7 +276,7 @@ static void do_cut_string(Copy_field *copy)
ptr != end ;
ptr++)
{
- if (!isspace(*ptr))
+ if (!my_isspace(system_charset_info, *ptr))
{
current_thd->cuted_fields++; // Give a warning
break;
@@ -508,7 +508,8 @@ void field_conv(Field *to,Field *from)
if (!blob->value.is_alloced() &&
from->real_type() != FIELD_TYPE_STRING)
blob->value.copy();
- blob->store(blob->value.ptr(),blob->value.length());
+ blob->store(blob->value.ptr(),blob->value.length(),
+ to->binary()?default_charset_info:((Field_str*)to)->charset());
return;
}
if ((from->result_type() == STRING_RESULT &&
@@ -518,9 +519,11 @@ void field_conv(Field *to,Field *from)
to->type() == FIELD_TYPE_DECIMAL)
{
char buff[MAX_FIELD_WIDTH];
- String result(buff,sizeof(buff));
+ String result(buff,sizeof(buff),default_charset_info);
from->val_str(&result,&result);
- to->store(result.c_ptr_quick(),result.length());
+ to->store(result.c_ptr_quick(),result.length(),
+ to->binary()?default_charset_info:((Field_str*)to)->charset());
+ // QQ: what to do if "from" and "to" are of dirrent charsets?
}
else if (from->result_type() == REAL_RESULT)
to->store(from->val_real());