Commit 7d103311 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-5138 Numerous test failures in "mtr --ps --embedded".

        The function Protocol::net_store_data(a, b, CHARSET_A, CHARSET_B) should
        be adapted to be working in the embedded server as it's done
        with the Protocol::net_store_data(a, b).
        That new function renamed as net_store_data_cs, so we can make it
        virtual.
parent 05722f06
...@@ -1238,7 +1238,7 @@ bool Protocol::net_store_data(const uchar *from, size_t length) ...@@ -1238,7 +1238,7 @@ bool Protocol::net_store_data(const uchar *from, size_t length)
} }
bool Protocol::net_store_data(const uchar *from, size_t length, bool Protocol::net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs) CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
{ {
uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen; uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
......
...@@ -64,7 +64,7 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length) ...@@ -64,7 +64,7 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length)
/* /*
net_store_data() - extended version with character set conversion. net_store_data_cs() - extended version with character set conversion.
It is optimized for short strings whose length after It is optimized for short strings whose length after
conversion is garanteed to be less than 251, which accupies conversion is garanteed to be less than 251, which accupies
...@@ -76,8 +76,12 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length) ...@@ -76,8 +76,12 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length)
*/ */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
bool Protocol::net_store_data(const uchar *from, size_t length, bool Protocol::net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs) CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
#else
bool Protocol_binary::net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
#endif
{ {
uint dummy_errors; uint dummy_errors;
/* Calculate maxumum possible result length */ /* Calculate maxumum possible result length */
...@@ -117,7 +121,6 @@ bool Protocol::net_store_data(const uchar *from, size_t length, ...@@ -117,7 +121,6 @@ bool Protocol::net_store_data(const uchar *from, size_t length,
packet->length((uint) (to - packet->ptr())); packet->length((uint) (to - packet->ptr()));
return 0; return 0;
} }
#endif
/** /**
...@@ -1007,7 +1010,7 @@ bool Protocol::store_string_aux(const char *from, size_t length, ...@@ -1007,7 +1010,7 @@ bool Protocol::store_string_aux(const char *from, size_t length,
tocs != &my_charset_bin) tocs != &my_charset_bin)
{ {
/* Store with conversion */ /* Store with conversion */
return net_store_data((uchar*) from, length, fromcs, tocs); return net_store_data_cs((uchar*) from, length, fromcs, tocs);
} }
/* Store without conversion */ /* Store without conversion */
return net_store_data((uchar*) from, length); return net_store_data((uchar*) from, length);
......
...@@ -43,14 +43,16 @@ protected: ...@@ -43,14 +43,16 @@ protected:
uint field_count; uint field_count;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
bool net_store_data(const uchar *from, size_t length); bool net_store_data(const uchar *from, size_t length);
bool net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
#else #else
virtual bool net_store_data(const uchar *from, size_t length); virtual bool net_store_data(const uchar *from, size_t length);
virtual bool net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
char **next_field; char **next_field;
MYSQL_FIELD *next_mysql_field; MYSQL_FIELD *next_mysql_field;
MEM_ROOT *alloc; MEM_ROOT *alloc;
#endif #endif
bool net_store_data(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
bool store_string_aux(const char *from, size_t length, bool store_string_aux(const char *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs); CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
...@@ -179,6 +181,8 @@ public: ...@@ -179,6 +181,8 @@ public:
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
virtual bool write(); virtual bool write();
bool net_store_data(const uchar *from, size_t length); bool net_store_data(const uchar *from, size_t length);
bool net_store_data_cs(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
#endif #endif
virtual bool store_null(); virtual bool store_null();
virtual bool store_tiny(longlong from); virtual bool store_tiny(longlong from);
......
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