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

Add Type_handler::Item_decimal_scale() and Item_divisor_precision_increment()

Details

    Description

      These pieces of the code are not friendly to pluggable data types:

      uint decimal_scale() const
      {
        return decimals < NOT_FIXED_DEC ? decimals :
               is_temporal_type_with_time(field_type()) ?
               TIME_SECOND_PART_DIGITS :
               MY_MIN(max_length, DECIMAL_MAX_SCALE);
      }
      

      uint divisor_precision_increment() const
      {
        return decimals <  NOT_FIXED_DEC ? decimals :
               is_temporal_type_with_time(field_type()) ?
               TIME_SECOND_PART_DIGITS :
               decimals;
      }
      

      We'll add virtual methods in Type_handler instead:

      virtual uint Item_decimal_scale(const Item *item) const;
      virtual uint Item_divisor_precision_increment(const Item *) const;
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Labels refactoring
            serg Sergei Golubchik made changes -
            Fix Version/s 10.2 [ 14601 ]
            bar Alexander Barkov made changes -
            Summary Add Type_handler::temporal_scale() and Type_handler::decimal_scale() Add Type_handler::Item_decimal_scale() and Item_divisor_precision_increment()
            bar Alexander Barkov made changes -
            Description The relevant pieces of the code in the original type handler patch:
            {code}
            @@ -617,6 +624,8 @@ uint Item::decimal_precision() const
                                                  unsigned_flag);
                 return MY_MIN(prec, DECIMAL_MAX_PRECISION);
               }
            + if (const Type_handler *handler= Type_handlers.handler(field_type()))
            + return handler->decimal_precision();
               return MY_MIN(max_char_length(), DECIMAL_MAX_PRECISION);
             }
            {code}
            {code}
            @@ -638,6 +647,8 @@ uint Item::temporal_precision(enum_field
                                      &ltime, TIME_FUZZY_DATES, &status)))
                   return MY_MIN(status.precision, TIME_SECOND_PART_DIGITS);
               }
            + if (const Type_handler *handler= Type_handlers.handler(field_type()))
            + return handler->temporal_scale();
               return MY_MIN(decimals, TIME_SECOND_PART_DIGITS);
             }
            {code}
            These pieces of the code are not friendly to pluggable data types:
            {code:cpp}
            uint decimal_scale() const
            {
              return decimals < NOT_FIXED_DEC ? decimals :
                     is_temporal_type_with_time(field_type()) ?
                     TIME_SECOND_PART_DIGITS :
                     MY_MIN(max_length, DECIMAL_MAX_SCALE);
            }
            {code}

            {code:cpp}
            uint divisor_precision_increment() const
            {
              return decimals < NOT_FIXED_DEC ? decimals :
                     is_temporal_type_with_time(field_type()) ?
                     TIME_SECOND_PART_DIGITS :
                     decimals;
            }
            {code}

            We'll add virtual methods in {{Type_handler}} instead:

            {code:cpp}
            virtual uint Item_decimal_scale(const Item *item) const;
            virtual uint Item_divisor_precision_increment(const Item *) const;
            {code}

            bar Alexander Barkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]

            Pushed to bb-10.2-ext

            bar Alexander Barkov added a comment - Pushed to bb-10.2-ext
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2017-04-29 17:35:36.0 2017-04-29 17:35:36.797
            bar Alexander Barkov made changes -
            Component/s OTHER [ 10125 ]
            Fix Version/s 10.3.1 [ 22532 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 73611 ] MariaDB v4 [ 132766 ]

            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.