@@ -43,6 +43,12 @@ bool net_send_eof(THD *thd, uint server_status, uint statement_warn_count);
43
43
static bool write_eof_packet (THD *, NET *, uint, uint);
44
44
#endif
45
45
46
+ CHARSET_INFO *Protocol::character_set_results () const
47
+ {
48
+ return thd->variables .character_set_results ;
49
+ }
50
+
51
+
46
52
#ifndef EMBEDDED_LIBRARY
47
53
bool Protocol::net_store_data (const uchar *from, size_t length)
48
54
#else
@@ -846,12 +852,13 @@ bool Protocol_text::store_field_metadata(const THD * thd,
846
852
847
853
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
848
854
{
849
- if (store (STRING_WITH_LEN (" def" ), cs, thd_charset) ||
850
- store_str (field.db_name , cs, thd_charset) ||
851
- store_str (field.table_name , cs, thd_charset) ||
852
- store_str (field.org_table_name , cs, thd_charset) ||
853
- store_str (field.col_name , cs, thd_charset) ||
854
- store_str (field.org_col_name , cs, thd_charset))
855
+ const LEX_CSTRING def= {STRING_WITH_LEN (" def" )};
856
+ if (store_ident (def) ||
857
+ store_ident (field.db_name ) ||
858
+ store_ident (field.table_name ) ||
859
+ store_ident (field.org_table_name ) ||
860
+ store_ident (field.col_name ) ||
861
+ store_ident (field.org_col_name ))
855
862
return true ;
856
863
if (thd->client_capabilities & MARIADB_CLIENT_EXTENDED_METADATA)
857
864
{
@@ -861,7 +868,7 @@ bool Protocol_text::store_field_metadata(const THD * thd,
861
868
Don't apply character set conversion:
862
869
extended metadata is a binary encoded data.
863
870
*/
864
- if (store_str (metadata.lex_cstring (), cs, &my_charset_bin))
871
+ if (store_lex_cstring (metadata.lex_cstring (), cs, &my_charset_bin))
865
872
return true ;
866
873
}
867
874
if (packet->realloc (packet->length () + 12 ))
@@ -894,8 +901,8 @@ bool Protocol_text::store_field_metadata(const THD * thd,
894
901
}
895
902
else
896
903
{
897
- if (store_str (field.table_name , cs, thd_charset ) ||
898
- store_str (field.col_name , cs, thd_charset ) ||
904
+ if (store_ident (field.table_name ) ||
905
+ store_ident (field.col_name ) ||
899
906
packet->realloc (packet->length () + 10 ))
900
907
return true ;
901
908
pos= (char *) packet->end ();
@@ -1178,9 +1185,7 @@ bool Protocol::store_string_aux(const char *from, size_t length,
1178
1185
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
1179
1186
{
1180
1187
/* 'tocs' is set 0 when client issues SET character_set_results=NULL */
1181
- if (tocs && !my_charset_same (fromcs, tocs) &&
1182
- fromcs != &my_charset_bin &&
1183
- tocs != &my_charset_bin)
1188
+ if (needs_conversion (fromcs, tocs))
1184
1189
{
1185
1190
/* Store with conversion */
1186
1191
return net_store_data_cs ((uchar*) from, length, fromcs, tocs);
@@ -1202,8 +1207,8 @@ bool Protocol::store_warning(const char *from, size_t length)
1202
1207
}
1203
1208
1204
1209
1205
- bool Protocol_text::store (const char *from, size_t length,
1206
- CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
1210
+ bool Protocol_text::store_str (const char *from, size_t length,
1211
+ CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
1207
1212
{
1208
1213
#ifndef DBUG_OFF
1209
1214
DBUG_PRINT (" info" , (" Protocol_text::store field %u (%u): %.*b" , field_pos,
@@ -1216,14 +1221,6 @@ bool Protocol_text::store(const char *from, size_t length,
1216
1221
}
1217
1222
1218
1223
1219
- bool Protocol::store (const char *from, size_t length,
1220
- CHARSET_INFO *fromcs)
1221
- {
1222
- CHARSET_INFO *tocs= this ->thd ->variables .character_set_results ;
1223
- return store (from, length, fromcs, tocs);
1224
- }
1225
-
1226
-
1227
1224
bool Protocol_text::store_tiny (longlong from)
1228
1225
{
1229
1226
#ifndef DBUG_OFF
@@ -1451,8 +1448,8 @@ void Protocol_binary::prepare_for_resend()
1451
1448
}
1452
1449
1453
1450
1454
- bool Protocol_binary::store (const char *from, size_t length,
1455
- CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
1451
+ bool Protocol_binary::store_str (const char *from, size_t length,
1452
+ CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
1456
1453
{
1457
1454
field_pos++;
1458
1455
return store_string_aux (from, length, fromcs, tocs);
@@ -1517,8 +1514,8 @@ bool Protocol_binary::store_decimal(const my_decimal *d)
1517
1514
#endif
1518
1515
StringBuffer<DECIMAL_MAX_STR_LENGTH> str;
1519
1516
(void ) d->to_string (&str);
1520
- return store (str.ptr (), str.length (), str.charset (),
1521
- thd->variables .character_set_results );
1517
+ return store_str (str.ptr (), str.length (), str.charset (),
1518
+ thd->variables .character_set_results );
1522
1519
}
1523
1520
1524
1521
bool Protocol_binary::store (float from, uint32 decimals, String *buffer)
0 commit comments