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

Move the code from Item_extract::val_int() to a new class Extract_source

    XMLWordPrintable

Details

    Description

      The new code responsible for rounding (MDEV-16991) will reside inside class Temporal.
      To take advantage of this rounding functionality easier, we'll move the code from Item_extract::val_int() to a new class:

      class Extract_source: public Temporal
      {
      ...
      };
      

      The code in Item_extract::val_int() will change from:

      MYSQL_TIME ltime;
      if ((null_value= args[0]->get_date(current_thd, &ltime, is_time_flag)))
        return 0;
      switch (int_type) {
      case INTERVAL_YEAR:          return ltime.year;
      case INTERVAL_YEAR_MONTH:    return ltime.year*100L+ltime.month;
      case INTERVAL_QUARTER:       return (ltime.month+2)/3;
      ...
      }
      

      to:

      Extract_source dt(current_thd, args[0], m_date_mode);
      if ((null_value= !dt.is_valid_extract_source()))
        return 0;
      switch (int_type) {
      case INTERVAL_YEAR:                return dt.year();
      case INTERVAL_YEAR_MONTH:          return dt.year_month();
      case INTERVAL_QUARTER:             return dt.quarter();
      ...
      }
      

      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.