summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc30
1 files changed, 10 insertions, 20 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index c7ce38eadac..af8f966a4b6 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -43,11 +43,6 @@ bool Protocol::net_store_data(const char *from, uint length)
packet->length((uint) (to+length-packet->ptr()));
return 0;
}
-
-inline bool Protocol::convert_str(const char *from, uint length)
-{
- return convert->store(packet, from, length);
-}
#endif
@@ -472,7 +467,6 @@ char *net_store_data(char *to,longlong from)
void Protocol::init(THD *thd_arg)
{
thd=thd_arg;
- convert=thd->variables.convert_set;
packet= &thd->packet;
#ifndef DEBUG_OFF
field_types= 0;
@@ -487,15 +481,12 @@ void Protocol::init(THD *thd_arg)
send_fields()
THD Thread data object
list List of items to send to client
- convert object used to convertation to another character set
flag Bit mask with the following functions:
1 send number of rows
2 send default values
DESCRIPTION
Sum fields has table name empty and field_name.
- Uses send_fields_convert() and send_fields() depending on
- if we have an active character set convert or not.
RETURN VALUES
0 ok
@@ -712,9 +703,6 @@ bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *cs)
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
field_pos++;
#endif
- if (convert)
- return convert_str(from, length);
-#if 0
if (cs != this->thd->charset())
{
String tmp;
@@ -722,7 +710,6 @@ bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *cs)
return net_store_data(tmp.ptr(), tmp.length());
}
else
-#endif
return net_store_data(from, length);
}
@@ -813,11 +800,16 @@ bool Protocol_simple::store(Field *field)
field_pos++;
#endif
char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff), &my_charset_bin);
- field->val_str(&tmp,&tmp);
- if (convert)
- return convert_str(tmp.ptr(), tmp.length());
- return net_store_data(tmp.ptr(), tmp.length());
+ String tmp1(buff,sizeof(buff), &my_charset_bin);
+ field->val_str(&tmp1,&tmp1);
+ if (field->charset() != this->thd->charset())
+ {
+ String tmp;
+ tmp.copy(tmp1.ptr(), tmp1.length(), tmp1.charset(), this->thd->charset());
+ return net_store_data(tmp.ptr(), tmp.length());
+ }
+ else
+ return net_store_data(tmp1.ptr(), tmp1.length());
}
@@ -924,8 +916,6 @@ bool Protocol_prep::store(const char *from,uint length, CHARSET_INFO *cs)
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
#endif
field_pos++;
- if (convert)
- return convert_str(from, length);
return net_store_data(from, length);
}