[MDEV-16852] Get rid of Item_temporal_hybrid_func::fix_temporal_type() Created: 2018-07-30 Updated: 2018-08-07 Resolved: 2018-07-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types, Temporal Types |
| Fix Version/s: | 10.4.0 |
| Type: | Task | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
The code in Item_temporal_hybrid_func::fix_temporal_type() is not friendly for new data types. We'll remove this method and change val_str_ascii() as follows:
Instead of fix_temporal_type(), we'll add data type conversion functionality directly inside get_date() implementations for the descendant classes by rewriting the code in a linear way, approximately like this:
So later this switch(field_type) itself can be moved to Type_handler easy (under terms of a separate task). The new code in the data-type specific blocks inside the switch will take advantage of the classes Time, Date and Datetime, which already have temporal type conversion functionality (such as TIME->DATETIME, DATETIME->TIME, DATE->DATETIME, DATETIME->DATE, etc). The list of affected descendant classes:
Note, only Item_date_add_interval::get_date() and Item_func_add_time::get_date() need to be rewritten, as Item_func_str_to_date::get_date() already returns the expected MYSQL_TIMESTAMP_XXX value. During this refactoring, we'll make sure not to add too much duplicate code in the per-data-type code branches. |