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

Function check_datetime_range

sql-common/my_time.c:194–205  ·  view source on GitHub ↗

Check datetime, date, or normalized time (i.e. time without days) range. @param ltime Datetime value. @returns @retval FALSE on success @retval TRUE on error */

Source from the content-addressed store, hash-verified

192 @retval TRUE on error
193*/
194my_bool check_datetime_range(const MYSQL_TIME *ltime)
195{
196 /*
197 In case of MYSQL_TIMESTAMP_TIME hour value can be up to TIME_MAX_HOUR.
198 In case of MYSQL_TIMESTAMP_DATETIME it cannot be bigger than 23.
199 */
200 return
201 ltime->year > 9999 || ltime->month > 12 || ltime->day > 31 ||
202 ltime->minute > 59 || ltime->second > 59 || ltime->second_part > 999999 ||
203 (ltime->hour >
204 (ltime->time_type == MYSQL_TIMESTAMP_TIME ? TIME_MAX_HOUR : 23));
205}
206
207
208/*

Callers 4

str_to_datetimeFunction · 0.85
number_to_datetimeFunction · 0.85
set_timeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected