MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / get_date_from_str

Function get_date_from_str

sql/item_cmpfunc.cc:199–209  ·  view source on GitHub ↗

@brief Convert date provided in a string to its packed temporal int representation. @param[in] thd thread handle @param[in] str a string to convert @param[in] warn_type type of the timestamp for issuing the warning @param[in] warn_name field name for issuing the warning @param[out] error_arg could not extract a DATE or DATETIME @details Convert date provid

Source from the content-addressed store, hash-verified

197 converted value. 0 on error and on zero-dates -- check 'failure'
198*/
199static ulonglong get_date_from_str(THD *thd, String *str,
200 timestamp_type warn_type,
201 const char *warn_name, bool *error_arg)
202{
203 MYSQL_TIME l_time;
204 *error_arg= get_mysql_time_from_str(thd, str, warn_type, warn_name, &l_time);
205
206 if (*error_arg)
207 return 0;
208 return TIME_to_longlong_datetime_packed(&l_time);
209}
210
211/*
212 Retrieves correct DATETIME value from given item.

Callers 1

get_datetime_valueFunction · 0.85

Calls 2

get_mysql_time_from_strFunction · 0.85

Tested by

no test coverage detected