mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge mysql.com:/home/jimw/my/mysql-5.0-5906
into mysql.com:/home/jimw/my/mysql-5.0-clean
This commit is contained in:
commit
d7fbff3ec5
15 changed files with 217 additions and 194 deletions
|
@ -53,7 +53,7 @@ enum enum_mysql_timestamp_type
|
||||||
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||||
uint flags, int *was_cut);
|
uint flags, int *was_cut);
|
||||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||||
my_bool fuzzy_date, int *was_cut);
|
uint flags, int *was_cut);
|
||||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
|
||||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
|
||||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
|
||||||
|
|
|
@ -3585,7 +3585,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
|
||||||
case MYSQL_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
{
|
{
|
||||||
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
|
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
|
||||||
(void) str_to_datetime(value, length, tm, 0, &err);
|
(void) str_to_datetime(value, length, tm, TIME_FUZZY_DATE, &err);
|
||||||
*param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE &&
|
*param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE &&
|
||||||
tm->time_type != MYSQL_TIMESTAMP_DATE);
|
tm->time_type != MYSQL_TIMESTAMP_DATE);
|
||||||
break;
|
break;
|
||||||
|
@ -3703,7 +3703,8 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||||
case MYSQL_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
value= number_to_datetime(value, (MYSQL_TIME *) buffer, 1, &error);
|
value= number_to_datetime(value, (MYSQL_TIME *) buffer, TIME_FUZZY_DATE,
|
||||||
|
&error);
|
||||||
*param->error= test(error);
|
*param->error= test(error);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2976,25 +2976,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
|
|
@ -2959,25 +2959,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
|
|
@ -2960,25 +2960,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
|
|
@ -2896,25 +2896,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
@ -5908,25 +5908,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
|
|
@ -2959,25 +2959,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
|
|
@ -2959,25 +2959,25 @@ Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
Warning 1264 Out of range value adjusted for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1264 Out of range value adjusted for column 'c14' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
Warning 1264 Out of range value adjusted for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
Warning 1264 Out of range value adjusted for column 'c17' at row 1
|
||||||
|
|
|
@ -1244,4 +1244,15 @@ t1 CREATE TABLE `t1` (
|
||||||
`a` bigint(20) unsigned NOT NULL,
|
`a` bigint(20) unsigned NOT NULL,
|
||||||
`b` date NOT NULL
|
`b` date NOT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
create table t1 (d date);
|
||||||
|
insert into t1 values ('2000-10-00');
|
||||||
|
ERROR 22007: Incorrect date value: '2000-10-00' for column 'd' at row 1
|
||||||
|
insert into t1 values (1000);
|
||||||
|
ERROR 22007: Incorrect date value: '1000' for column 'd' at row 1
|
||||||
|
insert into t1 values ('2000-10-01');
|
||||||
|
update t1 set d = 1100;
|
||||||
|
ERROR 22007: Incorrect date value: '1100' for column 'd' at row 1
|
||||||
|
select * from t1;
|
||||||
|
d
|
||||||
|
2000-10-01
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
|
@ -40,6 +40,12 @@ insert into t1 (i, ts) values
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
|
Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
|
||||||
insert into t1 (i, ts) values
|
insert into t1 (i, ts) values
|
||||||
|
(unix_timestamp(20030330015959),20030330015959),
|
||||||
|
(unix_timestamp(20030330023000),20030330023000),
|
||||||
|
(unix_timestamp(20030330030000),20030330030000);
|
||||||
|
Warnings:
|
||||||
|
Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
|
||||||
|
insert into t1 (i, ts) values
|
||||||
(unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
|
(unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
|
||||||
insert into t1 (i, ts) values
|
insert into t1 (i, ts) values
|
||||||
(unix_timestamp('2003-10-26 01:00:00'),'2003-10-26 01:00:00'),
|
(unix_timestamp('2003-10-26 01:00:00'),'2003-10-26 01:00:00'),
|
||||||
|
@ -54,6 +60,9 @@ i ts
|
||||||
1048985999 2003-03-30 00:59:59
|
1048985999 2003-03-30 00:59:59
|
||||||
1048986000 2003-03-30 01:00:00
|
1048986000 2003-03-30 01:00:00
|
||||||
1048986000 2003-03-30 01:00:00
|
1048986000 2003-03-30 01:00:00
|
||||||
|
1048985999 2003-03-30 00:59:59
|
||||||
|
1048986000 2003-03-30 01:00:00
|
||||||
|
1048986000 2003-03-30 01:00:00
|
||||||
1051740000 2003-04-30 22:00:00
|
1051740000 2003-04-30 22:00:00
|
||||||
1067122800 2003-10-25 23:00:00
|
1067122800 2003-10-25 23:00:00
|
||||||
1067126400 2003-10-26 00:00:00
|
1067126400 2003-10-26 00:00:00
|
||||||
|
|
|
@ -100,12 +100,12 @@ create table t1 (t datetime);
|
||||||
insert into t1 values (20030102030460),(20030102036301),(20030102240401),
|
insert into t1 values (20030102030460),(20030102036301),(20030102240401),
|
||||||
(20030132030401),(20031302030401),(100001202030401);
|
(20030132030401),(20031302030401),(100001202030401);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 't' at row 1
|
Warning 1264 Out of range value adjusted for column 't' at row 1
|
||||||
Warning 1265 Data truncated for column 't' at row 2
|
Warning 1264 Out of range value adjusted for column 't' at row 2
|
||||||
Warning 1265 Data truncated for column 't' at row 3
|
Warning 1264 Out of range value adjusted for column 't' at row 3
|
||||||
Warning 1265 Data truncated for column 't' at row 4
|
Warning 1264 Out of range value adjusted for column 't' at row 4
|
||||||
Warning 1265 Data truncated for column 't' at row 5
|
Warning 1264 Out of range value adjusted for column 't' at row 5
|
||||||
Warning 1265 Data truncated for column 't' at row 6
|
Warning 1264 Out of range value adjusted for column 't' at row 6
|
||||||
select * from t1;
|
select * from t1;
|
||||||
t
|
t
|
||||||
0000-00-00 00:00:00
|
0000-00-00 00:00:00
|
||||||
|
|
|
@ -1103,3 +1103,18 @@ create table t1(a int, b date not null);
|
||||||
alter table t1 modify a bigint unsigned not null;
|
alter table t1 modify a bigint unsigned not null;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #5906: handle invalid date due to conversion
|
||||||
|
#
|
||||||
|
set @@sql_mode='traditional';
|
||||||
|
create table t1 (d date);
|
||||||
|
--error 1292
|
||||||
|
insert into t1 values ('2000-10-00');
|
||||||
|
--error 1292
|
||||||
|
insert into t1 values (1000);
|
||||||
|
insert into t1 values ('2000-10-01');
|
||||||
|
--error 1292
|
||||||
|
update t1 set d = 1100;
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
|
@ -48,6 +48,11 @@ insert into t1 (i, ts) values
|
||||||
(unix_timestamp('2003-03-30 01:59:59'),'2003-03-30 01:59:59'),
|
(unix_timestamp('2003-03-30 01:59:59'),'2003-03-30 01:59:59'),
|
||||||
(unix_timestamp('2003-03-30 02:30:00'),'2003-03-30 02:30:00'),
|
(unix_timestamp('2003-03-30 02:30:00'),'2003-03-30 02:30:00'),
|
||||||
(unix_timestamp('2003-03-30 03:00:00'),'2003-03-30 03:00:00');
|
(unix_timestamp('2003-03-30 03:00:00'),'2003-03-30 03:00:00');
|
||||||
|
# Values around and in spring time-gap
|
||||||
|
insert into t1 (i, ts) values
|
||||||
|
(unix_timestamp(20030330015959),20030330015959),
|
||||||
|
(unix_timestamp(20030330023000),20030330023000),
|
||||||
|
(unix_timestamp(20030330030000),20030330030000);
|
||||||
# Normal value with DST
|
# Normal value with DST
|
||||||
insert into t1 (i, ts) values
|
insert into t1 (i, ts) values
|
||||||
(unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
|
(unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
|
||||||
|
|
|
@ -56,11 +56,14 @@ uint calc_days_in_year(uint year)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
check date.
|
Check datetime value for validity according to flags.
|
||||||
|
|
||||||
SYNOPOSIS
|
SYNOPSIS
|
||||||
bool check_date()
|
check_date()
|
||||||
time Date to check.
|
ltime - Date to check.
|
||||||
|
not_zero_date - ltime is not the zero date
|
||||||
|
flags - flags to check
|
||||||
|
was_cut - set to whether the value was truncated
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
Here we assume that year and month is ok !
|
Here we assume that year and month is ok !
|
||||||
|
@ -69,18 +72,35 @@ uint calc_days_in_year(uint year)
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
0 ok
|
0 ok
|
||||||
1 errro
|
1 error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool check_date(MYSQL_TIME *ltime)
|
bool check_date(const MYSQL_TIME *ltime, bool not_zero_date, ulong flags,
|
||||||
|
int *was_cut)
|
||||||
{
|
{
|
||||||
if (ltime->month && ltime->day > days_in_month[ltime->month-1])
|
|
||||||
|
if (not_zero_date)
|
||||||
{
|
{
|
||||||
if (ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
|
if ((((flags & TIME_NO_ZERO_IN_DATE) || !(flags & TIME_FUZZY_DATE)) &&
|
||||||
ltime->day != 29)
|
(ltime->month == 0 || ltime->day == 0)) ||
|
||||||
return 1;
|
(!(flags & TIME_INVALID_DATES) &&
|
||||||
|
ltime->month && ltime->day > days_in_month[ltime->month-1] &&
|
||||||
|
(ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
|
||||||
|
ltime->day != 29)))
|
||||||
|
{
|
||||||
|
*was_cut= 2;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
else if (flags & TIME_NO_ZERO_DATE)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We don't set *was_cut here to signal that the problem was a zero date
|
||||||
|
and not an invalid date
|
||||||
|
*/
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +120,7 @@ bool check_date(MYSQL_TIME *ltime)
|
||||||
TIME_INVALID_DATES Allow 2000-02-31
|
TIME_INVALID_DATES Allow 2000-02-31
|
||||||
was_cut 0 Value ok
|
was_cut 0 Value ok
|
||||||
1 If value was cut during conversion
|
1 If value was cut during conversion
|
||||||
2 Date part was withing ranges but date was wrong
|
2 Date part was within ranges but date was wrong
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
At least the following formats are recogniced (based on number of digits)
|
At least the following formats are recogniced (based on number of digits)
|
||||||
|
@ -168,8 +188,6 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||||
*was_cut= 1;
|
*was_cut= 1;
|
||||||
DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
|
DBUG_RETURN(MYSQL_TIMESTAMP_NONE);
|
||||||
}
|
}
|
||||||
if (flags & TIME_NO_ZERO_IN_DATE)
|
|
||||||
flags&= ~TIME_FUZZY_DATE;
|
|
||||||
|
|
||||||
is_internal_format= 0;
|
is_internal_format= 0;
|
||||||
/* This has to be changed if want to activate different timestamp formats */
|
/* This has to be changed if want to activate different timestamp formats */
|
||||||
|
@ -385,22 +403,10 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||||
if (year_length == 2 && not_zero_date)
|
if (year_length == 2 && not_zero_date)
|
||||||
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
|
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
|
||||||
|
|
||||||
if (!not_zero_date && (flags & TIME_NO_ZERO_DATE))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
We don't set *was_cut here to signal that the problem was a zero date
|
|
||||||
and not an invalid date
|
|
||||||
*/
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (number_of_fields < 3 ||
|
if (number_of_fields < 3 ||
|
||||||
l_time->year > 9999 || l_time->month > 12 ||
|
l_time->year > 9999 || l_time->month > 12 ||
|
||||||
l_time->day > 31 || l_time->hour > 23 ||
|
l_time->day > 31 || l_time->hour > 23 ||
|
||||||
l_time->minute > 59 || l_time->second > 59 ||
|
l_time->minute > 59 || l_time->second > 59)
|
||||||
(!(flags & TIME_FUZZY_DATE) && (l_time->month == 0 ||
|
|
||||||
l_time->day == 0) &&
|
|
||||||
not_zero_date))
|
|
||||||
{
|
{
|
||||||
/* Only give warning for a zero date if there is some garbage after */
|
/* Only give warning for a zero date if there is some garbage after */
|
||||||
if (!not_zero_date) /* If zero date */
|
if (!not_zero_date) /* If zero date */
|
||||||
|
@ -418,15 +424,12 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (check_date(l_time, not_zero_date, flags, was_cut))
|
||||||
|
goto err;
|
||||||
|
|
||||||
l_time->time_type= (number_of_fields <= 3 ?
|
l_time->time_type= (number_of_fields <= 3 ?
|
||||||
MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME);
|
MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME);
|
||||||
|
|
||||||
if (not_zero_date && !(flags & TIME_INVALID_DATES) && check_date(l_time))
|
|
||||||
{
|
|
||||||
*was_cut= 2; /* Not correct date */
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; str != end ; str++)
|
for (; str != end ; str++)
|
||||||
{
|
{
|
||||||
if (!my_isspace(&my_charset_latin1,*str))
|
if (!my_isspace(&my_charset_latin1,*str))
|
||||||
|
@ -881,9 +884,10 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to)
|
||||||
number_to_datetime()
|
number_to_datetime()
|
||||||
nr - datetime value as number
|
nr - datetime value as number
|
||||||
time_res - pointer for structure for broken-down representation
|
time_res - pointer for structure for broken-down representation
|
||||||
fuzzy_date - indicates whenever we allow fuzzy dates
|
flags - flags to use in validating date, as in str_to_datetime()
|
||||||
was_cut - set ot 1 if there was some kind of error during
|
was_cut 0 Value ok
|
||||||
conversion or to 0 if everything was OK.
|
1 If value was cut during conversion
|
||||||
|
2 Date part was within ranges but date was wrong
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS,
|
Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS,
|
||||||
|
@ -893,12 +897,13 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to)
|
||||||
This function also checks if datetime value fits in DATETIME range.
|
This function also checks if datetime value fits in DATETIME range.
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
|
-1 Timestamp with wrong values
|
||||||
|
anything else DATETIME as integer in YYYYMMDDHHMMSS format
|
||||||
Datetime value in YYYYMMDDHHMMSS format.
|
Datetime value in YYYYMMDDHHMMSS format.
|
||||||
If input value is not valid datetime value then 0 is returned.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||||
my_bool fuzzy_date, int *was_cut)
|
uint flags, int *was_cut)
|
||||||
{
|
{
|
||||||
long part1,part2;
|
long part1,part2;
|
||||||
|
|
||||||
|
@ -952,13 +957,17 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||||
if (time_res->year <= 9999 && time_res->month <= 12 &&
|
if (time_res->year <= 9999 && time_res->month <= 12 &&
|
||||||
time_res->day <= 31 && time_res->hour <= 23 &&
|
time_res->day <= 31 && time_res->hour <= 23 &&
|
||||||
time_res->minute <= 59 && time_res->second <= 59 &&
|
time_res->minute <= 59 && time_res->second <= 59 &&
|
||||||
(fuzzy_date || (time_res->month != 0 && time_res->day != 0) || nr==0))
|
!check_date(time_res, (nr != 0), flags, was_cut))
|
||||||
return nr;
|
return nr;
|
||||||
|
|
||||||
|
/* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */
|
||||||
|
if (!nr && flags & TIME_NO_ZERO_DATE)
|
||||||
|
return LL(-1);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
|
||||||
*was_cut= 1;
|
*was_cut= 1;
|
||||||
return LL(0);
|
return LL(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
207
sql/field.cc
207
sql/field.cc
|
@ -4471,13 +4471,13 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
bool in_dst_time_gap;
|
bool in_dst_time_gap;
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
|
|
||||||
|
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||||
have_smth_to_conv= (str_to_datetime(from, len, &l_time,
|
have_smth_to_conv= (str_to_datetime(from, len, &l_time,
|
||||||
((table->in_use->variables.sql_mode &
|
(table->in_use->variables.sql_mode &
|
||||||
MODE_NO_ZERO_DATE) |
|
MODE_NO_ZERO_DATE) |
|
||||||
MODE_NO_ZERO_IN_DATE),
|
MODE_NO_ZERO_IN_DATE, &error) >
|
||||||
&error) >
|
|
||||||
MYSQL_TIMESTAMP_ERROR);
|
MYSQL_TIMESTAMP_ERROR);
|
||||||
|
|
||||||
if (error || !have_smth_to_conv)
|
if (error || !have_smth_to_conv)
|
||||||
{
|
{
|
||||||
error= 1;
|
error= 1;
|
||||||
|
@ -4490,16 +4490,15 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
if (!(tmp= TIME_to_timestamp(thd, &l_time, &in_dst_time_gap)))
|
if (!(tmp= TIME_to_timestamp(thd, &l_time, &in_dst_time_gap)))
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
ER_WARN_DATA_OUT_OF_RANGE,
|
||||||
from, len, MYSQL_TIMESTAMP_DATETIME, !error);
|
from, len, MYSQL_TIMESTAMP_DATETIME, !error);
|
||||||
|
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (in_dst_time_gap)
|
else if (in_dst_time_gap)
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_INVALID_TIMESTAMP,
|
ER_WARN_INVALID_TIMESTAMP,
|
||||||
from, len, MYSQL_TIMESTAMP_DATETIME, !error);
|
from, len, MYSQL_TIMESTAMP_DATETIME, !error);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
|
@ -4524,8 +4523,8 @@ int Field_timestamp::store(double nr)
|
||||||
int error= 0;
|
int error= 0;
|
||||||
if (nr < 0 || nr > 99991231235959.0)
|
if (nr < 0 || nr > 99991231235959.0)
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
ER_WARN_DATA_OUT_OF_RANGE,
|
||||||
nr, MYSQL_TIMESTAMP_DATETIME);
|
nr, MYSQL_TIMESTAMP_DATETIME);
|
||||||
nr= 0; // Avoid overflow on buff
|
nr= 0; // Avoid overflow on buff
|
||||||
error= 1;
|
error= 1;
|
||||||
|
@ -4543,35 +4542,35 @@ int Field_timestamp::store(longlong nr)
|
||||||
bool in_dst_time_gap;
|
bool in_dst_time_gap;
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
|
|
||||||
if (number_to_datetime(nr, &l_time, 0, &error))
|
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||||
|
long tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
|
||||||
|
MODE_NO_ZERO_DATE) |
|
||||||
|
MODE_NO_ZERO_IN_DATE, &error);
|
||||||
|
if (tmp < 0)
|
||||||
|
{
|
||||||
|
error= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!error && tmp)
|
||||||
{
|
{
|
||||||
if (!(timestamp= TIME_to_timestamp(thd, &l_time, &in_dst_time_gap)))
|
if (!(timestamp= TIME_to_timestamp(thd, &l_time, &in_dst_time_gap)))
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
ER_WARN_DATA_OUT_OF_RANGE,
|
||||||
nr, MYSQL_TIMESTAMP_DATETIME, 1);
|
nr, MYSQL_TIMESTAMP_DATETIME, 1);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_dst_time_gap)
|
if (in_dst_time_gap)
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_INVALID_TIMESTAMP,
|
ER_WARN_INVALID_TIMESTAMP,
|
||||||
nr, MYSQL_TIMESTAMP_DATETIME, !error);
|
nr, MYSQL_TIMESTAMP_DATETIME, 1);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
} else if (error)
|
||||||
else if (error)
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
WARN_DATA_TRUNCATED,
|
WARN_DATA_TRUNCATED,
|
||||||
nr, MYSQL_TIMESTAMP_DATETIME, 1);
|
nr, MYSQL_TIMESTAMP_DATETIME, 1);
|
||||||
if (!error && timestamp == 0 &&
|
|
||||||
(table->in_use->variables.sql_mode & MODE_NO_ZERO_DATE))
|
|
||||||
{
|
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
WARN_DATA_TRUNCATED,
|
|
||||||
nr, MYSQL_TIMESTAMP_DATETIME, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
if (table->s->db_low_byte_first)
|
if (table->s->db_low_byte_first)
|
||||||
|
@ -4581,7 +4580,7 @@ int Field_timestamp::store(longlong nr)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
longstore(ptr,(uint32) timestamp);
|
longstore(ptr,(uint32) timestamp);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5154,14 +5153,14 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
||||||
TIME l_time;
|
TIME l_time;
|
||||||
uint32 tmp;
|
uint32 tmp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (str_to_datetime(from, len, &l_time, TIME_FUZZY_DATE |
|
if (str_to_datetime(from, len, &l_time, TIME_FUZZY_DATE |
|
||||||
(table->in_use->variables.sql_mode &
|
(table->in_use->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||||
MODE_INVALID_DATES)),
|
MODE_INVALID_DATES)),
|
||||||
&error) <= MYSQL_TIMESTAMP_ERROR)
|
&error) <= MYSQL_TIMESTAMP_ERROR)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp= 0;
|
||||||
error= 2;
|
error= 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5192,56 +5191,50 @@ int Field_date::store(double nr)
|
||||||
if (nr < 0.0 || nr > 99991231.0)
|
if (nr < 0.0 || nr > 99991231.0)
|
||||||
{
|
{
|
||||||
tmp=0L;
|
tmp=0L;
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
ER_WARN_DATA_OUT_OF_RANGE,
|
||||||
nr, MYSQL_TIMESTAMP_DATE);
|
nr, MYSQL_TIMESTAMP_DATE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp=(long) rint(nr);
|
tmp=(long) rint(nr);
|
||||||
|
|
||||||
/*
|
return Field_date::store(tmp);
|
||||||
We don't need to check for zero dates here as this date type is only
|
|
||||||
used in .frm tables from very old MySQL versions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
|
||||||
if (table->s->db_low_byte_first)
|
|
||||||
{
|
|
||||||
int4store(ptr,tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
longstore(ptr,tmp);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_date::store(longlong nr)
|
int Field_date::store(longlong nr)
|
||||||
{
|
{
|
||||||
long tmp;
|
TIME not_used;
|
||||||
int error= 0;
|
int error;
|
||||||
if (nr >= LL(19000000000000) && nr < LL(99991231235959))
|
longlong initial_nr= nr;
|
||||||
nr=nr/LL(1000000); // Timestamp to date
|
|
||||||
if (nr < 0 || nr > LL(99991231))
|
nr= number_to_datetime(nr, ¬_used, (TIME_FUZZY_DATE |
|
||||||
|
(table->in_use->variables.sql_mode &
|
||||||
|
(MODE_NO_ZERO_IN_DATE |
|
||||||
|
MODE_NO_ZERO_DATE |
|
||||||
|
MODE_INVALID_DATES))), &error);
|
||||||
|
|
||||||
|
if (nr < 0)
|
||||||
{
|
{
|
||||||
tmp=0L;
|
nr= 0;
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
error= 2;
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
|
||||||
nr, MYSQL_TIMESTAMP_DATE, 0);
|
|
||||||
error= 1;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
tmp=(long) nr;
|
if (error)
|
||||||
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
error == 2 ? ER_WARN_DATA_OUT_OF_RANGE :
|
||||||
|
WARN_DATA_TRUNCATED, initial_nr,
|
||||||
|
MYSQL_TIMESTAMP_DATETIME, 1);
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
if (table->s->db_low_byte_first)
|
if (table->s->db_low_byte_first)
|
||||||
{
|
{
|
||||||
int4store(ptr,tmp);
|
int4store(ptr, nr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
longstore(ptr,tmp);
|
longstore(ptr, nr);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5365,7 +5358,7 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
MODE_INVALID_DATES))),
|
MODE_INVALID_DATES))),
|
||||||
&error) <= MYSQL_TIMESTAMP_ERROR)
|
&error) <= MYSQL_TIMESTAMP_ERROR)
|
||||||
{
|
{
|
||||||
tmp=0L;
|
tmp= 0L;
|
||||||
error= 2;
|
error= 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5374,7 +5367,7 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
if (error)
|
if (error)
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
|
||||||
from, len, MYSQL_TIMESTAMP_DATE, 1);
|
from, len, MYSQL_TIMESTAMP_DATE, 1);
|
||||||
|
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -5385,7 +5378,7 @@ int Field_newdate::store(double nr)
|
||||||
if (nr < 0.0 || nr > 99991231235959.0)
|
if (nr < 0.0 || nr > 99991231235959.0)
|
||||||
{
|
{
|
||||||
int3store(ptr,(int32) 0);
|
int3store(ptr,(int32) 0);
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
WARN_DATA_TRUNCATED, nr, MYSQL_TIMESTAMP_DATE);
|
WARN_DATA_TRUNCATED, nr, MYSQL_TIMESTAMP_DATE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -5395,52 +5388,28 @@ int Field_newdate::store(double nr)
|
||||||
|
|
||||||
int Field_newdate::store(longlong nr)
|
int Field_newdate::store(longlong nr)
|
||||||
{
|
{
|
||||||
int32 tmp;
|
TIME l_time;
|
||||||
int error= 0;
|
long tmp;
|
||||||
if (nr >= LL(100000000) && nr <= LL(99991231235959))
|
int error;
|
||||||
nr=nr/LL(1000000); // Timestamp to date
|
if ((tmp= number_to_datetime(nr, &l_time,
|
||||||
if (nr < 0L || nr > 99991231L)
|
(TIME_FUZZY_DATE |
|
||||||
|
(table->in_use->variables.sql_mode &
|
||||||
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||||
|
MODE_INVALID_DATES))),
|
||||||
|
&error) < 0))
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp= 0L;
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
error= 2;
|
||||||
ER_WARN_DATA_OUT_OF_RANGE, nr,
|
|
||||||
MYSQL_TIMESTAMP_DATE, 1);
|
|
||||||
error= 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
|
||||||
uint month, day;
|
|
||||||
|
|
||||||
tmp=(int32) nr;
|
if (error)
|
||||||
if (tmp)
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
{
|
error == 2 ? ER_WARN_DATA_OUT_OF_RANGE :
|
||||||
if (tmp < YY_PART_YEAR*10000L) // Fix short dates
|
WARN_DATA_TRUNCATED,nr,MYSQL_TIMESTAMP_DATE, 1);
|
||||||
tmp+= (uint32) 20000000L;
|
|
||||||
else if (tmp < 999999L)
|
|
||||||
tmp+= (uint32) 19000000L;
|
|
||||||
|
|
||||||
month= (uint) ((tmp/100) % 100);
|
int3store(ptr,tmp);
|
||||||
day= (uint) (tmp%100);
|
|
||||||
if (month > 12 || day > 31)
|
|
||||||
{
|
|
||||||
tmp=0L; // Don't allow date to change
|
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
ER_WARN_DATA_OUT_OF_RANGE, nr,
|
|
||||||
MYSQL_TIMESTAMP_DATE, 1);
|
|
||||||
error= 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tmp= day + month*32 + (tmp/10000)*16*32;
|
|
||||||
}
|
|
||||||
else if (table->in_use->variables.sql_mode & MODE_NO_ZERO_DATE)
|
|
||||||
{
|
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
|
||||||
0, MYSQL_TIMESTAMP_DATE);
|
|
||||||
error= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int3store(ptr, tmp);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5567,7 +5536,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
int error;
|
int error;
|
||||||
ulonglong tmp= 0;
|
ulonglong tmp= 0;
|
||||||
enum enum_mysql_timestamp_type func_res;
|
enum enum_mysql_timestamp_type func_res;
|
||||||
|
|
||||||
func_res= str_to_datetime(from, len, &time_tmp,
|
func_res= str_to_datetime(from, len, &time_tmp,
|
||||||
(TIME_FUZZY_DATE |
|
(TIME_FUZZY_DATE |
|
||||||
(table->in_use->variables.sql_mode &
|
(table->in_use->variables.sql_mode &
|
||||||
|
@ -5580,7 +5549,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
error= 1; // Fix if invalid zero date
|
error= 1; // Fix if invalid zero date
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
ER_WARN_DATA_OUT_OF_RANGE,
|
||||||
from, len, MYSQL_TIMESTAMP_DATETIME, 1);
|
from, len, MYSQL_TIMESTAMP_DATETIME, 1);
|
||||||
|
|
||||||
|
@ -5617,20 +5586,24 @@ int Field_datetime::store(longlong nr)
|
||||||
TIME not_used;
|
TIME not_used;
|
||||||
int error;
|
int error;
|
||||||
longlong initial_nr= nr;
|
longlong initial_nr= nr;
|
||||||
|
|
||||||
nr= number_to_datetime(nr, ¬_used, 1, &error);
|
nr= number_to_datetime(nr, ¬_used, (TIME_FUZZY_DATE |
|
||||||
|
(table->in_use->variables.sql_mode &
|
||||||
|
(MODE_NO_ZERO_IN_DATE |
|
||||||
|
MODE_NO_ZERO_DATE |
|
||||||
|
MODE_INVALID_DATES))), &error);
|
||||||
|
|
||||||
|
if (nr < 0)
|
||||||
|
{
|
||||||
|
nr= 0;
|
||||||
|
error= 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
WARN_DATA_TRUNCATED, initial_nr,
|
error == 2 ? ER_WARN_DATA_OUT_OF_RANGE :
|
||||||
|
WARN_DATA_TRUNCATED, initial_nr,
|
||||||
MYSQL_TIMESTAMP_DATETIME, 1);
|
MYSQL_TIMESTAMP_DATETIME, 1);
|
||||||
else if (nr == 0 && table->in_use->variables.sql_mode & MODE_NO_ZERO_DATE)
|
|
||||||
{
|
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
|
||||||
initial_nr, MYSQL_TIMESTAMP_DATE, 1);
|
|
||||||
error= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
if (table->s->db_low_byte_first)
|
if (table->s->db_low_byte_first)
|
||||||
|
|
Loading…
Reference in a new issue