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

Remove Column_definition::key_length

    XMLWordPrintable

Details

    Description

      Let's remove the member Column_definition::key_length and introduce a new virtual method in Type_handler instead:

      virtual uint calc_key_length(const Column_definition &def) const;
      

      Note, key_length is a redundant member. It can be unambiguously calculated, depending on the data type, from:

      • Column_definition::pack_length
      • Column_definition::length
      • Column_definition::interval

      There is no a need to copy this member around the code.

      Removing key_length will simplify the job being done in Type_handler methods:

      • Column_definition_prepare_stage1()
      • Column_definition_redefine_stage1()

      which will give a simpler data type API.

      Also, later this change will simplify to unify these Type_handler methods:

         virtual Field *make_table_field(MEM_ROOT *root,
                                        const LEX_CSTRING *name,
                                        const Record_addr &addr,
                                        const Type_all_attributes &attr,
                                        TABLE *table) const= 0;
      

      and

        virtual Field *
        make_table_field_from_def(TABLE_SHARE *share,
                                  MEM_ROOT *mem_root,
                                  const LEX_CSTRING *name,
                                  const Record_addr &addr,
                                  const Bit_addr &bit,
                                  const Column_definition_attributes *attr,
                                  uint32 flags) const= 0;
      

      into a single method.

      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:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5d
                  0.5d

                  Git Integration

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