diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-09-16 12:40:57 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-09-16 12:41:48 +0400 |
commit | d93399746df8a730109c7363eaf0502923a39e02 (patch) | |
tree | 793d2a8d197ec2679ffe49a642b31666103c7203 /sql/sql_time.cc | |
parent | 171fbbb968ed52dc7e2bbd33a6f8f72bbc6f5e88 (diff) | |
download | mariadb-git-d93399746df8a730109c7363eaf0502923a39e02.tar.gz |
MDEV-17203 Move fractional second truncation from Item_xxx_typecast::get_date() to Time and Datetime constructors
Diffstat (limited to 'sql/sql_time.cc')
-rw-r--r-- | sql/sql_time.cc | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 7b1cb504f08..ee56022a868 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -1185,36 +1185,6 @@ bool time_to_datetime(MYSQL_TIME *ltime) } -/** - Return a valid DATE or DATETIME value from an arbitrary MYSQL_TIME. - If ltime is TIME, it's first converted to DATETIME. - If ts_type is DATE, hhmmss is set to zero. - The date part of the result is checked against fuzzy_date. - - @param ltime The value to convert. - @param fuzzy_date Flags to check date. - @param ts_type The type to convert to. - @return false on success, true of error (negative time).*/ -bool -make_date_with_warn(MYSQL_TIME *ltime, ulonglong fuzzy_date, - timestamp_type ts_type) -{ - DBUG_ASSERT(ts_type == MYSQL_TIMESTAMP_DATE || - ts_type == MYSQL_TIMESTAMP_DATETIME); - if (ltime->time_type == MYSQL_TIMESTAMP_TIME && time_to_datetime(ltime)) - { - /* e.g. negative time */ - ErrConvTime str(ltime); - make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, - &str, ts_type, 0); - return true; - } - if ((ltime->time_type= ts_type) == MYSQL_TIMESTAMP_DATE) - ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; - return check_date_with_warn(ltime, fuzzy_date, ts_type); -} - - /* Convert a TIME value to DAY-TIME interval, e.g. for extraction: EXTRACT(DAY FROM x), EXTRACT(HOUR FROM x), etc. |