Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23157

Remove redundant virtual Protocol::store()

    XMLWordPrintable

    Details

      Description

      The Protocol class has two similar virtual methods to send string data:

      class Protocol
      {
        ...
        virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
        virtual bool store(const char *from, size_t length,
                          CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
        ...
      };
      

      Both call store_string_aux() internally.

      The first method does not need to be virtual. Let's define it to be non-virtual, as follows:

      class Protocol
      {
        ...
        bool store(const char *from, size_t length, CHARSET_INFO *cs)
        {
          CHARSET_INFO *tocs= thd->variables.character_set_results;
          return store(from, length, fromcs, tocs);
        }
        virtual bool store(const char *from, size_t length,
                          CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
        ..
      };
      

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: