mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 5.3->5.5
This commit is contained in:
@ -360,20 +360,23 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
|
||||
int was_cut;
|
||||
longlong res;
|
||||
enum_field_types f_type;
|
||||
bool have_warnings;
|
||||
|
||||
if (fuzzydate & TIME_TIME_ONLY)
|
||||
{
|
||||
fuzzydate= TIME_TIME_ONLY; // clear other flags
|
||||
f_type= MYSQL_TYPE_TIME;
|
||||
res= number_to_time(neg, nr, sec_part, ltime, &was_cut);
|
||||
have_warnings= MYSQL_TIME_WARN_HAVE_WARNINGS(was_cut);
|
||||
}
|
||||
else
|
||||
{
|
||||
f_type= MYSQL_TYPE_DATETIME;
|
||||
res= neg ? -1 : number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut);
|
||||
have_warnings= was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE);
|
||||
}
|
||||
|
||||
if (res < 0 || (was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE)))
|
||||
if (res < 0 || have_warnings)
|
||||
{
|
||||
make_truncated_value_warning(current_thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN, str,
|
||||
@ -416,12 +419,11 @@ bool decimal_to_datetime_with_warn(const my_decimal *value, MYSQL_TIME *ltime,
|
||||
}
|
||||
|
||||
|
||||
bool int_to_datetime_with_warn(longlong value, MYSQL_TIME *ltime,
|
||||
bool int_to_datetime_with_warn(bool neg, ulonglong value, MYSQL_TIME *ltime,
|
||||
ulonglong fuzzydate, const char *field_name)
|
||||
{
|
||||
const ErrConvInteger str(value);
|
||||
bool neg= value < 0;
|
||||
return number_to_time_with_warn(neg, neg ? -value : value, 0, ltime,
|
||||
const ErrConvInteger str(neg ? -value : value, !neg);
|
||||
return number_to_time_with_warn(neg, value, 0, ltime,
|
||||
fuzzydate, &str, field_name);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user