MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP

This commit is contained in:
Alexander Barkov 2018-11-23 19:04:42 +04:00
commit 4447a02cf1
59 changed files with 4771 additions and 395 deletions

View file

@ -258,8 +258,11 @@ namespace mrn {
Item *real_value_item = value_item->real_item();
switch (field_item->field->type()) {
case MYSQL_TYPE_TIME:
error = real_value_item->get_time(current_thd, mysql_time);
{
THD *thd= current_thd;
error= real_value_item->get_date(thd, mysql_time, Time::Options(thd));
break;
}
case MYSQL_TYPE_YEAR:
mysql_time->year = static_cast<int>(value_item->val_int());
mysql_time->month = 1;
@ -273,9 +276,13 @@ namespace mrn {
error = false;
break;
default:
error = real_value_item->get_date(current_thd, mysql_time, TIME_FUZZY_DATES);
{
THD *thd= current_thd;
Datetime::Options opt(TIME_FUZZY_DATES, thd);
error = real_value_item->get_date(thd, mysql_time, opt);
break;
}
}
DBUG_RETURN(error);
}