| 1016 | |
| 1017 | |
| 1018 | bool |
| 1019 | time_to_datetime_with_warn(THD *thd, |
| 1020 | const MYSQL_TIME *from, MYSQL_TIME *to, |
| 1021 | date_conv_mode_t fuzzydate) |
| 1022 | { |
| 1023 | int warn= 0; |
| 1024 | DBUG_ASSERT(from->time_type == MYSQL_TIMESTAMP_TIME); |
| 1025 | /* |
| 1026 | After time_to_datetime() we need to do check_date(), as |
| 1027 | the caller may want TIME_NO_ZERO_DATE or TIME_NO_ZERO_IN_DATE. |
| 1028 | Note, the SQL standard time->datetime conversion mode always returns |
| 1029 | a valid date based on CURRENT_DATE. So we need to do check_date() |
| 1030 | only in the old mode. |
| 1031 | */ |
| 1032 | if (time_to_datetime(thd, from, to) || |
| 1033 | ((thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST) && |
| 1034 | check_date(to, fuzzydate, &warn))) |
| 1035 | { |
| 1036 | ErrConvTime str(from); |
| 1037 | thd->push_warning_truncated_wrong_value("datetime", str.ptr()); |
| 1038 | return true; |
| 1039 | } |
| 1040 | return false; |
| 1041 | } |
| 1042 | |
| 1043 | |
| 1044 | longlong pack_time(const MYSQL_TIME *my_time) |
no test coverage detected