diff options
author | unknown <dlenev@mysql.com> | 2003-12-04 19:02:48 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2003-12-04 19:02:48 +0300 |
commit | 8f4ed1d72cacfec81737af77c1b215ca7a9ed410 (patch) | |
tree | 9faa25900184562feb188dbb3ebd8bb314797f95 /sql/field.cc | |
parent | 465881c21adc49f0818f26d90cb9ca7203250c1e (diff) | |
download | mariadb-git-8f4ed1d72cacfec81737af77c1b215ca7a9ed410.tar.gz |
Fix undeterministic behaviour of year check
if we failed to classify integer as datetime
in Field_datetime::store().
Stylistic clean-ups.
sql/field.cc:
Fix undeterministic behaviour of year check
if we failed to classify integer as datetime
Stylistic clean-ups.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sql/field.cc b/sql/field.cc index 259314cb4db..1070d0f7b7d 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2569,7 +2569,8 @@ static longlong fix_datetime(longlong nr, TIME *time_res) time_res->minute=(int) part2 / 100; time_res->second=(int) part2 % 100; - if (time_res->month <= 12 && time_res->day <= 31 && time_res->hour <= 23 && + if (time_res->year <= 9999 && time_res->month <= 12 && + time_res->day <= 31 && time_res->hour <= 23 && time_res->minute <= 59 && time_res->second <= 59) return nr; @@ -2584,7 +2585,7 @@ void Field_timestamp::store(longlong nr) TIME l_time; time_t timestamp; - if ((nr=fix_datetime(nr, &l_time))) + if ((nr= fix_datetime(nr, &l_time))) { long not_used; @@ -3432,15 +3433,10 @@ void Field_datetime::store(double nr) void Field_datetime::store(longlong nr) { - TIME l_time; + TIME not_used; - nr=fix_datetime(nr, &l_time); + nr= fix_datetime(nr, ¬_used); - if (l_time.year > 9999) - { - nr=0; - current_thd->cuted_fields++; - } #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) { |