summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 4be74c74134..dafcabe9e3a 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -175,10 +175,10 @@ net_printf(THD *thd, uint errcode, ...)
const char *format;
#ifndef EMBEDDED_LIBRARY
const char *text_pos;
+ int head_length= NET_HEADER_SIZE;
#else
char text_pos[1024];
#endif
- int head_length= NET_HEADER_SIZE;
NET *net= &thd->net;
DBUG_ENTER("net_printf");
@@ -543,7 +543,10 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
/* Store fixed length fields */
pos= (char*) local_packet->ptr()+local_packet->length();
*pos++= 12; // Length of packed fields
- int2store(pos, field.charsetnr);
+ if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
+ int2store(pos, field.charsetnr);
+ else
+ int2store(pos, thd_charset->number);
int4store(pos+2, field.length);
pos[6]= field.type;
int2store(pos+7,field.flags);