Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
Description
This code:
uint Item::temporal_precision(enum_field_types type_arg)
|
{
|
if (const_item() && result_type() == STRING_RESULT && |
!is_temporal_type(field_type()))
|
{
|
...
|
!(type_arg == MYSQL_TYPE_TIME ?
|
str_to_time(tmp->charset(), tmp->ptr(), tmp->length(),
|
<ime, TIME_TIME_ONLY, &status) :
|
str_to_datetime(tmp->charset(), tmp->ptr(), tmp->length(),
|
<ime, TIME_FUZZY_DATES, &status)))
|
}
|
...
|
return MY_MIN(decimals, TIME_SECOND_PART_DIGITS); |
}
|
as well as some pieces of the code calling Item::temporal_precision():
class Item_temporal_typecast: public Item_temporal_func |
{
|
..
|
void fix_length_and_dec_generic(uint int_part_len)
|
{
|
if (decimals == NOT_FIXED_DEC) |
decimals= args[0]->temporal_precision(field_type());
|
fix_attributes_temporal(int_part_len, decimals);
|
maybe_null= true; |
}
|
..
|
}
|
are not friendly to pluggable data types, because they use field_type().
Also, we'll have to fix this code when adding TIMESTAMP WITH TIME ZONE and TIME WITH TIME ZONE.
To make the code safe for new data types, we'll split this code into two methods in Type_handler:
+ virtual uint Item_time_precision(Item *item) const; |
+ virtual uint Item_datetime_precision(Item *item) const; |
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed