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

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

                Dates

                Created:
                Updated:
                Resolved: