diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-07-17 21:24:29 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-07-17 21:24:29 +0200 |
commit | 97e640b9ae83e07b444fceede6b0524256c7a3cc (patch) | |
tree | 8f48fbfaf88ea7895ce59fd3ac2fbe6184334387 /sql/sql_time.cc | |
parent | 2f6a2494a5eb2cf3ab06fbedd2584eca85d90230 (diff) | |
parent | c7973615e723b13c6457b494b72be2fac35bfd18 (diff) | |
download | mariadb-git-97e640b9ae83e07b444fceede6b0524256c7a3cc.tar.gz |
5.5 merge
Diffstat (limited to 'sql/sql_time.cc')
-rw-r--r-- | sql/sql_time.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 89c2e3b7086..e9fda9be0b1 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -214,6 +214,22 @@ ulong convert_month_to_period(ulong month) } +bool +check_date_with_warn(const MYSQL_TIME *ltime, ulonglong fuzzy_date, + timestamp_type ts_type) +{ + int dummy_warnings; + if (check_date(ltime, fuzzy_date, &dummy_warnings)) + { + ErrConvTime str(ltime); + make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + &str, ts_type, 0); + return true; + } + return false; +} + + /* Convert a string to 8-bit representation, for use in str_to_time/str_to_date/str_to_date. @@ -316,7 +332,7 @@ str_to_datetime_with_warn(CHARSET_INFO *cs, @param nr integer part of the number to convert @param sec_part microsecond part of the number @param ltime converted value will be written here - @param fuzzydate conversion flags (TIME_FUZZY_DATE, etc) + @param fuzzydate conversion flags (TIME_INVALID_DATE, etc) @param str original number, as an ErrConv. For the warning @param field_name field name or NULL if not a field. For the warning @@ -333,6 +349,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, 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); } @@ -342,7 +359,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, res= neg ? -1 : number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut); } - if (res < 0 || (was_cut && !(fuzzydate & TIME_FUZZY_DATE))) + if (res < 0 || (was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE))) { make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, str, |