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

Remove tests for field_type() in Item_cache_temporal

    XMLWordPrintable

Details

    Description

      Item_cache_temporal has the following methods with tests for field_type():

      longlong Item_cache_temporal::val_datetime_packed()
      {
        if (Item_cache_temporal::field_type() == MYSQL_TYPE_TIME)
          return Item::val_datetime_packed(); // TIME-to-DATETIME conversion needed
        if ((!value_cached && !cache_value()) || null_value)
        {
          null_value= TRUE;
          return 0;
        }
        return value;
      }
      

      longlong Item_cache_temporal::val_time_packed()
      {
        if (Item_cache_temporal::field_type() != MYSQL_TYPE_TIME)
          return Item::val_time_packed(); // DATETIME-to-TIME conversion needed
        if ((!value_cached && !cache_value()) || null_value)
        {
          null_value= TRUE;
          return 0;
        }
        return value;
      }
      

      Tests for field_type() are not friendly for user defined data types (plugins) and should all be eventually gone.

      Under terms of this task we'll move implementations of val_datetime_packed() and val_time_packed() from Item_cache_temporal to its descendants:

      • Item_cache_date
      • Item_cache_time
      • Item_catche_datetime

      and thus remove the need to test field_type().

      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.