Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
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
- blocks
-
MDEV-4912 Data type plugin API version 1
-
- Closed
-
Activity
Labels | refactoring |
Fix Version/s | 10.2 [ 14601 ] |
Summary | Add Type_handler::temporal_scale() and Type_handler::decimal_scale() | Add Type_handler::Item_decimal_scale() and Item_divisor_precision_increment() |
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 <ime, 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} |
Status | Open [ 1 ] | In Progress [ 3 ] |
issue.field.resolutiondate | 2017-04-29 17:35:36.0 | 2017-04-29 17:35:36.797 |
Component/s | OTHER [ 10125 ] | |
Fix Version/s | 10.3.1 [ 22532 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 73611 ] | MariaDB v4 [ 132766 ] |
Pushed to bb-10.2-ext