Details
- 
    Task 
- 
    Status: Closed (View Workflow)
- 
    Major 
- 
    Resolution: Fixed
- 
    None
Description
The new code responsible for rounding (MDEV-16991) will reside inside class Temporal.
To take advantage of this rounding functionality easier, we'll move the code from Item_extract::val_int() to a new class:
| class Extract_source: public Temporal | 
| { | 
| ... | 
| };
 | 
The code in Item_extract::val_int() will change from:
| MYSQL_TIME ltime; | 
| if ((null_value= args[0]->get_date(current_thd, <ime, is_time_flag))) | 
| return 0; | 
| switch (int_type) { | 
| case INTERVAL_YEAR: return ltime.year; | 
| case INTERVAL_YEAR_MONTH: return ltime.year*100L+ltime.month; | 
| case INTERVAL_QUARTER: return (ltime.month+2)/3; | 
| ... | 
| }
 | 
to:
| Extract_source dt(current_thd, args[0], m_date_mode); | 
| if ((null_value= !dt.is_valid_extract_source())) | 
| return 0; | 
| switch (int_type) { | 
| case INTERVAL_YEAR: return dt.year(); | 
| case INTERVAL_YEAR_MONTH: return dt.year_month(); | 
| case INTERVAL_QUARTER: return dt.quarter(); | 
| ... | 
| }
 | 
Attachments
Issue Links
- blocks
- 
                    MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP -         
- Closed
 
-