1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 5.3->5.5

This commit is contained in:
Alexander Barkov
2014-06-04 21:53:15 +04:00
24 changed files with 220 additions and 75 deletions

View File

@ -4576,7 +4576,7 @@ int Field_timestamp::store(longlong nr, bool unsigned_val)
{
MYSQL_TIME l_time;
int error;
ErrConvInteger str(nr);
ErrConvInteger str(nr, unsigned_val);
THD *thd= table->in_use;
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
@ -4952,6 +4952,17 @@ int Field_temporal::store_TIME_with_warning(MYSQL_TIME *ltime,
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
#if MARIADB_VERSION_ID < 1000000
/*
Check if the YYYYMMDD part was truncated.
Translate a note into a warning.
In MariaDB-10.0 we have a better warnings/notes handling,
so this code is not needed.
*/
if (was_cut & MYSQL_TIME_NOTE_TRUNCATED)
was_cut|= MYSQL_TIME_WARN_TRUNCATED;
#endif
if (was_cut == 0 &&
have_smth_to_conv == 0 &&
mysql_type_to_time_type(type()) != MYSQL_TIMESTAMP_TIME) // special case: zero date
@ -5042,7 +5053,7 @@ int Field_temporal::store(longlong nr, bool unsigned_val)
MYSQL_TIME ltime;
longlong tmp;
THD *thd= table->in_use;
ErrConvInteger str(nr);
ErrConvInteger str(nr, unsigned_val);
tmp= number_to_datetime(nr, 0, &ltime, (thd->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE |
@ -5140,7 +5151,7 @@ int Field_time::store(double nr)
bool neg= nr < 0;
if (neg)
nr= -nr;
int have_smth_to_conv= !number_to_time(neg, (longlong)nr,
int have_smth_to_conv= !number_to_time(neg, (ulonglong) nr,
(ulong)((nr - floor(nr)) * TIME_SECOND_PART_FACTOR),
&ltime, &was_cut);
@ -5151,9 +5162,12 @@ int Field_time::store(double nr)
int Field_time::store(longlong nr, bool unsigned_val)
{
MYSQL_TIME ltime;
ErrConvInteger str(nr);
ErrConvInteger str(nr, unsigned_val);
int was_cut;
int have_smth_to_conv= !number_to_time(nr < 0, nr < 0 ? -nr : nr,
if (nr < 0 && unsigned_val)
nr= 99991231235959LL + 1;
int have_smth_to_conv= !number_to_time(nr < 0,
(ulonglong) (nr < 0 ? -nr : nr),
0, &ltime, &was_cut);
return store_TIME_with_warning(&ltime, &str, was_cut, have_smth_to_conv);
@ -5520,7 +5534,8 @@ bool Field_year::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
int tmp= (int) ptr[0];
if (tmp || field_length != 4)
tmp+= 1900;
return int_to_datetime_with_warn(tmp * 10000, ltime, fuzzydate, field_name);
return int_to_datetime_with_warn(false, tmp * 10000,
ltime, fuzzydate, field_name);
}