Skip to content

Commit 30e7a0a

Browse files
committed
MDEV-23157 Remove redundant virtual Protocol::store()
1 parent 5967dfd commit 30e7a0a

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

sql/protocol.cc

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,25 +1206,21 @@ bool Protocol_text::store(const char *from, size_t length,
12061206
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
12071207
{
12081208
#ifndef DBUG_OFF
1209+
DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %.*b", field_pos,
1210+
field_count, (int) length, (length == 0 ? "" : from)));
1211+
DBUG_ASSERT(field_handlers == 0 || field_pos < field_count);
12091212
DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_STRING));
12101213
field_pos++;
12111214
#endif
12121215
return store_string_aux(from, length, fromcs, tocs);
12131216
}
12141217

12151218

1216-
bool Protocol_text::store(const char *from, size_t length,
1217-
CHARSET_INFO *fromcs)
1219+
bool Protocol::store(const char *from, size_t length,
1220+
CHARSET_INFO *fromcs)
12181221
{
12191222
CHARSET_INFO *tocs= this->thd->variables.character_set_results;
1220-
#ifndef DBUG_OFF
1221-
DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %.*b", field_pos,
1222-
field_count, (int) length, (length == 0 ? "" : from)));
1223-
DBUG_ASSERT(field_handlers == 0 || field_pos < field_count);
1224-
DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_STRING));
1225-
field_pos++;
1226-
#endif
1227-
return store_string_aux(from, length, fromcs, tocs);
1223+
return store(from, length, fromcs, tocs);
12281224
}
12291225

12301226

@@ -1455,14 +1451,6 @@ void Protocol_binary::prepare_for_resend()
14551451
}
14561452

14571453

1458-
bool Protocol_binary::store(const char *from, size_t length,
1459-
CHARSET_INFO *fromcs)
1460-
{
1461-
CHARSET_INFO *tocs= thd->variables.character_set_results;
1462-
field_pos++;
1463-
return store_string_aux(from, length, fromcs, tocs);
1464-
}
1465-
14661454
bool Protocol_binary::store(const char *from, size_t length,
14671455
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
14681456
{
@@ -1526,11 +1514,11 @@ bool Protocol_binary::store_decimal(const my_decimal *d)
15261514
{
15271515
#ifndef DBUG_OFF
15281516
DBUG_ASSERT(0); // This method is not used yet
1529-
field_pos++;
15301517
#endif
15311518
StringBuffer<DECIMAL_MAX_STR_LENGTH> str;
15321519
(void) d->to_string(&str);
1533-
return store(str.ptr(), str.length(), str.charset());
1520+
return store(str.ptr(), str.length(), str.charset(),
1521+
thd->variables.character_set_results);
15341522
}
15351523

15361524
bool Protocol_binary::store(float from, uint32 decimals, String *buffer)

sql/protocol.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Protocol
120120
virtual bool store_long(longlong from)=0;
121121
virtual bool store_longlong(longlong from, bool unsigned_flag)=0;
122122
virtual bool store_decimal(const my_decimal *)=0;
123-
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs)=0;
123+
bool store(const char *from, size_t length, CHARSET_INFO *cs);
124124
virtual bool store(const char *from, size_t length,
125125
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
126126
bool store_str(const LEX_CSTRING &s, CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
@@ -178,7 +178,6 @@ class Protocol_text :public Protocol
178178
virtual bool store_long(longlong from);
179179
virtual bool store_longlong(longlong from, bool unsigned_flag);
180180
virtual bool store_decimal(const my_decimal *);
181-
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
182181
virtual bool store(const char *from, size_t length,
183182
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
184183
virtual bool store(MYSQL_TIME *time, int decimals);
@@ -223,7 +222,6 @@ class Protocol_binary :public Protocol
223222
virtual bool store_long(longlong from);
224223
virtual bool store_longlong(longlong from, bool unsigned_flag);
225224
virtual bool store_decimal(const my_decimal *);
226-
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
227225
virtual bool store(const char *from, size_t length,
228226
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
229227
virtual bool store(MYSQL_TIME *time, int decimals);
@@ -272,7 +270,6 @@ class Protocol_discard : public Protocol_text
272270
bool store_long(longlong) { return false; }
273271
bool store_longlong(longlong, bool) { return false; }
274272
bool store_decimal(const my_decimal *) { return false; }
275-
bool store(const char *, size_t, CHARSET_INFO *) { return false; }
276273
bool store(const char *, size_t, CHARSET_INFO *, CHARSET_INFO *) { return false; }
277274
bool store(MYSQL_TIME *, int) { return false; }
278275
bool store_date(MYSQL_TIME *) { return false; }

0 commit comments

Comments
 (0)