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

Function check_date

sql-common/my_time.c:120–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118*/
119
120my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
121 ulonglong flags, int *was_cut)
122{
123 if (not_zero_date)
124 {
125 if (((flags & TIME_NO_ZERO_IN_DATE) || !(flags & TIME_FUZZY_DATE)) &&
126 (ltime->month == 0 || ltime->day == 0))
127 {
128 *was_cut= MYSQL_TIME_WARN_ZERO_IN_DATE;
129 return TRUE;
130 }
131 else if ((!(flags & TIME_INVALID_DATES) &&
132 ltime->month && ltime->day > days_in_month[ltime->month-1] &&
133 (ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
134 ltime->day != 29)))
135 {
136 *was_cut= MYSQL_TIME_WARN_OUT_OF_RANGE;
137 return TRUE;
138 }
139 }
140 else if (flags & TIME_NO_ZERO_DATE)
141 {
142 *was_cut= MYSQL_TIME_WARN_ZERO_DATE;
143 return TRUE;
144 }
145 return FALSE;
146}
147
148
149/**

Callers 4

str_to_datetimeFunction · 0.85
number_to_datetimeFunction · 0.85
get_dateMethod · 0.85

Calls 1

calc_days_in_yearFunction · 0.85

Tested by

no test coverage detected