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

Add THD* parameter into Item::get_date() and stricter data type control to "fuzzydate"

    XMLWordPrintable

Details

    Description

      In many places in Item::get_date() we use current_thd. After adding of MDEV-16991, access to THD will be needed at every call of get_date(), to check rounding mode from thd->variables.

      To avoid heavy use of current_thd, we'll add a THD* parameter to Item::get_date().
      Also, at the same time, we'll change "ulonglong fuzzydate" to "date_mode_t fuzzydate".

      After this change, the definition of Item::get_date() will look like this:

        virtual bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)= 0;
      

      Where date_mode_t:

      • will have stricter data type control, so an attempt to pass to Item::get_date() an arbitrary integer value (instead of date_mode_t) won't compile
      • will have a enum-based storage, so in gdb we can see easy readable values instead of integers:

        Breakpoint 1, Item_date_typecast::get_date (this=0x7ffe6c016158, thd=
            0x7ffe6c000b00, ltime=0x7ffff0c1d8f8, fuzzydate=...)
            at /home/bar/maria-git/server.10.4.get_date/sql/item_timefunc.cc:2452
        2452	  date_mode_t tmp= (fuzzydate | sql_mode_for_dates(thd)) & ~TIME_TIME_ONLY;
        (gdb) p fuzzydate
        $1 = {
          m_mode = (date_mode_t::NO_ZERO_IN_DATE | date_mode_t::NO_ZERO_DATE | date_mode_t::INVALID_DATES)}
        

      We'll also change a number of other dependency functions and methods to get "date_mode_t fuzzydate" instead of "ulonglong fuzzydate".

      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.