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

Move the code from Field_str::is_equal() to Field_string::is_equal()

    XMLWordPrintable

Details

    Description

      Field_str in an abstract class with this hierarchy:

      Field_str                        [*]
        Field_longstr
          Field_string
          Field_varstring              [*]
            Field_varstring_compressed
          Field_blob                   [*]
            Field_blob_compressed
            Field_geom                 [*]
        Field_null
          Field_row
        Field_enum                     [*]
          Field_set
      

      [*] marks classes that their own virtual is_equal() implementation.

      Most Field_str descendants completeley override is_equal() and do not share the implementation on the Field_str level.

      Only Field_string and Field_null share Field_str::is_equal().
      If we take a look inside Field_str::is_equal(), it actually implements behavior for CHAR.

      Under term of this task we'll:

      • Move the code from Field_str::is_equal() to Field_string::is_equal()
      • Override Field_null::is_equal() to a simple implementation. The current shared implementation is too exsessive for Field_null, and is going to be even more complex under terms of MDEV-17301. It can be simplified to something like this:

        uint Field_null::is_equal(Create_field *new_field)
        {
          DBUG_ASSERT(!compression_method());
          return new_field->type_handler() == type_handler() &&
                 new_field->charset == field_charset &&
                 new_field->length == max_display_length();
        }
        

      • Remove the default unused implementation Field::is_equal() and define it as a zero pointer:

        virtual uint is_equal(Create_field *new_field)= 0;
        

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.