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

Store scale in Column_definition::decimals rather than Column_definition::pack_flag

    XMLWordPrintable

Details

    Description

      In order to simplify the unification of 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;
      

      let's do the following:

      • Move Column_definition::decimals to the parent class Column_definition_attributes
      • When loading a column definition from a FRM file, instead of mixing numeric scale to Column_definition_attributes::pack_flag, store it to Column_definition_attributes::decimals. This will be done in virtual implementation of Type_handler_xxx::Column_definition_attributes_frm_unpack().
      • Mix (decimals << FIELDFLAG_DEC_SHIFT) to pack_flag only before storing it to the FRM. This will be done in virtual implementation of Type_handler_xxx::Column_definition_attributes_frm_pack().

      As a result:

      • Column_definition_attributes::decimals will always be up-to-date.
      • Column_definition_attributes::pack_flag will never contain the decimal scale

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.