aboutsummaryrefslogtreecommitdiff
path: root/dep/mysqllite/sql-common/my_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'dep/mysqllite/sql-common/my_time.c')
-rw-r--r--dep/mysqllite/sql-common/my_time.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/dep/mysqllite/sql-common/my_time.c b/dep/mysqllite/sql-common/my_time.c
index c4e917801d5..38384600fc1 100644
--- a/dep/mysqllite/sql-common/my_time.c
+++ b/dep/mysqllite/sql-common/my_time.c
@@ -76,7 +76,7 @@ uint calc_days_in_year(uint year)
*/
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
- ulong flags, int *was_cut)
+ ulonglong flags, int *was_cut)
{
if (not_zero_date)
{
@@ -158,7 +158,7 @@ my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
- uint flags, int *was_cut)
+ ulonglong flags, int *was_cut)
{
uint field_length, UNINIT_VAR(year_length), digits, i, number_of_fields;
uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS];
@@ -1100,7 +1100,7 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to)
*/
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
- uint flags, int *was_cut)
+ ulonglong flags, int *was_cut)
{
long part1,part2;
@@ -1127,7 +1127,12 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
nr= (nr+19000000L)*1000000L; /* YYMMDD, year: 1970-1999 */
goto ok;
}
- if (nr < 10000101L)
+ /*
+ Though officially we support DATE values from 1000-01-01 only, one can
+ easily insert a value like 1-1-1. So, for consistency reasons such dates
+ are allowed when TIME_FUZZY_DATE is set.
+ */
+ if (nr < 10000101L && !(flags & TIME_FUZZY_DATE))
goto err;
if (nr <= 99991231L)
{