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

Use ptr_arg in Field::store_*/Field::val_*

    XMLWordPrintable

Details

    Description

      This task could be splitted by two: one for store_* and one for val_*

      We currently have following problem with Field class:

      • It has methods to store and load values with respect to the data type conversion required:
        store_* and val_* (e.g. Field::val_float(), Field::store_str(),...)
      • Those methods are virtual, and are overridden for certain ancestors to achieve a conversion to and from any fundamental type
      • The problem is: they use Field::ptr internally instead of an explicit argument
      • This leads to that in many places Field::ptr is changed to some value needed, then store_*/val_* ` is called, then it is changed back
        • in many places Field::move_field_offset() is used that. It could be potentially removed completely.

      The task is:

      • Fix all store_* or val_* functions to accept uchar *ptr_arg explicitly. I think it's better to make a new name
        • in particular, we'll soon have Field_varstring::val_str_from_ptr for exactly that purpose
      • Eliminate hither-thither manipulations mentioned, across the code base, by locating Field::move_field_offset usages
      • Add a method that uses Field::ptr back, but make it non-virtual
        • e.g.

          double Field::val_real() const 
          { return val_real_from_ptr(ptr); } 

          and so on

      Attachments

        Activity

          People

            nikitamalyavin Nikita Malyavin
            nikitamalyavin Nikita Malyavin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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