merge with 5.1-micro
This commit is contained in:
commit
9b98cae4cc
@ -1445,7 +1445,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
|
|||||||
int was_cut;
|
int was_cut;
|
||||||
MYSQL_TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
long dummy_my_timezone;
|
long dummy_my_timezone;
|
||||||
my_bool dummy_in_dst_time_gap;
|
uint dummy_in_dst_time_gap;
|
||||||
/* We require a total specification (date AND time) */
|
/* We require a total specification (date AND time) */
|
||||||
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
|
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
|
||||||
MYSQL_TIMESTAMP_DATETIME || was_cut)
|
MYSQL_TIMESTAMP_DATETIME || was_cut)
|
||||||
|
@ -85,9 +85,7 @@ typedef long my_time_t;
|
|||||||
#define TIME_MAX_SECOND_PART 999999
|
#define TIME_MAX_SECOND_PART 999999
|
||||||
#define TIME_SECOND_PART_FACTOR (TIME_MAX_SECOND_PART+1)
|
#define TIME_SECOND_PART_FACTOR (TIME_MAX_SECOND_PART+1)
|
||||||
#define TIME_SECOND_PART_DIGITS 6
|
#define TIME_SECOND_PART_DIGITS 6
|
||||||
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
|
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + TIME_MAX_SECOND)
|
||||||
TIME_MAX_SECOND + \
|
|
||||||
TIME_MAX_SECOND_PART/(double)TIME_SECOND_PART_FACTOR)
|
|
||||||
#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
|
#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
|
||||||
TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
|
TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
|
||||||
|
|
||||||
@ -99,11 +97,10 @@ str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
|
|||||||
enum enum_mysql_timestamp_type
|
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,
|
||||||
ulong flags, int *was_cut);
|
ulong flags, int *was_cut);
|
||||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
|
||||||
uint flags, int *was_cut);
|
uint flags, int *was_cut);
|
||||||
int number_to_time(double nr, MYSQL_TIME *ltime, int *was_cut);
|
int number_to_time(my_bool neg, longlong nr, ulong sec_part,
|
||||||
my_bool double_to_datetime(double nr, MYSQL_TIME *time_res,
|
MYSQL_TIME *ltime, int *was_cut);
|
||||||
uint flags);
|
|
||||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
||||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
||||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
||||||
@ -146,8 +143,7 @@ static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
my_time_t
|
my_time_t
|
||||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone,
|
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code);
|
||||||
my_bool *in_dst_time_gap);
|
|
||||||
|
|
||||||
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
||||||
|
|
||||||
|
@ -3681,7 +3681,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, TIME_FUZZY_DATE,
|
value= number_to_datetime(value, 0,
|
||||||
|
(MYSQL_TIME *) buffer, TIME_FUZZY_DATE,
|
||||||
&error);
|
&error);
|
||||||
*param->error= test(error);
|
*param->error= test(error);
|
||||||
break;
|
break;
|
||||||
|
@ -54,11 +54,40 @@ select * from t1;
|
|||||||
create table t2 select * from t1;
|
create table t2 select * from t1;
|
||||||
create table t3 like t1;
|
create table t3 like t1;
|
||||||
|
|
||||||
|
show create table t2;
|
||||||
|
show create table t3;
|
||||||
|
drop table t2, t3;
|
||||||
|
|
||||||
|
# math, aggregation
|
||||||
|
insert t1 values ('2010-12-13 14:15:16.222222');
|
||||||
|
select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
show create table t2;
|
show create table t2;
|
||||||
show create table t3;
|
show create table t3;
|
||||||
|
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
|
|
||||||
|
# insert, alter with conversion
|
||||||
|
--vertical_results
|
||||||
|
eval create table t1 (f0_$type $type(0), f1_$type $type(1), f2_$type $type(2), f3_$type $type(3), f4_$type $type(4), f5_$type $type(5), f6_$type $type(6));
|
||||||
|
insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
||||||
|
select * from t1;
|
||||||
|
eval select cast(f0_$type as time(4)) time4_f0_$type, cast(f1_$type as datetime(3)) datetime3_f1_$type, cast(f2_$type as date) date_f2_$type, cast(f4_$type as double) double_f3_$type, cast(f4_$type as decimal(40,5)) decimal5_f4_$type, cast(f5_$type as signed) bigint_f5_$type, cast(f6_$type as char(255)) varchar_f6_$type from t1;
|
||||||
|
eval create table t2 (time4_f0_$type time(4), datetime3_f1_$type datetime(3), date_f2_$type date, double_f3_$type double, decimal5_f4_$type decimal(40,5), bigint_f5_$type bigint, varchar_f6_$type varchar(255));
|
||||||
|
insert t2 select * from t1;
|
||||||
|
select * from t2;
|
||||||
|
eval alter table t1 change f0_$type time4_f0_$type time(4), change f1_$type datetime3_f1_$type datetime(3), change f2_$type date_f2_$type date, change f3_$type double_f3_$type double, change f4_$type decimal5_f4_$type decimal(40,5), change f5_$type bigint_f5_$type bigint, change f6_$type varchar_f6_$type varchar(255);
|
||||||
|
select * from t1;
|
||||||
|
eval alter table t1 modify time4_f0_$type $type(0), modify datetime3_f1_$type $type(1), modify date_f2_$type $type(2), modify double_f3_$type $type(3), modify decimal5_f4_$type $type(4), modify bigint_f5_$type $type(5), modify varchar_f6_$type $type(6);
|
||||||
|
select * from t1;
|
||||||
|
delete from t1;
|
||||||
|
insert t1 select * from t2;
|
||||||
|
select * from t1;
|
||||||
|
drop table t1, t2;
|
||||||
|
--horizontal_results
|
||||||
|
|
||||||
#
|
#
|
||||||
# SP
|
# SP
|
||||||
#
|
#
|
||||||
|
@ -65,10 +65,10 @@ cast(cast("20:01:01" as time) as datetime)
|
|||||||
0000-00-00 20:01:01
|
0000-00-00 20:01:01
|
||||||
select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
|
select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
|
||||||
cast(cast("8:46:06.23434" AS time) as decimal(32,10))
|
cast(cast("8:46:06.23434" AS time) as decimal(32,10))
|
||||||
84606.2343400000
|
84606.0000000000
|
||||||
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
|
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
|
||||||
cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6))
|
cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6))
|
||||||
20110405084606.234340
|
20110405084606.000000
|
||||||
#
|
#
|
||||||
# Check handling of cast with microseconds
|
# Check handling of cast with microseconds
|
||||||
#
|
#
|
||||||
@ -77,7 +77,7 @@ cast(cast(20010203101112.121314 as double) as datetime)
|
|||||||
2001-02-03 10:11:12
|
2001-02-03 10:11:12
|
||||||
select cast(cast(010203101112.12 as double) as datetime);
|
select cast(cast(010203101112.12 as double) as datetime);
|
||||||
cast(cast(010203101112.12 as double) as datetime)
|
cast(cast(010203101112.12 as double) as datetime)
|
||||||
2001-02-03 10:11:12
|
0001-02-03 10:11:12
|
||||||
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
|
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
|
||||||
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime)
|
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime)
|
||||||
2001-02-03 10:11:12
|
2001-02-03 10:11:12
|
||||||
@ -86,10 +86,10 @@ cast(20010203101112.121314 as datetime)
|
|||||||
2001-02-03 10:11:12
|
2001-02-03 10:11:12
|
||||||
select cast(110203101112.121314 as datetime);
|
select cast(110203101112.121314 as datetime);
|
||||||
cast(110203101112.121314 as datetime)
|
cast(110203101112.121314 as datetime)
|
||||||
2011-02-03 10:11:12
|
0011-02-03 10:11:12
|
||||||
select cast(cast(010203101112.12 as double) as datetime);
|
select cast(cast(010203101112.12 as double) as datetime);
|
||||||
cast(cast(010203101112.12 as double) as datetime)
|
cast(cast(010203101112.12 as double) as datetime)
|
||||||
2001-02-03 10:11:12
|
0001-02-03 10:11:12
|
||||||
select cast("2011-02-03 10:11:12.123456" as datetime);
|
select cast("2011-02-03 10:11:12.123456" as datetime);
|
||||||
cast("2011-02-03 10:11:12.123456" as datetime)
|
cast("2011-02-03 10:11:12.123456" as datetime)
|
||||||
2011-02-03 10:11:12
|
2011-02-03 10:11:12
|
||||||
@ -110,7 +110,7 @@ cast(cast(20010203101112.1 as double) as datetime(1))
|
|||||||
2001-02-03 10:11:12.1
|
2001-02-03 10:11:12.1
|
||||||
select cast(cast(010203101112.12 as double) as datetime(2));
|
select cast(cast(010203101112.12 as double) as datetime(2));
|
||||||
cast(cast(010203101112.12 as double) as datetime(2))
|
cast(cast(010203101112.12 as double) as datetime(2))
|
||||||
2001-02-03 10:11:12.12
|
0001-02-03 10:11:12.12
|
||||||
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
|
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
|
||||||
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6))
|
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6))
|
||||||
2001-02-03 10:11:12.121314
|
2001-02-03 10:11:12.121314
|
||||||
@ -119,10 +119,10 @@ cast(20010203101112.121314 as datetime(6))
|
|||||||
2001-02-03 10:11:12.121314
|
2001-02-03 10:11:12.121314
|
||||||
select cast(110203101112.121314 as datetime(6));
|
select cast(110203101112.121314 as datetime(6));
|
||||||
cast(110203101112.121314 as datetime(6))
|
cast(110203101112.121314 as datetime(6))
|
||||||
2011-02-03 10:11:12.121314
|
0011-02-03 10:11:12.121314
|
||||||
select cast(cast(010203101112.12 as double) as datetime(6));
|
select cast(cast(010203101112.12 as double) as datetime(6));
|
||||||
cast(cast(010203101112.12 as double) as datetime(6))
|
cast(cast(010203101112.12 as double) as datetime(6))
|
||||||
2001-02-03 10:11:12.120000
|
0001-02-03 10:11:12.120000
|
||||||
select cast("2011-02-03 10:11:12.123456" as time);
|
select cast("2011-02-03 10:11:12.123456" as time);
|
||||||
cast("2011-02-03 10:11:12.123456" as time)
|
cast("2011-02-03 10:11:12.123456" as time)
|
||||||
10:11:12
|
10:11:12
|
||||||
@ -149,7 +149,7 @@ cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time)
|
|||||||
08:46:06
|
08:46:06
|
||||||
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
|
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
|
||||||
cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6))
|
cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6))
|
||||||
08:46:06.123456
|
08:46:06.000000
|
||||||
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
|
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
|
||||||
cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time)
|
cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time)
|
||||||
08:46:06
|
08:46:06
|
||||||
@ -265,9 +265,7 @@ Warnings:
|
|||||||
Warning 1264 Out of range value for column 'cast(-1000 as double(5,2))' at row 1
|
Warning 1264 Out of range value for column 'cast(-1000 as double(5,2))' at row 1
|
||||||
select cast(010203101112.121314 as datetime);
|
select cast(010203101112.121314 as datetime);
|
||||||
cast(010203101112.121314 as datetime)
|
cast(010203101112.121314 as datetime)
|
||||||
NULL
|
0001-02-03 10:11:12
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '10203101112.121314'
|
|
||||||
select cast(120010203101112.121314 as datetime);
|
select cast(120010203101112.121314 as datetime);
|
||||||
cast(120010203101112.121314 as datetime)
|
cast(120010203101112.121314 as datetime)
|
||||||
NULL
|
NULL
|
||||||
@ -328,10 +326,10 @@ cast(cast(120010203101112.121314 as double) as datetime)
|
|||||||
NULL
|
NULL
|
||||||
select cast(cast(1.1 as double) as datetime);
|
select cast(cast(1.1 as double) as datetime);
|
||||||
cast(cast(1.1 as double) as datetime)
|
cast(cast(1.1 as double) as datetime)
|
||||||
NULL
|
0000-00-00 00:00:01
|
||||||
select cast(cast(-1.1 as double) as datetime);
|
select cast(cast(-1.1 as double) as datetime);
|
||||||
cast(cast(-1.1 as double) as datetime)
|
cast(cast(-1.1 as double) as datetime)
|
||||||
NULL
|
0000-00-00 00:00:01
|
||||||
explain extended select cast(10 as double(5,2));
|
explain extended select cast(10 as double(5,2));
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
@ -507,7 +507,7 @@ f1 f2 f3
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD'
|
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD'
|
||||||
Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG'
|
Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG'
|
||||||
Warning 1292 Truncated incorrect time value: '1997-12-31 23:59:59.01XXXX'
|
Warning 1292 Truncated incorrect datetime value: '1997-12-31 23:59:59.01XXXX'
|
||||||
select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
|
select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
|
||||||
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
|
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
|
||||||
f1 f2
|
f1 f2
|
||||||
|
@ -295,6 +295,9 @@ column_get(column_create(1, "8:46:06.23434" AS time), 1 as int)
|
|||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
|
||||||
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int)
|
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int)
|
||||||
84606
|
84606
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int);
|
||||||
|
column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int)
|
||||||
|
-8084606
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
|
||||||
column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int)
|
column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int)
|
||||||
20110405084606
|
20110405084606
|
||||||
@ -402,6 +405,9 @@ column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8)
|
|||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
|
||||||
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8)
|
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8)
|
||||||
08:46:06.234340
|
08:46:06.234340
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8);
|
||||||
|
column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8)
|
||||||
|
-808:46:06.234340
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
|
||||||
column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8)
|
column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8)
|
||||||
2011-04-05 08:46:06.234340
|
2011-04-05 08:46:06.234340
|
||||||
@ -465,6 +471,9 @@ column_get(column_create(1, "8:46:06.23434" AS time), 1 as double)
|
|||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
|
||||||
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double)
|
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double)
|
||||||
84606.23434
|
84606.23434
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double);
|
||||||
|
column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double)
|
||||||
|
-8084606.23434
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
|
||||||
column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double)
|
column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double)
|
||||||
20110405084606.2
|
20110405084606.2
|
||||||
@ -540,6 +549,9 @@ column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6))
|
|||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
|
||||||
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6))
|
column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6))
|
||||||
84606.234340
|
84606.234340
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6));
|
||||||
|
column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6))
|
||||||
|
-8084606.234340
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
|
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
|
||||||
column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6))
|
column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6))
|
||||||
20110405084606.123456
|
20110405084606.123456
|
||||||
@ -688,6 +700,11 @@ column_get(column_create(1, "2001021"), 1 as datetime)
|
|||||||
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
|
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
|
||||||
column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime)
|
column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime)
|
||||||
0000-00-00 08:46:06
|
0000-00-00 08:46:06
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime);
|
||||||
|
column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime)
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect datetime value: '-808:46:06'
|
||||||
set @@sql_mode="allow_invalid_dates";
|
set @@sql_mode="allow_invalid_dates";
|
||||||
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
|
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
|
||||||
column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime)
|
column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime)
|
||||||
@ -709,17 +726,17 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as d
|
|||||||
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime)
|
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1918 Encountered illegal value '18446744073709551615' when converting to DATE or DATETIME
|
Warning 1292 Incorrect datetime value: '1.84467440737096e+19'
|
||||||
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime);
|
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime);
|
||||||
column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime)
|
column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1918 Encountered illegal value '9223372036854775807' when converting to DATE or DATETIME
|
Warning 1292 Incorrect datetime value: '9223372036854775807'
|
||||||
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime);
|
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime);
|
||||||
column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime)
|
column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1918 Encountered illegal value '-9223372036854775808' when converting to DATE or DATETIME
|
Warning 1292 Incorrect datetime value: '-9223372036854775808'
|
||||||
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime);
|
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime);
|
||||||
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime)
|
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime)
|
||||||
NULL
|
NULL
|
||||||
@ -729,7 +746,7 @@ select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 a
|
|||||||
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime)
|
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '9.99999999999999914332e+28 '
|
Warning 1292 Incorrect datetime value: '1e+29'
|
||||||
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime);
|
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime);
|
||||||
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime)
|
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime)
|
||||||
NULL
|
NULL
|
||||||
@ -839,17 +856,17 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as d
|
|||||||
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date)
|
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1918 Encountered illegal value '18446744073709551615' when converting to DATE or DATETIME
|
Warning 1292 Incorrect datetime value: '1.84467440737096e+19'
|
||||||
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date);
|
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date);
|
||||||
column_get(column_create(1, 9223372036854775807 AS int), 1 as date)
|
column_get(column_create(1, 9223372036854775807 AS int), 1 as date)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1918 Encountered illegal value '9223372036854775807' when converting to DATE or DATETIME
|
Warning 1292 Incorrect datetime value: '9223372036854775807'
|
||||||
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date);
|
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date);
|
||||||
column_get(column_create(1, -9223372036854775808 AS int), 1 as date)
|
column_get(column_create(1, -9223372036854775808 AS int), 1 as date)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1918 Encountered illegal value '-9223372036854775808' when converting to DATE or DATETIME
|
Warning 1292 Incorrect datetime value: '-9223372036854775808'
|
||||||
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date);
|
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date);
|
||||||
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date)
|
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date)
|
||||||
NULL
|
NULL
|
||||||
@ -859,7 +876,7 @@ select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 a
|
|||||||
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date)
|
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '9.99999999999999914332e+28 '
|
Warning 1292 Incorrect datetime value: '1e+29'
|
||||||
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date);
|
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date);
|
||||||
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date)
|
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date)
|
||||||
NULL
|
NULL
|
||||||
@ -897,9 +914,15 @@ column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time)
|
|||||||
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
|
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
|
||||||
column_get(column_create(1, 20010203101112 as unsigned int), 1 as time)
|
column_get(column_create(1, 20010203101112 as unsigned int), 1 as time)
|
||||||
10:11:12
|
10:11:12
|
||||||
|
select column_get(column_create(1, 8080102 as unsigned int), 1 as time);
|
||||||
|
column_get(column_create(1, 8080102 as unsigned int), 1 as time)
|
||||||
|
808:01:02
|
||||||
select column_get(column_create(1, 20010203101112 as int), 1 as time);
|
select column_get(column_create(1, 20010203101112 as int), 1 as time);
|
||||||
column_get(column_create(1, 20010203101112 as int), 1 as time)
|
column_get(column_create(1, 20010203101112 as int), 1 as time)
|
||||||
10:11:12
|
10:11:12
|
||||||
|
select column_get(column_create(1, -8080102 as int), 1 as time);
|
||||||
|
column_get(column_create(1, -8080102 as int), 1 as time)
|
||||||
|
-808:01:02
|
||||||
select column_get(column_create(1, "20010203101112" as char), 1 as time);
|
select column_get(column_create(1, "20010203101112" as char), 1 as time);
|
||||||
column_get(column_create(1, "20010203101112" as char), 1 as time)
|
column_get(column_create(1, "20010203101112" as char), 1 as time)
|
||||||
10:11:12
|
10:11:12
|
||||||
@ -980,27 +1003,27 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as t
|
|||||||
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time)
|
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '18446744073709551615'
|
Warning 1292 Incorrect datetime value: '1.84467440737096e+19'
|
||||||
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time);
|
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time);
|
||||||
column_get(column_create(1, 9223372036854775807 AS int), 1 as time)
|
column_get(column_create(1, 9223372036854775807 AS int), 1 as time)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '9223372036854775807'
|
Warning 1292 Incorrect datetime value: '9223372036854775807'
|
||||||
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time);
|
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time);
|
||||||
column_get(column_create(1, -9223372036854775808 AS int), 1 as time)
|
column_get(column_create(1, -9223372036854775808 AS int), 1 as time)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '-9223372036854775808'
|
Warning 1292 Incorrect datetime value: '-9223372036854775808'
|
||||||
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time);
|
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time);
|
||||||
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time)
|
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '99999999999999999999999999999'
|
Warning 1292 Incorrect datetime value: '99999999999999999999999999999'
|
||||||
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time);
|
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time);
|
||||||
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time)
|
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time)
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '1e+29'
|
Warning 1292 Incorrect datetime value: '1e+29'
|
||||||
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time);
|
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time);
|
||||||
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time)
|
column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time)
|
||||||
NULL
|
NULL
|
||||||
|
@ -1530,7 +1530,8 @@ insert into t1 values
|
|||||||
(02,2002,20020101,"2002-01-01 23:59:59"),
|
(02,2002,20020101,"2002-01-01 23:59:59"),
|
||||||
(60,2060,20600101,"2060-01-01 11:11:11"),
|
(60,2060,20600101,"2060-01-01 11:11:11"),
|
||||||
(70,1970,19700101,"1970-11-11 22:22:22"),
|
(70,1970,19700101,"1970-11-11 22:22:22"),
|
||||||
(NULL,NULL,NULL,NULL);
|
(NULL,NULL,NULL,NULL),
|
||||||
|
(71,1971,19710101,"1971-11-11 22:22:22");
|
||||||
select min(f1),max(f1) from t1;
|
select min(f1),max(f1) from t1;
|
||||||
min(f1) max(f1)
|
min(f1) max(f1)
|
||||||
70 60
|
70 60
|
||||||
@ -1553,36 +1554,49 @@ a b gt lt eq
|
|||||||
60 98 1 0 0
|
60 98 1 0 0
|
||||||
70 98 0 1 0
|
70 98 0 1 0
|
||||||
NULL 98 NULL NULL 0
|
NULL 98 NULL NULL 0
|
||||||
|
71 98 0 1 0
|
||||||
98 00 0 1 0
|
98 00 0 1 0
|
||||||
00 00 0 0 1
|
00 00 0 0 1
|
||||||
02 00 1 0 0
|
02 00 1 0 0
|
||||||
60 00 1 0 0
|
60 00 1 0 0
|
||||||
70 00 0 1 0
|
70 00 0 1 0
|
||||||
NULL 00 NULL NULL 0
|
NULL 00 NULL NULL 0
|
||||||
|
71 00 0 1 0
|
||||||
98 02 0 1 0
|
98 02 0 1 0
|
||||||
00 02 0 1 0
|
00 02 0 1 0
|
||||||
02 02 0 0 1
|
02 02 0 0 1
|
||||||
60 02 1 0 0
|
60 02 1 0 0
|
||||||
70 02 0 1 0
|
70 02 0 1 0
|
||||||
NULL 02 NULL NULL 0
|
NULL 02 NULL NULL 0
|
||||||
|
71 02 0 1 0
|
||||||
98 60 0 1 0
|
98 60 0 1 0
|
||||||
00 60 0 1 0
|
00 60 0 1 0
|
||||||
02 60 0 1 0
|
02 60 0 1 0
|
||||||
60 60 0 0 1
|
60 60 0 0 1
|
||||||
70 60 0 1 0
|
70 60 0 1 0
|
||||||
NULL 60 NULL NULL 0
|
NULL 60 NULL NULL 0
|
||||||
|
71 60 0 1 0
|
||||||
98 70 1 0 0
|
98 70 1 0 0
|
||||||
00 70 1 0 0
|
00 70 1 0 0
|
||||||
02 70 1 0 0
|
02 70 1 0 0
|
||||||
60 70 1 0 0
|
60 70 1 0 0
|
||||||
70 70 0 0 1
|
70 70 0 0 1
|
||||||
NULL 70 NULL NULL 0
|
NULL 70 NULL NULL 0
|
||||||
|
71 70 1 0 0
|
||||||
98 NULL NULL NULL 0
|
98 NULL NULL NULL 0
|
||||||
00 NULL NULL NULL 0
|
00 NULL NULL NULL 0
|
||||||
02 NULL NULL NULL 0
|
02 NULL NULL NULL 0
|
||||||
60 NULL NULL NULL 0
|
60 NULL NULL NULL 0
|
||||||
70 NULL NULL NULL 0
|
70 NULL NULL NULL 0
|
||||||
NULL NULL NULL NULL 1
|
NULL NULL NULL NULL 1
|
||||||
|
71 NULL NULL NULL 0
|
||||||
|
98 71 1 0 0
|
||||||
|
00 71 1 0 0
|
||||||
|
02 71 1 0 0
|
||||||
|
60 71 1 0 0
|
||||||
|
70 71 0 1 0
|
||||||
|
NULL 71 NULL NULL 0
|
||||||
|
71 71 0 0 1
|
||||||
select a.f1 as a, b.f2 as b, a.f1 > b.f2 as gt,
|
select a.f1 as a, b.f2 as b, a.f1 > b.f2 as gt,
|
||||||
a.f1 < b.f2 as lt, a.f1<=>b.f2 as eq
|
a.f1 < b.f2 as lt, a.f1<=>b.f2 as eq
|
||||||
from t1 a, t1 b;
|
from t1 a, t1 b;
|
||||||
@ -1593,36 +1607,49 @@ a b gt lt eq
|
|||||||
60 1998 1 0 0
|
60 1998 1 0 0
|
||||||
70 1998 0 1 0
|
70 1998 0 1 0
|
||||||
NULL 1998 NULL NULL 0
|
NULL 1998 NULL NULL 0
|
||||||
|
71 1998 0 1 0
|
||||||
98 2000 0 1 0
|
98 2000 0 1 0
|
||||||
00 2000 0 0 1
|
00 2000 0 0 1
|
||||||
02 2000 1 0 0
|
02 2000 1 0 0
|
||||||
60 2000 1 0 0
|
60 2000 1 0 0
|
||||||
70 2000 0 1 0
|
70 2000 0 1 0
|
||||||
NULL 2000 NULL NULL 0
|
NULL 2000 NULL NULL 0
|
||||||
|
71 2000 0 1 0
|
||||||
98 2002 0 1 0
|
98 2002 0 1 0
|
||||||
00 2002 0 1 0
|
00 2002 0 1 0
|
||||||
02 2002 0 0 1
|
02 2002 0 0 1
|
||||||
60 2002 1 0 0
|
60 2002 1 0 0
|
||||||
70 2002 0 1 0
|
70 2002 0 1 0
|
||||||
NULL 2002 NULL NULL 0
|
NULL 2002 NULL NULL 0
|
||||||
|
71 2002 0 1 0
|
||||||
98 2060 0 1 0
|
98 2060 0 1 0
|
||||||
00 2060 0 1 0
|
00 2060 0 1 0
|
||||||
02 2060 0 1 0
|
02 2060 0 1 0
|
||||||
60 2060 0 0 1
|
60 2060 0 0 1
|
||||||
70 2060 0 1 0
|
70 2060 0 1 0
|
||||||
NULL 2060 NULL NULL 0
|
NULL 2060 NULL NULL 0
|
||||||
|
71 2060 0 1 0
|
||||||
98 1970 1 0 0
|
98 1970 1 0 0
|
||||||
00 1970 1 0 0
|
00 1970 1 0 0
|
||||||
02 1970 1 0 0
|
02 1970 1 0 0
|
||||||
60 1970 1 0 0
|
60 1970 1 0 0
|
||||||
70 1970 0 0 1
|
70 1970 0 0 1
|
||||||
NULL 1970 NULL NULL 0
|
NULL 1970 NULL NULL 0
|
||||||
|
71 1970 1 0 0
|
||||||
98 NULL NULL NULL 0
|
98 NULL NULL NULL 0
|
||||||
00 NULL NULL NULL 0
|
00 NULL NULL NULL 0
|
||||||
02 NULL NULL NULL 0
|
02 NULL NULL NULL 0
|
||||||
60 NULL NULL NULL 0
|
60 NULL NULL NULL 0
|
||||||
70 NULL NULL NULL 0
|
70 NULL NULL NULL 0
|
||||||
NULL NULL NULL NULL 1
|
NULL NULL NULL NULL 1
|
||||||
|
71 NULL NULL NULL 0
|
||||||
|
98 1971 1 0 0
|
||||||
|
00 1971 1 0 0
|
||||||
|
02 1971 1 0 0
|
||||||
|
60 1971 1 0 0
|
||||||
|
70 1971 0 1 0
|
||||||
|
NULL 1971 NULL NULL 0
|
||||||
|
71 1971 0 0 1
|
||||||
select a.f1 as a, b.f3 as b, a.f1 > b.f3 as gt,
|
select a.f1 as a, b.f3 as b, a.f1 > b.f3 as gt,
|
||||||
a.f1 < b.f3 as lt, a.f1<=>b.f3 as eq
|
a.f1 < b.f3 as lt, a.f1<=>b.f3 as eq
|
||||||
from t1 a, t1 b;
|
from t1 a, t1 b;
|
||||||
@ -1633,36 +1660,49 @@ a b gt lt eq
|
|||||||
60 1998-01-01 1 0 0
|
60 1998-01-01 1 0 0
|
||||||
70 1998-01-01 0 1 0
|
70 1998-01-01 0 1 0
|
||||||
NULL 1998-01-01 NULL NULL 0
|
NULL 1998-01-01 NULL NULL 0
|
||||||
|
71 1998-01-01 0 1 0
|
||||||
98 2000-01-01 0 1 0
|
98 2000-01-01 0 1 0
|
||||||
00 2000-01-01 0 1 0
|
00 2000-01-01 0 1 0
|
||||||
02 2000-01-01 1 0 0
|
02 2000-01-01 1 0 0
|
||||||
60 2000-01-01 1 0 0
|
60 2000-01-01 1 0 0
|
||||||
70 2000-01-01 0 1 0
|
70 2000-01-01 0 1 0
|
||||||
NULL 2000-01-01 NULL NULL 0
|
NULL 2000-01-01 NULL NULL 0
|
||||||
|
71 2000-01-01 0 1 0
|
||||||
98 2002-01-01 0 1 0
|
98 2002-01-01 0 1 0
|
||||||
00 2002-01-01 0 1 0
|
00 2002-01-01 0 1 0
|
||||||
02 2002-01-01 0 1 0
|
02 2002-01-01 0 1 0
|
||||||
60 2002-01-01 1 0 0
|
60 2002-01-01 1 0 0
|
||||||
70 2002-01-01 0 1 0
|
70 2002-01-01 0 1 0
|
||||||
NULL 2002-01-01 NULL NULL 0
|
NULL 2002-01-01 NULL NULL 0
|
||||||
|
71 2002-01-01 0 1 0
|
||||||
98 2060-01-01 0 1 0
|
98 2060-01-01 0 1 0
|
||||||
00 2060-01-01 0 1 0
|
00 2060-01-01 0 1 0
|
||||||
02 2060-01-01 0 1 0
|
02 2060-01-01 0 1 0
|
||||||
60 2060-01-01 0 1 0
|
60 2060-01-01 0 1 0
|
||||||
70 2060-01-01 0 1 0
|
70 2060-01-01 0 1 0
|
||||||
NULL 2060-01-01 NULL NULL 0
|
NULL 2060-01-01 NULL NULL 0
|
||||||
|
71 2060-01-01 0 1 0
|
||||||
98 1970-01-01 1 0 0
|
98 1970-01-01 1 0 0
|
||||||
00 1970-01-01 1 0 0
|
00 1970-01-01 1 0 0
|
||||||
02 1970-01-01 1 0 0
|
02 1970-01-01 1 0 0
|
||||||
60 1970-01-01 1 0 0
|
60 1970-01-01 1 0 0
|
||||||
70 1970-01-01 0 1 0
|
70 1970-01-01 0 1 0
|
||||||
NULL 1970-01-01 NULL NULL 0
|
NULL 1970-01-01 NULL NULL 0
|
||||||
|
71 1970-01-01 1 0 0
|
||||||
98 NULL NULL NULL 0
|
98 NULL NULL NULL 0
|
||||||
00 NULL NULL NULL 0
|
00 NULL NULL NULL 0
|
||||||
02 NULL NULL NULL 0
|
02 NULL NULL NULL 0
|
||||||
60 NULL NULL NULL 0
|
60 NULL NULL NULL 0
|
||||||
70 NULL NULL NULL 0
|
70 NULL NULL NULL 0
|
||||||
NULL NULL NULL NULL 1
|
NULL NULL NULL NULL 1
|
||||||
|
71 NULL NULL NULL 0
|
||||||
|
98 1971-01-01 1 0 0
|
||||||
|
00 1971-01-01 1 0 0
|
||||||
|
02 1971-01-01 1 0 0
|
||||||
|
60 1971-01-01 1 0 0
|
||||||
|
70 1971-01-01 0 1 0
|
||||||
|
NULL 1971-01-01 NULL NULL 0
|
||||||
|
71 1971-01-01 0 1 0
|
||||||
select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt,
|
select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt,
|
||||||
a.f1 < b.f4 as lt, a.f1<=>b.f4 as eq
|
a.f1 < b.f4 as lt, a.f1<=>b.f4 as eq
|
||||||
from t1 a, t1 b;
|
from t1 a, t1 b;
|
||||||
@ -1673,36 +1713,49 @@ a b gt lt eq
|
|||||||
60 1998-01-01 00:00:00 1 0 0
|
60 1998-01-01 00:00:00 1 0 0
|
||||||
70 1998-01-01 00:00:00 0 1 0
|
70 1998-01-01 00:00:00 0 1 0
|
||||||
NULL 1998-01-01 00:00:00 NULL NULL 0
|
NULL 1998-01-01 00:00:00 NULL NULL 0
|
||||||
|
71 1998-01-01 00:00:00 0 1 0
|
||||||
98 2000-01-01 00:00:01 0 1 0
|
98 2000-01-01 00:00:01 0 1 0
|
||||||
00 2000-01-01 00:00:01 0 1 0
|
00 2000-01-01 00:00:01 0 1 0
|
||||||
02 2000-01-01 00:00:01 1 0 0
|
02 2000-01-01 00:00:01 1 0 0
|
||||||
60 2000-01-01 00:00:01 1 0 0
|
60 2000-01-01 00:00:01 1 0 0
|
||||||
70 2000-01-01 00:00:01 0 1 0
|
70 2000-01-01 00:00:01 0 1 0
|
||||||
NULL 2000-01-01 00:00:01 NULL NULL 0
|
NULL 2000-01-01 00:00:01 NULL NULL 0
|
||||||
|
71 2000-01-01 00:00:01 0 1 0
|
||||||
98 2002-01-01 23:59:59 0 1 0
|
98 2002-01-01 23:59:59 0 1 0
|
||||||
00 2002-01-01 23:59:59 0 1 0
|
00 2002-01-01 23:59:59 0 1 0
|
||||||
02 2002-01-01 23:59:59 0 1 0
|
02 2002-01-01 23:59:59 0 1 0
|
||||||
60 2002-01-01 23:59:59 1 0 0
|
60 2002-01-01 23:59:59 1 0 0
|
||||||
70 2002-01-01 23:59:59 0 1 0
|
70 2002-01-01 23:59:59 0 1 0
|
||||||
NULL 2002-01-01 23:59:59 NULL NULL 0
|
NULL 2002-01-01 23:59:59 NULL NULL 0
|
||||||
|
71 2002-01-01 23:59:59 0 1 0
|
||||||
98 2060-01-01 11:11:11 0 1 0
|
98 2060-01-01 11:11:11 0 1 0
|
||||||
00 2060-01-01 11:11:11 0 1 0
|
00 2060-01-01 11:11:11 0 1 0
|
||||||
02 2060-01-01 11:11:11 0 1 0
|
02 2060-01-01 11:11:11 0 1 0
|
||||||
60 2060-01-01 11:11:11 0 1 0
|
60 2060-01-01 11:11:11 0 1 0
|
||||||
70 2060-01-01 11:11:11 0 1 0
|
70 2060-01-01 11:11:11 0 1 0
|
||||||
NULL 2060-01-01 11:11:11 NULL NULL 0
|
NULL 2060-01-01 11:11:11 NULL NULL 0
|
||||||
|
71 2060-01-01 11:11:11 0 1 0
|
||||||
98 1970-11-11 22:22:22 1 0 0
|
98 1970-11-11 22:22:22 1 0 0
|
||||||
00 1970-11-11 22:22:22 1 0 0
|
00 1970-11-11 22:22:22 1 0 0
|
||||||
02 1970-11-11 22:22:22 1 0 0
|
02 1970-11-11 22:22:22 1 0 0
|
||||||
60 1970-11-11 22:22:22 1 0 0
|
60 1970-11-11 22:22:22 1 0 0
|
||||||
70 1970-11-11 22:22:22 0 1 0
|
70 1970-11-11 22:22:22 0 1 0
|
||||||
NULL 1970-11-11 22:22:22 NULL NULL 0
|
NULL 1970-11-11 22:22:22 NULL NULL 0
|
||||||
|
71 1970-11-11 22:22:22 1 0 0
|
||||||
98 NULL NULL NULL 0
|
98 NULL NULL NULL 0
|
||||||
00 NULL NULL NULL 0
|
00 NULL NULL NULL 0
|
||||||
02 NULL NULL NULL 0
|
02 NULL NULL NULL 0
|
||||||
60 NULL NULL NULL 0
|
60 NULL NULL NULL 0
|
||||||
70 NULL NULL NULL 0
|
70 NULL NULL NULL 0
|
||||||
NULL NULL NULL NULL 1
|
NULL NULL NULL NULL 1
|
||||||
|
71 NULL NULL NULL 0
|
||||||
|
98 1971-11-11 22:22:22 1 0 0
|
||||||
|
00 1971-11-11 22:22:22 1 0 0
|
||||||
|
02 1971-11-11 22:22:22 1 0 0
|
||||||
|
60 1971-11-11 22:22:22 1 0 0
|
||||||
|
70 1971-11-11 22:22:22 0 1 0
|
||||||
|
NULL 1971-11-11 22:22:22 NULL NULL 0
|
||||||
|
71 1971-11-11 22:22:22 0 1 0
|
||||||
select *, f1 = f2 from t1;
|
select *, f1 = f2 from t1;
|
||||||
f1 f2 f3 f4 f1 = f2
|
f1 f2 f3 f4 f1 = f2
|
||||||
98 1998 1998-01-01 1998-01-01 00:00:00 1
|
98 1998 1998-01-01 1998-01-01 00:00:00 1
|
||||||
@ -1711,6 +1764,7 @@ f1 f2 f3 f4 f1 = f2
|
|||||||
60 2060 2060-01-01 2060-01-01 11:11:11 1
|
60 2060 2060-01-01 2060-01-01 11:11:11 1
|
||||||
70 1970 1970-01-01 1970-11-11 22:22:22 1
|
70 1970 1970-01-01 1970-11-11 22:22:22 1
|
||||||
NULL NULL NULL NULL NULL
|
NULL NULL NULL NULL NULL
|
||||||
|
71 1971 1971-01-01 1971-11-11 22:22:22 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
# Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
|
# Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
|
||||||
|
@ -479,7 +479,7 @@ SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29');
|
|||||||
a
|
a
|
||||||
1972-02-06
|
1972-02-06
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1
|
Warning 1292 Incorrect datetime value: '19772-07-29'
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
CREATE TABLE t1 (id int not null);
|
CREATE TABLE t1 (id int not null);
|
||||||
INSERT INTO t1 VALUES (1),(2);
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
@ -184,8 +184,8 @@ microsecond("1997-12-31 23:59:59.000001")
|
|||||||
1
|
1
|
||||||
create table t1
|
create table t1
|
||||||
select makedate(1997,1) as f1,
|
select makedate(1997,1) as f1,
|
||||||
addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
|
addtime(cast("1997-12-31 23:59:59.000001" as datetime(6)), "1 1:1:1.000002") as f2,
|
||||||
addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
|
addtime(cast("23:59:59.999999" as time(6)) , "1 1:1:1.000002") as f3,
|
||||||
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
|
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
|
||||||
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
|
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
|
||||||
maketime(10,11,12) as f6,
|
maketime(10,11,12) as f6,
|
||||||
|
@ -11,19 +11,33 @@ now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(no
|
|||||||
0 0 0
|
0 0 0
|
||||||
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
|
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
|
||||||
from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
|
from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
|
||||||
1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112
|
1994-03-02 10:11:12.000000 1994-03-02 10:11:12 19940302101112.000000
|
||||||
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
|
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
|
||||||
sec_to_time(time_to_sec("0:30:47")/6.21);
|
sec_to_time(time_to_sec("0:30:47")/6.21);
|
||||||
sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21)
|
sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21)
|
||||||
02:30:01 23001 54742 00:04:57.423510
|
02:30:01 23001 54742.000000 00:04:57.423510
|
||||||
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
|
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
|
||||||
sec_to_time(9001.1) time_to_sec('15:12:22.123456') time_to_sec(15.5566778899)
|
sec_to_time(9001.1) time_to_sec('15:12:22.123456') time_to_sec(15.5566778899)
|
||||||
02:30:01.1 54742.123456 15.556677
|
02:30:01.1 54742.123456 15.556677
|
||||||
Warnings:
|
|
||||||
Warning 1292 Truncated incorrect time value: '15.5566778899'
|
|
||||||
select sec_to_time(time_to_sec('-838:59:59'));
|
select sec_to_time(time_to_sec('-838:59:59'));
|
||||||
sec_to_time(time_to_sec('-838:59:59'))
|
sec_to_time(time_to_sec('-838:59:59'))
|
||||||
-838:59:59
|
-838:59:59.000000
|
||||||
|
select sec_to_time('9001.1'), sec_to_time('1234567890123.123');
|
||||||
|
sec_to_time('9001.1') sec_to_time('1234567890123.123')
|
||||||
|
02:30:01.100000 838:59:59.999999
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect time value: '1234567890123.123'
|
||||||
|
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
|
||||||
|
sec_to_time(90011e-1) sec_to_time(1234567890123e30)
|
||||||
|
02:30:01.100000 838:59:59.999999
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect time value: '1.234567890123e+42'
|
||||||
|
select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
|
||||||
|
sec_to_time(1234567890123) sec_to_time('99999999999999999999999999999')
|
||||||
|
838:59:59 838:59:59.999999
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect time value: '1234567890123'
|
||||||
|
Warning 1292 Truncated incorrect time value: '99999999999999999999999999999'
|
||||||
select now()-curdate()*1000000-curtime();
|
select now()-curdate()*1000000-curtime();
|
||||||
now()-curdate()*1000000-curtime()
|
now()-curdate()*1000000-curtime()
|
||||||
0
|
0
|
||||||
@ -145,18 +159,18 @@ Saturday 5
|
|||||||
select monthname("1972-03-04"),monthname("1972-03-04")+0;
|
select monthname("1972-03-04"),monthname("1972-03-04")+0;
|
||||||
monthname("1972-03-04") monthname("1972-03-04")+0
|
monthname("1972-03-04") monthname("1972-03-04")+0
|
||||||
March 3
|
March 3
|
||||||
select time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
||||||
00|12|0|12|00|AM|12:00:00 AM|00|00:00:00
|
00|12|0|12|00|AM|12:00:00 AM|00|00:00:00 00|12|0|12|00|AM|12:00:00 AM|00|00:00:00
|
||||||
select time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
||||||
01|01|1|1|02|AM|01:02:03 AM|03|01:02:03
|
01|01|1|1|02|AM|01:02:03 AM|03|01:02:03 01|01|1|1|02|AM|01:02:03 AM|03|01:02:03
|
||||||
select time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
||||||
13|01|13|1|14|PM|01:14:15 PM|15|13:14:15
|
13|01|13|1|14|PM|01:14:15 PM|15|13:14:15 13|01|13|1|14|PM|01:14:15 PM|15|13:14:15
|
||||||
select time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
|
||||||
01|01|1|1|00|AM|01:00:15 AM|15|01:00:15
|
01|01|1|1|00|AM|01:00:15 AM|15|01:00:15 01|01|1|1|00|AM|01:00:15 AM|15|01:00:15
|
||||||
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
||||||
date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
|
date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
|
||||||
13|01|13|1|14|PM|01:14:15 PM|15|13:14:15| January|Saturday|31st|1998|98|Sat|Jan|031|01|31|01|15|6
|
13|01|13|1|14|PM|01:14:15 PM|15|13:14:15| January|Saturday|31st|1998|98|Sat|Jan|031|01|31|01|15|6
|
||||||
@ -551,7 +565,7 @@ select @a:=FROM_UNIXTIME(1);
|
|||||||
1970-01-01 03:00:01
|
1970-01-01 03:00:01
|
||||||
select unix_timestamp(@a);
|
select unix_timestamp(@a);
|
||||||
unix_timestamp(@a)
|
unix_timestamp(@a)
|
||||||
1
|
1.000000
|
||||||
select unix_timestamp('1969-12-01 19:00:01');
|
select unix_timestamp('1969-12-01 19:00:01');
|
||||||
unix_timestamp('1969-12-01 19:00:01')
|
unix_timestamp('1969-12-01 19:00:01')
|
||||||
NULL
|
NULL
|
||||||
@ -593,10 +607,10 @@ unix_timestamp('1969-12-30 01:00:00')
|
|||||||
NULL
|
NULL
|
||||||
select unix_timestamp('2038-01-17 12:00:00');
|
select unix_timestamp('2038-01-17 12:00:00');
|
||||||
unix_timestamp('2038-01-17 12:00:00')
|
unix_timestamp('2038-01-17 12:00:00')
|
||||||
2147331600
|
2147331600.000000
|
||||||
select unix_timestamp('1970-01-01 03:00:01');
|
select unix_timestamp('1970-01-01 03:00:01');
|
||||||
unix_timestamp('1970-01-01 03:00:01')
|
unix_timestamp('1970-01-01 03:00:01')
|
||||||
1
|
1.000000
|
||||||
select unix_timestamp('2038-01-19 07:14:07');
|
select unix_timestamp('2038-01-19 07:14:07');
|
||||||
unix_timestamp('2038-01-19 07:14:07')
|
unix_timestamp('2038-01-19 07:14:07')
|
||||||
NULL
|
NULL
|
||||||
@ -947,10 +961,10 @@ sec_to_time(1) + 0, from_unixtime(1) + 0;
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`now() - now()` double(17,0) NOT NULL DEFAULT '0',
|
`now() - now()` decimal(20,0) NOT NULL DEFAULT '0',
|
||||||
`curtime() - curtime()` double(17,0) NOT NULL DEFAULT '0',
|
`curtime() - curtime()` decimal(11,0) NOT NULL DEFAULT '0',
|
||||||
`sec_to_time(1) + 0` double(17,0) DEFAULT NULL,
|
`sec_to_time(1) + 0` decimal(11,0) DEFAULT NULL,
|
||||||
`from_unixtime(1) + 0` double(17,0) DEFAULT NULL
|
`from_unixtime(1) + 0` decimal(20,0) DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
SELECT SEC_TO_TIME(3300000);
|
SELECT SEC_TO_TIME(3300000);
|
||||||
@ -1041,6 +1055,7 @@ SEC_TO_TIME(CAST(-1 AS UNSIGNED))
|
|||||||
838:59:59
|
838:59:59
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1105 Cast to unsigned converted negative integer to it's positive complement
|
Warning 1105 Cast to unsigned converted negative integer to it's positive complement
|
||||||
|
Warning 1105 Cast to unsigned converted negative integer to it's positive complement
|
||||||
Warning 1292 Truncated incorrect time value: '18446744073709551615'
|
Warning 1292 Truncated incorrect time value: '18446744073709551615'
|
||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
SET character_set_results = NULL;
|
SET character_set_results = NULL;
|
||||||
@ -1089,7 +1104,9 @@ NULL
|
|||||||
select isnull(week(now() + 0)), isnull(week(now() + 0.2)),
|
select isnull(week(now() + 0)), isnull(week(now() + 0.2)),
|
||||||
week(20061108), week(20061108.01), week(20061108085411.000002);
|
week(20061108), week(20061108.01), week(20061108085411.000002);
|
||||||
isnull(week(now() + 0)) isnull(week(now() + 0.2)) week(20061108) week(20061108.01) week(20061108085411.000002)
|
isnull(week(now() + 0)) isnull(week(now() + 0.2)) week(20061108) week(20061108.01) week(20061108085411.000002)
|
||||||
0 0 45 45 45
|
0 0 45 NULL 45
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Incorrect datetime value: '20061108.01'
|
||||||
End of 4.1 tests
|
End of 4.1 tests
|
||||||
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
|
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
|
||||||
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
|
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
|
||||||
@ -1482,6 +1499,16 @@ time('-1 02:03:04') + interval 2 day
|
|||||||
select time('-1 02:03:04') - interval 2 day;
|
select time('-1 02:03:04') - interval 2 day;
|
||||||
time('-1 02:03:04') - interval 2 day
|
time('-1 02:03:04') - interval 2 day
|
||||||
-74:03:04
|
-74:03:04
|
||||||
|
select time('10 02:03:04') + interval 30 day;
|
||||||
|
time('10 02:03:04') + interval 30 day
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1441 Datetime function: time field overflow
|
||||||
|
select time('10 02:03:04') + interval 1 year;
|
||||||
|
time('10 02:03:04') + interval 1 year
|
||||||
|
NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1441 Datetime function: time field overflow
|
||||||
select cast('131415.123e0' as time);
|
select cast('131415.123e0' as time);
|
||||||
cast('131415.123e0' as time)
|
cast('131415.123e0' as time)
|
||||||
NULL
|
NULL
|
||||||
@ -1524,8 +1551,6 @@ select * from t1 where f1 > time('-23:00:06');
|
|||||||
f1
|
f1
|
||||||
2000-09-12 00:00:00
|
2000-09-12 00:00:00
|
||||||
2007-04-25 05:08:49
|
2007-04-25 05:08:49
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '-23:00:06' for column 'f1' at row 1
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select maketime(20,61,10)+0;
|
select maketime(20,61,10)+0;
|
||||||
maketime(20,61,10)+0
|
maketime(20,61,10)+0
|
||||||
@ -1575,7 +1600,7 @@ select least(1, f1) from t1;
|
|||||||
least(1, f1)
|
least(1, f1)
|
||||||
0000-00-00 00:00:00
|
0000-00-00 00:00:00
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '1' for column 'f1' at row 1
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select now() > coalesce(time('21:43:24'), date('2010-05-03'));
|
select now() > coalesce(time('21:43:24'), date('2010-05-03'));
|
||||||
now() > coalesce(time('21:43:24'), date('2010-05-03'))
|
now() > coalesce(time('21:43:24'), date('2010-05-03'))
|
||||||
@ -1600,6 +1625,8 @@ insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00
|
|||||||
select least(greatest(f3, f2, f4), f5) from t1;
|
select least(greatest(f3, f2, f4), f5) from t1;
|
||||||
least(greatest(f3, f2, f4), f5)
|
least(greatest(f3, f2, f4), f5)
|
||||||
0000-00-00 00:00:00
|
0000-00-00 00:00:00
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Incorrect datetime value: '0'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select day(coalesce(null));
|
select day(coalesce(null));
|
||||||
day(coalesce(null))
|
day(coalesce(null))
|
||||||
|
@ -15,10 +15,10 @@ current_time(3) 01:01:01.123
|
|||||||
current_timestamp(4) 2011-01-01 01:01:01.1234
|
current_timestamp(4) 2011-01-01 01:01:01.1234
|
||||||
localtime(5) 2011-01-01 01:01:01.12345
|
localtime(5) 2011-01-01 01:01:01.12345
|
||||||
localtimestamp(6) 2011-01-01 01:01:01.123456
|
localtimestamp(6) 2011-01-01 01:01:01.123456
|
||||||
time_to_sec('12:34:56') 45296
|
time_to_sec('12:34:56') 45296.000000
|
||||||
time_to_sec('12:34:56.789') 45296.789
|
time_to_sec('12:34:56.789') 45296.789000
|
||||||
select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890'));
|
select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890'));
|
||||||
sec_to_time(time_to_sec('1:2:3')) 01:02:03
|
sec_to_time(time_to_sec('1:2:3')) 01:02:03.000000
|
||||||
sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.567890
|
sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.567890
|
||||||
select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
|
select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
|
||||||
time_to_sec(sec_to_time(11111)) 11111
|
time_to_sec(sec_to_time(11111)) 11111
|
||||||
@ -48,7 +48,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
`localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000',
|
`localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000',
|
||||||
`localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
|
`localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
|
||||||
`time_to_sec(123456)` bigint(17) DEFAULT NULL,
|
`time_to_sec(123456)` bigint(17) DEFAULT NULL,
|
||||||
`time_to_sec('12:34:56.789')` double DEFAULT NULL
|
`time_to_sec('12:34:56.789')` decimal(22,6) DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
select * from t1;
|
select * from t1;
|
||||||
sec_to_time(12345) 03:25:45
|
sec_to_time(12345) 03:25:45
|
||||||
@ -63,36 +63,30 @@ current_timestamp(4) 2011-01-01 01:01:01.1234
|
|||||||
localtime(5) 2011-01-01 01:01:01.12345
|
localtime(5) 2011-01-01 01:01:01.12345
|
||||||
localtimestamp(6) 2011-01-01 01:01:01.123456
|
localtimestamp(6) 2011-01-01 01:01:01.123456
|
||||||
time_to_sec(123456) 45296
|
time_to_sec(123456) 45296
|
||||||
time_to_sec('12:34:56.789') 45296.789
|
time_to_sec('12:34:56.789') 45296.789000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));;
|
select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));;
|
||||||
unix_timestamp('2011-01-01 01:01:01') 1293832861
|
unix_timestamp('2011-01-01 01:01:01') 1293832861.000000
|
||||||
unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.12346
|
unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.123456
|
||||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861
|
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861
|
||||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1235
|
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1234
|
||||||
select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));;
|
select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));;
|
||||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01
|
from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01.000000
|
||||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456
|
from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456
|
||||||
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01
|
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01
|
||||||
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234
|
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234
|
||||||
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
|
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
|
||||||
sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999)
|
sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999)
|
||||||
838:59:59.99999 838:59:59.999999 838:59:59.999999
|
838:59:59.99999 838:59:59.999999 838:59:59.999999
|
||||||
Warnings:
|
|
||||||
Warning 1292 Truncated incorrect time value: '3020399.9999999'
|
|
||||||
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
|
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
|
||||||
sec_to_time(-3020399.99999) sec_to_time(-3020399.999999) sec_to_time(-3020399.9999999)
|
sec_to_time(-3020399.99999) sec_to_time(-3020399.999999) sec_to_time(-3020399.9999999)
|
||||||
-838:59:59.99999 -838:59:59.999999 -838:59:59.999999
|
-838:59:59.99999 -838:59:59.999999 -838:59:59.999999
|
||||||
Warnings:
|
|
||||||
Warning 1292 Truncated incorrect time value: '-3020399.9999999'
|
|
||||||
select 20010101000203.000000004 + interval 1 day;
|
select 20010101000203.000000004 + interval 1 day;
|
||||||
20010101000203.000000004 + interval 1 day
|
20010101000203.000000004 + interval 1 day
|
||||||
2001-01-02 00:02:03.000000
|
2001-01-02 00:02:03.000000
|
||||||
Warnings:
|
select 20010101000203.4 + interval 1 day;
|
||||||
Warning 1292 Truncated incorrect datetime value: '20010101000203.000000004'
|
20010101000203.4 + interval 1 day
|
||||||
select 20010101000203.00004 + interval 1 day;
|
2001-01-02 00:02:03.4
|
||||||
20010101000203.00004 + interval 1 day
|
|
||||||
2001-01-02 00:02:03.00004
|
|
||||||
set @a=cast('2011-01-02 12:13:14' as datetime);
|
set @a=cast('2011-01-02 12:13:14' as datetime);
|
||||||
select @a + interval 1 minute;
|
select @a + interval 1 minute;
|
||||||
@a + interval 1 minute
|
@a + interval 1 minute
|
||||||
@ -158,6 +152,14 @@ t4 12:13:14.1234
|
|||||||
t5 12:13:14.12345
|
t5 12:13:14.12345
|
||||||
t6 12:13:14.123456
|
t6 12:13:14.123456
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
explain extended select cast(cast(@a as datetime(4)) as time(0));
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select cast(cast((@a) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
|
||||||
|
select cast(cast(@a as time(2)) as time(6));
|
||||||
|
cast(cast(@a as time(2)) as time(6))
|
||||||
|
12:13:14.120000
|
||||||
select CAST(@a AS DATETIME(7));
|
select CAST(@a AS DATETIME(7));
|
||||||
ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6.
|
ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6.
|
||||||
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
|
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
|
||||||
|
@ -7,7 +7,7 @@ SELECT CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit) AS Date,
|
|||||||
UNIX_TIMESTAMP(CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit)) AS Unix
|
UNIX_TIMESTAMP(CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit)) AS Unix
|
||||||
FROM t1;
|
FROM t1;
|
||||||
Date Unix
|
Date Unix
|
||||||
1998-9-16 09:26:00 905927160
|
1998-9-16 09:26:00 905927160.000000
|
||||||
1998-9-16 09:26:00 905927160
|
1998-9-16 09:26:00 905927160.000000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set time_zone= @@global.time_zone;
|
set time_zone= @@global.time_zone;
|
||||||
|
@ -212,7 +212,7 @@ DROP TABLE t1;
|
|||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
select cast('01:01:01' as time), cast('01:01:01' as time(2));
|
select cast('01:01:01' as time), cast('01:01:01' as time(2));
|
||||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def cast('01:01:01' as time) 11 9 8 Y 128 0 63
|
def cast('01:01:01' as time) 11 10 8 Y 128 0 63
|
||||||
def cast('01:01:01' as time(2)) 11 12 11 Y 128 2 63
|
def cast('01:01:01' as time(2)) 11 13 11 Y 128 2 63
|
||||||
cast('01:01:01' as time) cast('01:01:01' as time(2))
|
cast('01:01:01' as time) cast('01:01:01' as time(2))
|
||||||
01:01:01 01:01:01.00
|
01:01:01 01:01:01.00
|
||||||
|
@ -667,7 +667,7 @@ CREATE TABLE t1 (f1 DATE);
|
|||||||
INSERT INTO t1 VALUES('2001-01-01');
|
INSERT INTO t1 VALUES('2001-01-01');
|
||||||
UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1;
|
UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
DROP FUNCTION f1;
|
DROP FUNCTION f1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
end of tests
|
end of tests
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
drop table if exists t1_30237_bool;
|
drop table if exists t1_30237_bool;
|
||||||
|
set sql_mode=NO_UNSIGNED_SUBTRACTION;
|
||||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||||
insert into t1_30237_bool values
|
insert into t1_30237_bool values
|
||||||
(FALSE, FALSE, FALSE),
|
(FALSE, FALSE, FALSE),
|
||||||
|
@ -64,7 +64,7 @@ def test t9 t9 c12 c12 246 10 6 Y 0 4 63
|
|||||||
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
||||||
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
||||||
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
||||||
def test t9 t9 c16 c16 11 9 8 Y 128 0 63
|
def test t9 t9 c16 c16 11 10 8 Y 128 0 63
|
||||||
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
||||||
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
||||||
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
||||||
@ -1793,8 +1793,8 @@ t5 CREATE TABLE `t5` (
|
|||||||
`param08` longtext,
|
`param08` longtext,
|
||||||
`const09` datetime DEFAULT NULL,
|
`const09` datetime DEFAULT NULL,
|
||||||
`param09` longblob,
|
`param09` longblob,
|
||||||
`const10` double NOT NULL DEFAULT '0',
|
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
|
||||||
`param10` double DEFAULT NULL,
|
`param10` decimal(65,30) DEFAULT NULL,
|
||||||
`const11` int(4) DEFAULT NULL,
|
`const11` int(4) DEFAULT NULL,
|
||||||
`param11` bigint(20) DEFAULT NULL,
|
`param11` bigint(20) DEFAULT NULL,
|
||||||
`const12` binary(0) DEFAULT NULL,
|
`const12` binary(0) DEFAULT NULL,
|
||||||
@ -1823,8 +1823,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
|||||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||||
def test t5 t5 const10 const10 5 49 9 N 32769 31 63
|
def test t5 t5 const10 const10 246 24 16 N 1 6 63
|
||||||
def test t5 t5 param10 param10 5 23 9 Y 32768 31 63
|
def test t5 t5 param10 param10 246 67 40 Y 0 30 63
|
||||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||||
@ -1850,8 +1850,8 @@ const08 1991-08-05 01:01:01
|
|||||||
param08 1991-08-05 01:01:01
|
param08 1991-08-05 01:01:01
|
||||||
const09 1991-08-05 01:01:01
|
const09 1991-08-05 01:01:01
|
||||||
param09 1991-08-05 01:01:01
|
param09 1991-08-05 01:01:01
|
||||||
const10 662680861
|
const10 662680861.000000
|
||||||
param10 662680861
|
param10 662680861.000000000000000000000000000000
|
||||||
const11 1991
|
const11 1991
|
||||||
param11 1991
|
param11 1991
|
||||||
const12 NULL
|
const12 NULL
|
||||||
@ -3215,7 +3215,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3225,7 +3225,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt1 from "insert into t9
|
prepare stmt1 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3236,7 +3236,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3247,7 +3247,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 1.0e+10 ;
|
set @arg00= 1.0e+10 ;
|
||||||
insert into t9
|
insert into t9
|
||||||
@ -3256,7 +3256,7 @@ values
|
|||||||
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3273,7 +3273,7 @@ values
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3282,7 +3282,7 @@ values
|
|||||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 'abc' ;
|
set @arg00= 'abc' ;
|
||||||
set @arg00= NULL ;
|
set @arg00= NULL ;
|
||||||
@ -3338,14 +3338,14 @@ c1 c13 c14 c15 c16 c17
|
|||||||
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
|
@ -64,7 +64,7 @@ def test t9 t9 c12 c12 246 10 6 Y 0 4 63
|
|||||||
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
||||||
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
||||||
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
||||||
def test t9 t9 c16 c16 11 9 8 Y 128 0 63
|
def test t9 t9 c16 c16 11 10 8 Y 128 0 63
|
||||||
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
||||||
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
||||||
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
||||||
@ -1776,8 +1776,8 @@ t5 CREATE TABLE `t5` (
|
|||||||
`param08` longtext,
|
`param08` longtext,
|
||||||
`const09` datetime DEFAULT NULL,
|
`const09` datetime DEFAULT NULL,
|
||||||
`param09` longblob,
|
`param09` longblob,
|
||||||
`const10` double NOT NULL DEFAULT '0',
|
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
|
||||||
`param10` double DEFAULT NULL,
|
`param10` decimal(65,30) DEFAULT NULL,
|
||||||
`const11` int(4) DEFAULT NULL,
|
`const11` int(4) DEFAULT NULL,
|
||||||
`param11` bigint(20) DEFAULT NULL,
|
`param11` bigint(20) DEFAULT NULL,
|
||||||
`const12` binary(0) DEFAULT NULL,
|
`const12` binary(0) DEFAULT NULL,
|
||||||
@ -1806,8 +1806,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
|||||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||||
def test t5 t5 const10 const10 5 49 9 N 32769 31 63
|
def test t5 t5 const10 const10 246 24 16 N 1 6 63
|
||||||
def test t5 t5 param10 param10 5 23 9 Y 32768 31 63
|
def test t5 t5 param10 param10 246 67 40 Y 0 30 63
|
||||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||||
@ -1833,8 +1833,8 @@ const08 1991-08-05 01:01:01
|
|||||||
param08 1991-08-05 01:01:01
|
param08 1991-08-05 01:01:01
|
||||||
const09 1991-08-05 01:01:01
|
const09 1991-08-05 01:01:01
|
||||||
param09 1991-08-05 01:01:01
|
param09 1991-08-05 01:01:01
|
||||||
const10 662680861
|
const10 662680861.000000
|
||||||
param10 662680861
|
param10 662680861.000000000000000000000000000000
|
||||||
const11 1991
|
const11 1991
|
||||||
param11 1991
|
param11 1991
|
||||||
const12 NULL
|
const12 NULL
|
||||||
@ -3198,7 +3198,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3208,7 +3208,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt1 from "insert into t9
|
prepare stmt1 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3219,7 +3219,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3230,7 +3230,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 1.0e+10 ;
|
set @arg00= 1.0e+10 ;
|
||||||
insert into t9
|
insert into t9
|
||||||
@ -3239,7 +3239,7 @@ values
|
|||||||
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3256,7 +3256,7 @@ values
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3265,7 +3265,7 @@ values
|
|||||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 'abc' ;
|
set @arg00= 'abc' ;
|
||||||
set @arg00= NULL ;
|
set @arg00= NULL ;
|
||||||
@ -3321,14 +3321,14 @@ c1 c13 c14 c15 c16 c17
|
|||||||
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
|
@ -65,7 +65,7 @@ def test t9 t9 c12 c12 246 10 6 Y 0 4 63
|
|||||||
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
||||||
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
||||||
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
||||||
def test t9 t9 c16 c16 11 9 8 Y 128 0 63
|
def test t9 t9 c16 c16 11 10 8 Y 128 0 63
|
||||||
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
||||||
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
||||||
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
||||||
@ -1777,8 +1777,8 @@ t5 CREATE TABLE `t5` (
|
|||||||
`param08` longtext,
|
`param08` longtext,
|
||||||
`const09` datetime DEFAULT NULL,
|
`const09` datetime DEFAULT NULL,
|
||||||
`param09` longblob,
|
`param09` longblob,
|
||||||
`const10` double NOT NULL DEFAULT '0',
|
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
|
||||||
`param10` double DEFAULT NULL,
|
`param10` decimal(65,30) DEFAULT NULL,
|
||||||
`const11` int(4) DEFAULT NULL,
|
`const11` int(4) DEFAULT NULL,
|
||||||
`param11` bigint(20) DEFAULT NULL,
|
`param11` bigint(20) DEFAULT NULL,
|
||||||
`const12` binary(0) DEFAULT NULL,
|
`const12` binary(0) DEFAULT NULL,
|
||||||
@ -1807,8 +1807,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
|||||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||||
def test t5 t5 const10 const10 5 49 9 N 32769 31 63
|
def test t5 t5 const10 const10 246 24 16 N 1 6 63
|
||||||
def test t5 t5 param10 param10 5 23 9 Y 32768 31 63
|
def test t5 t5 param10 param10 246 67 40 Y 0 30 63
|
||||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||||
@ -1834,8 +1834,8 @@ const08 1991-08-05 01:01:01
|
|||||||
param08 1991-08-05 01:01:01
|
param08 1991-08-05 01:01:01
|
||||||
const09 1991-08-05 01:01:01
|
const09 1991-08-05 01:01:01
|
||||||
param09 1991-08-05 01:01:01
|
param09 1991-08-05 01:01:01
|
||||||
const10 662680861
|
const10 662680861.000000
|
||||||
param10 662680861
|
param10 662680861.000000000000000000000000000000
|
||||||
const11 1991
|
const11 1991
|
||||||
param11 1991
|
param11 1991
|
||||||
const12 NULL
|
const12 NULL
|
||||||
@ -3199,7 +3199,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3209,7 +3209,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt1 from "insert into t9
|
prepare stmt1 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3220,7 +3220,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3231,7 +3231,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 1.0e+10 ;
|
set @arg00= 1.0e+10 ;
|
||||||
insert into t9
|
insert into t9
|
||||||
@ -3240,7 +3240,7 @@ values
|
|||||||
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3257,7 +3257,7 @@ values
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3266,7 +3266,7 @@ values
|
|||||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 'abc' ;
|
set @arg00= 'abc' ;
|
||||||
set @arg00= NULL ;
|
set @arg00= NULL ;
|
||||||
@ -3322,14 +3322,14 @@ c1 c13 c14 c15 c16 c17
|
|||||||
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
|
@ -107,7 +107,7 @@ def test t9 t9 c12 c12 246 10 6 Y 0 4 63
|
|||||||
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
||||||
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
||||||
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
||||||
def test t9 t9 c16 c16 11 9 8 Y 128 0 63
|
def test t9 t9 c16 c16 11 10 8 Y 128 0 63
|
||||||
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
||||||
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
||||||
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
||||||
@ -1713,8 +1713,8 @@ t5 CREATE TABLE `t5` (
|
|||||||
`param08` longtext,
|
`param08` longtext,
|
||||||
`const09` datetime DEFAULT NULL,
|
`const09` datetime DEFAULT NULL,
|
||||||
`param09` longblob,
|
`param09` longblob,
|
||||||
`const10` double NOT NULL DEFAULT '0',
|
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
|
||||||
`param10` double DEFAULT NULL,
|
`param10` decimal(65,30) DEFAULT NULL,
|
||||||
`const11` int(4) DEFAULT NULL,
|
`const11` int(4) DEFAULT NULL,
|
||||||
`param11` bigint(20) DEFAULT NULL,
|
`param11` bigint(20) DEFAULT NULL,
|
||||||
`const12` binary(0) DEFAULT NULL,
|
`const12` binary(0) DEFAULT NULL,
|
||||||
@ -1743,8 +1743,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
|||||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||||
def test t5 t5 const10 const10 5 49 9 N 32769 31 63
|
def test t5 t5 const10 const10 246 24 16 N 1 6 63
|
||||||
def test t5 t5 param10 param10 5 23 9 Y 32768 31 63
|
def test t5 t5 param10 param10 246 67 40 Y 0 30 63
|
||||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||||
@ -1770,8 +1770,8 @@ const08 1991-08-05 01:01:01
|
|||||||
param08 1991-08-05 01:01:01
|
param08 1991-08-05 01:01:01
|
||||||
const09 1991-08-05 01:01:01
|
const09 1991-08-05 01:01:01
|
||||||
param09 1991-08-05 01:01:01
|
param09 1991-08-05 01:01:01
|
||||||
const10 662680861
|
const10 662680861.000000
|
||||||
param10 662680861
|
param10 662680861.000000000000000000000000000000
|
||||||
const11 1991
|
const11 1991
|
||||||
param11 1991
|
param11 1991
|
||||||
const12 NULL
|
const12 NULL
|
||||||
@ -3135,7 +3135,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3145,7 +3145,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt1 from "insert into t9
|
prepare stmt1 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3156,7 +3156,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3167,7 +3167,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 1.0e+10 ;
|
set @arg00= 1.0e+10 ;
|
||||||
insert into t9
|
insert into t9
|
||||||
@ -3176,7 +3176,7 @@ values
|
|||||||
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3193,7 +3193,7 @@ values
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3202,7 +3202,7 @@ values
|
|||||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 'abc' ;
|
set @arg00= 'abc' ;
|
||||||
set @arg00= NULL ;
|
set @arg00= NULL ;
|
||||||
@ -3258,14 +3258,14 @@ c1 c13 c14 c15 c16 c17
|
|||||||
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
@ -3461,7 +3461,7 @@ def test t9 t9 c12 c12 246 10 6 Y 0 4 63
|
|||||||
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
||||||
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
||||||
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
||||||
def test t9 t9 c16 c16 11 9 8 Y 128 0 63
|
def test t9 t9 c16 c16 11 10 8 Y 128 0 63
|
||||||
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
||||||
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
||||||
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
||||||
@ -5067,8 +5067,8 @@ t5 CREATE TABLE `t5` (
|
|||||||
`param08` longtext,
|
`param08` longtext,
|
||||||
`const09` datetime DEFAULT NULL,
|
`const09` datetime DEFAULT NULL,
|
||||||
`param09` longblob,
|
`param09` longblob,
|
||||||
`const10` double NOT NULL DEFAULT '0',
|
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
|
||||||
`param10` double DEFAULT NULL,
|
`param10` decimal(65,30) DEFAULT NULL,
|
||||||
`const11` int(4) DEFAULT NULL,
|
`const11` int(4) DEFAULT NULL,
|
||||||
`param11` bigint(20) DEFAULT NULL,
|
`param11` bigint(20) DEFAULT NULL,
|
||||||
`const12` binary(0) DEFAULT NULL,
|
`const12` binary(0) DEFAULT NULL,
|
||||||
@ -5097,8 +5097,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
|||||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||||
def test t5 t5 const10 const10 5 49 9 N 32769 31 63
|
def test t5 t5 const10 const10 246 24 16 N 1 6 63
|
||||||
def test t5 t5 param10 param10 5 23 9 Y 32768 31 63
|
def test t5 t5 param10 param10 246 67 40 Y 0 30 63
|
||||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||||
@ -5124,8 +5124,8 @@ const08 1991-08-05 01:01:01
|
|||||||
param08 1991-08-05 01:01:01
|
param08 1991-08-05 01:01:01
|
||||||
const09 1991-08-05 01:01:01
|
const09 1991-08-05 01:01:01
|
||||||
param09 1991-08-05 01:01:01
|
param09 1991-08-05 01:01:01
|
||||||
const10 662680861
|
const10 662680861.000000
|
||||||
param10 662680861
|
param10 662680861.000000000000000000000000000000
|
||||||
const11 1991
|
const11 1991
|
||||||
param11 1991
|
param11 1991
|
||||||
const12 NULL
|
const12 NULL
|
||||||
@ -6489,7 +6489,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -6499,7 +6499,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt1 from "insert into t9
|
prepare stmt1 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -6510,7 +6510,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -6521,7 +6521,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 1.0e+10 ;
|
set @arg00= 1.0e+10 ;
|
||||||
insert into t9
|
insert into t9
|
||||||
@ -6530,7 +6530,7 @@ values
|
|||||||
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -6547,7 +6547,7 @@ values
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -6556,7 +6556,7 @@ values
|
|||||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 'abc' ;
|
set @arg00= 'abc' ;
|
||||||
set @arg00= NULL ;
|
set @arg00= NULL ;
|
||||||
@ -6612,14 +6612,14 @@ c1 c13 c14 c15 c16 c17
|
|||||||
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
|
@ -991,20 +991,17 @@ SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
|
Warning 1292 Incorrect datetime value: '20050327 invalid'
|
||||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 0
|
|
||||||
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
|
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
|
Warning 1292 Incorrect datetime value: '20050328 invalid'
|
||||||
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 0
|
|
||||||
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
|
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
|
Warning 1292 Incorrect datetime value: '20050327 invalid'
|
||||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 0
|
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Qcache_queries_in_cache 0
|
Qcache_queries_in_cache 0
|
||||||
|
@ -1104,13 +1104,10 @@ INSERT INTO t1 VALUES
|
|||||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
|
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
|
||||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
item started price
|
item started price
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00'
|
||||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 0
|
|
||||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
||||||
item started price
|
item started price
|
||||||
A1 2005-11-01 08:00:00 1000.000
|
A1 2005-11-01 08:00:00 1000.000
|
||||||
@ -1122,7 +1119,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||||
item started price
|
item started price
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 0
|
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00'
|
||||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
||||||
item started price
|
item started price
|
||||||
A1 2005-11-01 08:00:00 1000.000
|
A1 2005-11-01 08:00:00 1000.000
|
||||||
@ -1572,7 +1569,7 @@ str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
|
|||||||
str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20'
|
str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
|
SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
|
||||||
str_to_date('2007-20-00', '%Y-%m-%d') <= '';
|
str_to_date('2007-20-00', '%Y-%m-%d') <= '';
|
||||||
str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
|
str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
|
||||||
@ -1585,7 +1582,7 @@ SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
|
|||||||
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
|
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '';
|
SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '';
|
||||||
str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''
|
str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''
|
||||||
NULL
|
NULL
|
||||||
|
@ -2115,8 +2115,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12
|
|||||||
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
||||||
gvid the_success the_fail the_size the_time
|
gvid the_success the_fail the_size the_time
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
|
Warning 1292 Incorrect datetime value: 'wrong-date-value'
|
||||||
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
|
Warning 1292 Incorrect datetime value: 'wrong-date-value'
|
||||||
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
||||||
gvid the_success the_fail the_size the_time
|
gvid the_success the_fail the_size the_time
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
@ -3265,7 +3265,7 @@ f1 f2
|
|||||||
4 2005-10-01
|
4 2005-10-01
|
||||||
5 2005-12-30
|
5 2005-12-30
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
Warning 1292 Truncated incorrect date value: '2005-09-3a'
|
||||||
select * from t1 where f2 <= '2005-09-31' order by f2;
|
select * from t1 where f2 <= '2005-09-31' order by f2;
|
||||||
f1 f2
|
f1 f2
|
||||||
1 2005-01-01
|
1 2005-01-01
|
||||||
@ -3276,7 +3276,7 @@ f1 f2
|
|||||||
1 2005-01-01
|
1 2005-01-01
|
||||||
2 2005-09-01
|
2 2005-09-01
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
Warning 1292 Truncated incorrect date value: '2005-09-3a'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (f1 int, f2 int);
|
create table t1 (f1 int, f2 int);
|
||||||
insert into t1 values (1, 30), (2, 20), (3, 10);
|
insert into t1 values (1, 30), (2, 20), (3, 10);
|
||||||
@ -3753,15 +3753,11 @@ AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
a ts a dt1 dt2
|
a ts a dt1 dt2
|
||||||
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
create table t1 (a bigint unsigned);
|
create table t1 (a bigint unsigned);
|
||||||
insert into t1 values
|
insert into t1 values
|
||||||
@ -4092,28 +4088,28 @@ str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
|
|||||||
and '2007/10/20 00:00:00 GMT'
|
and '2007/10/20 00:00:00 GMT'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6'
|
Warning 1292 Incorrect datetime value: '2007/10/2000:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
|
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007-10-1 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007-10-1 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
|
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
@ -4133,7 +4129,7 @@ select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT
|
|||||||
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '2007-10-01 x12:34:56 GMT-6'
|
Warning 1292 Truncated incorrect date value: '2007-10-01 x12:34:56 GMT-6'
|
||||||
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
|
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
|
||||||
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
|
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
|
||||||
1
|
1
|
||||||
@ -4189,7 +4185,7 @@ select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
|
|||||||
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
|
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
|
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
|
||||||
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
|
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
|
||||||
0
|
0
|
||||||
@ -4203,22 +4199,22 @@ select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '';
|
|||||||
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
|
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('1','%Y-%m-%d') = '1';
|
select str_to_date('1','%Y-%m-%d') = '1';
|
||||||
str_to_date('1','%Y-%m-%d') = '1'
|
str_to_date('1','%Y-%m-%d') = '1'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
select str_to_date('1','%Y-%m-%d') = '1';
|
select str_to_date('1','%Y-%m-%d') = '1';
|
||||||
str_to_date('1','%Y-%m-%d') = '1'
|
str_to_date('1','%Y-%m-%d') = '1'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
select str_to_date('','%Y-%m-%d') = '';
|
select str_to_date('','%Y-%m-%d') = '';
|
||||||
str_to_date('','%Y-%m-%d') = ''
|
str_to_date('','%Y-%m-%d') = ''
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
|
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
|
||||||
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
|
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
|
||||||
1
|
1
|
||||||
|
@ -2122,8 +2122,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12
|
|||||||
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
||||||
gvid the_success the_fail the_size the_time
|
gvid the_success the_fail the_size the_time
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
|
Warning 1292 Incorrect datetime value: 'wrong-date-value'
|
||||||
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
|
Warning 1292 Incorrect datetime value: 'wrong-date-value'
|
||||||
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
||||||
gvid the_success the_fail the_size the_time
|
gvid the_success the_fail the_size the_time
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
@ -3272,7 +3272,7 @@ f1 f2
|
|||||||
4 2005-10-01
|
4 2005-10-01
|
||||||
5 2005-12-30
|
5 2005-12-30
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
Warning 1292 Truncated incorrect date value: '2005-09-3a'
|
||||||
select * from t1 where f2 <= '2005-09-31' order by f2;
|
select * from t1 where f2 <= '2005-09-31' order by f2;
|
||||||
f1 f2
|
f1 f2
|
||||||
1 2005-01-01
|
1 2005-01-01
|
||||||
@ -3283,7 +3283,7 @@ f1 f2
|
|||||||
1 2005-01-01
|
1 2005-01-01
|
||||||
2 2005-09-01
|
2 2005-09-01
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
Warning 1292 Truncated incorrect date value: '2005-09-3a'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (f1 int, f2 int);
|
create table t1 (f1 int, f2 int);
|
||||||
insert into t1 values (1, 30), (2, 20), (3, 10);
|
insert into t1 values (1, 30), (2, 20), (3, 10);
|
||||||
@ -3760,15 +3760,11 @@ AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
a ts a dt1 dt2
|
a ts a dt1 dt2
|
||||||
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
create table t1 (a bigint unsigned);
|
create table t1 (a bigint unsigned);
|
||||||
insert into t1 values
|
insert into t1 values
|
||||||
@ -4099,28 +4095,28 @@ str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
|
|||||||
and '2007/10/20 00:00:00 GMT'
|
and '2007/10/20 00:00:00 GMT'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6'
|
Warning 1292 Incorrect datetime value: '2007/10/2000:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
|
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007-10-1 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007-10-1 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
|
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
@ -4140,7 +4136,7 @@ select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT
|
|||||||
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '2007-10-01 x12:34:56 GMT-6'
|
Warning 1292 Truncated incorrect date value: '2007-10-01 x12:34:56 GMT-6'
|
||||||
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
|
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
|
||||||
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
|
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
|
||||||
1
|
1
|
||||||
@ -4196,7 +4192,7 @@ select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
|
|||||||
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
|
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
|
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
|
||||||
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
|
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
|
||||||
0
|
0
|
||||||
@ -4210,22 +4206,22 @@ select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '';
|
|||||||
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
|
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('1','%Y-%m-%d') = '1';
|
select str_to_date('1','%Y-%m-%d') = '1';
|
||||||
str_to_date('1','%Y-%m-%d') = '1'
|
str_to_date('1','%Y-%m-%d') = '1'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
select str_to_date('1','%Y-%m-%d') = '1';
|
select str_to_date('1','%Y-%m-%d') = '1';
|
||||||
str_to_date('1','%Y-%m-%d') = '1'
|
str_to_date('1','%Y-%m-%d') = '1'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
select str_to_date('','%Y-%m-%d') = '';
|
select str_to_date('','%Y-%m-%d') = '';
|
||||||
str_to_date('','%Y-%m-%d') = ''
|
str_to_date('','%Y-%m-%d') = ''
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
|
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
|
||||||
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
|
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
|
||||||
1
|
1
|
||||||
|
@ -2115,8 +2115,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12
|
|||||||
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
||||||
gvid the_success the_fail the_size the_time
|
gvid the_success the_fail the_size the_time
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
|
Warning 1292 Incorrect datetime value: 'wrong-date-value'
|
||||||
Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
|
Warning 1292 Incorrect datetime value: 'wrong-date-value'
|
||||||
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
|
||||||
gvid the_success the_fail the_size the_time
|
gvid the_success the_fail the_size the_time
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
@ -3265,7 +3265,7 @@ f1 f2
|
|||||||
4 2005-10-01
|
4 2005-10-01
|
||||||
5 2005-12-30
|
5 2005-12-30
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
Warning 1292 Truncated incorrect date value: '2005-09-3a'
|
||||||
select * from t1 where f2 <= '2005-09-31' order by f2;
|
select * from t1 where f2 <= '2005-09-31' order by f2;
|
||||||
f1 f2
|
f1 f2
|
||||||
1 2005-01-01
|
1 2005-01-01
|
||||||
@ -3276,7 +3276,7 @@ f1 f2
|
|||||||
1 2005-01-01
|
1 2005-01-01
|
||||||
2 2005-09-01
|
2 2005-09-01
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
Warning 1292 Truncated incorrect date value: '2005-09-3a'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (f1 int, f2 int);
|
create table t1 (f1 int, f2 int);
|
||||||
insert into t1 values (1, 30), (2, 20), (3, 10);
|
insert into t1 values (1, 30), (2, 20), (3, 10);
|
||||||
@ -3753,15 +3753,11 @@ AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||||
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
1 SIMPLE t1 range ts ts 4 NULL 1 Using index condition; Using where; Rowid-ordered scan
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
|
||||||
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
|
||||||
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
|
||||||
a ts a dt1 dt2
|
a ts a dt1 dt2
|
||||||
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
create table t1 (a bigint unsigned);
|
create table t1 (a bigint unsigned);
|
||||||
insert into t1 values
|
insert into t1 values
|
||||||
@ -4092,28 +4088,28 @@ str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
|
|||||||
and '2007/10/20 00:00:00 GMT'
|
and '2007/10/20 00:00:00 GMT'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/01 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/20 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
|
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
|
||||||
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
|
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007/10/2000:00:00 GMT-6'
|
Warning 1292 Incorrect datetime value: '2007/10/2000:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
|
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2007-10-1 00:00:00 GMT-6'
|
Warning 1292 Truncated incorrect datetime value: '2007-10-1 00:00:00 GMT-6'
|
||||||
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
|
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
|
||||||
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
|
||||||
1
|
1
|
||||||
@ -4133,7 +4129,7 @@ select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT
|
|||||||
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
|
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '2007-10-01 x12:34:56 GMT-6'
|
Warning 1292 Truncated incorrect date value: '2007-10-01 x12:34:56 GMT-6'
|
||||||
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
|
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
|
||||||
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
|
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
|
||||||
1
|
1
|
||||||
@ -4189,7 +4185,7 @@ select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
|
|||||||
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
|
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
|
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
|
||||||
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
|
str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'
|
||||||
0
|
0
|
||||||
@ -4203,22 +4199,22 @@ select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '';
|
|||||||
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
|
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('1','%Y-%m-%d') = '1';
|
select str_to_date('1','%Y-%m-%d') = '1';
|
||||||
str_to_date('1','%Y-%m-%d') = '1'
|
str_to_date('1','%Y-%m-%d') = '1'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
select str_to_date('1','%Y-%m-%d') = '1';
|
select str_to_date('1','%Y-%m-%d') = '1';
|
||||||
str_to_date('1','%Y-%m-%d') = '1'
|
str_to_date('1','%Y-%m-%d') = '1'
|
||||||
0
|
0
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '1'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
select str_to_date('','%Y-%m-%d') = '';
|
select str_to_date('','%Y-%m-%d') = '';
|
||||||
str_to_date('','%Y-%m-%d') = ''
|
str_to_date('','%Y-%m-%d') = ''
|
||||||
1
|
1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: ''
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
|
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
|
||||||
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
|
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
|
||||||
1
|
1
|
||||||
|
@ -7,7 +7,7 @@ select @a:=FROM_UNIXTIME(1);
|
|||||||
1970-01-01 01:00:01
|
1970-01-01 01:00:01
|
||||||
select unix_timestamp(@a);
|
select unix_timestamp(@a);
|
||||||
unix_timestamp(@a)
|
unix_timestamp(@a)
|
||||||
1
|
1.000000
|
||||||
CREATE TABLE t1 (ts int);
|
CREATE TABLE t1 (ts int);
|
||||||
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
|
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
|
||||||
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
|
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
|
||||||
@ -44,7 +44,7 @@ unix_timestamp('1970-01-01 01:00:01'),
|
|||||||
unix_timestamp('2038-01-19 04:14:07'),
|
unix_timestamp('2038-01-19 04:14:07'),
|
||||||
unix_timestamp('2038-01-19 04:14:08');
|
unix_timestamp('2038-01-19 04:14:08');
|
||||||
unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-19 04:14:07') unix_timestamp('2038-01-19 04:14:08')
|
unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-19 04:14:07') unix_timestamp('2038-01-19 04:14:08')
|
||||||
0 1 2147483647 NULL
|
0.000000 1.000000 2147483647.000000 NULL
|
||||||
select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59');
|
select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59');
|
||||||
unix_timestamp('1969-12-31 23:59:59') unix_timestamp('1970-01-01 00:00:00') unix_timestamp('1970-01-01 00:59:59')
|
unix_timestamp('1969-12-31 23:59:59') unix_timestamp('1970-01-01 00:00:00') unix_timestamp('1970-01-01 00:59:59')
|
||||||
NULL NULL NULL
|
NULL NULL NULL
|
||||||
|
@ -119,6 +119,7 @@ insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
|
|||||||
('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
|
('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'ts' at row 2
|
Warning 1264 Out of range value for column 'ts' at row 2
|
||||||
|
Warning 1264 Out of range value for column 'ts' at row 3
|
||||||
Warning 1264 Out of range value for column 'ts' at row 6
|
Warning 1264 Out of range value for column 'ts' at row 6
|
||||||
select * from t1;
|
select * from t1;
|
||||||
ts
|
ts
|
||||||
@ -135,6 +136,7 @@ insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
|
|||||||
('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
|
('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'ts' at row 2
|
Warning 1264 Out of range value for column 'ts' at row 2
|
||||||
|
Warning 1264 Out of range value for column 'ts' at row 3
|
||||||
Warning 1264 Out of range value for column 'ts' at row 6
|
Warning 1264 Out of range value for column 'ts' at row 6
|
||||||
select * from t1;
|
select * from t1;
|
||||||
ts
|
ts
|
||||||
@ -151,6 +153,7 @@ insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
|
|||||||
('2038-01-19 04:44:07'),('2038-01-19 04:44:08');
|
('2038-01-19 04:44:07'),('2038-01-19 04:44:08');
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'ts' at row 2
|
Warning 1264 Out of range value for column 'ts' at row 2
|
||||||
|
Warning 1264 Out of range value for column 'ts' at row 3
|
||||||
Warning 1264 Out of range value for column 'ts' at row 6
|
Warning 1264 Out of range value for column 'ts' at row 6
|
||||||
select * from t1;
|
select * from t1;
|
||||||
ts
|
ts
|
||||||
|
@ -3,4 +3,4 @@ from_unixtime(0)
|
|||||||
1969-12-31 14:00:00
|
1969-12-31 14:00:00
|
||||||
select unix_timestamp('1969-12-31 14:00:01');
|
select unix_timestamp('1969-12-31 14:00:01');
|
||||||
unix_timestamp('1969-12-31 14:00:01')
|
unix_timestamp('1969-12-31 14:00:01')
|
||||||
1
|
1.000000
|
||||||
|
@ -185,14 +185,14 @@ DROP TABLE t1;
|
|||||||
SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6));
|
||||||
CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6))
|
CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6))
|
||||||
20060810.000000
|
20060810.000000
|
||||||
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6));
|
||||||
CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6))
|
CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6))
|
||||||
20060810101112.000000
|
20060810101112.000000
|
||||||
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
|
||||||
CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6))
|
CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6))
|
||||||
20060810101112.000014
|
20060810101112.000014
|
||||||
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
|
SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6));
|
||||||
CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6))
|
CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6))
|
||||||
101112.098700
|
101112.098700
|
||||||
set @org_mode=@@sql_mode;
|
set @org_mode=@@sql_mode;
|
||||||
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
||||||
@ -361,7 +361,7 @@ greatest(cast('01-01-01' as date), '01-01-02') + 0
|
|||||||
20010102
|
20010102
|
||||||
select least(cast('01-01-01' as datetime), '01-01-02') + 0;
|
select least(cast('01-01-01' as datetime), '01-01-02') + 0;
|
||||||
least(cast('01-01-01' as datetime), '01-01-02') + 0
|
least(cast('01-01-01' as datetime), '01-01-02') + 0
|
||||||
20010101000000
|
20010101000000.000000
|
||||||
select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
|
select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
|
||||||
cast(least(cast('01-01-01' as datetime), '01-01-02') as signed)
|
cast(least(cast('01-01-01' as datetime), '01-01-02') as signed)
|
||||||
20010101000000
|
20010101000000
|
||||||
@ -399,7 +399,7 @@ if(@bug28261 = f1, '', @bug28261:= f1)
|
|||||||
2001-01-01
|
2001-01-01
|
||||||
2002-02-02
|
2002-02-02
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect date value: '' for column 'f1' at row 1
|
Warning 1292 Incorrect datetime value: ''
|
||||||
select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
|
select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
|
||||||
if(@bug28261 = f1, '', @bug28261:= f1)
|
if(@bug28261 = f1, '', @bug28261:= f1)
|
||||||
2001-01-01
|
2001-01-01
|
||||||
@ -423,11 +423,11 @@ f1
|
|||||||
2001-01-01 00:00:00
|
2001-01-01 00:00:00
|
||||||
2002-02-02 00:00:00
|
2002-02-02 00:00:00
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '2002010' for column 'f1' at row 0
|
Warning 1292 Incorrect datetime value: '2002010'
|
||||||
select * from t1 where f1 between 20020101 and 2007010100000;
|
select * from t1 where f1 between 20020101 and 2007010100000;
|
||||||
f1
|
f1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 0
|
Warning 1292 Incorrect datetime value: '2007010100000'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
# Bug#27216: functions with parameters of different date types may
|
# Bug#27216: functions with parameters of different date types may
|
||||||
@ -495,10 +495,10 @@ insert into t1 set f1 = '45:44:44';
|
|||||||
insert into t1 set f1 = '15:44:44';
|
insert into t1 set f1 = '15:44:44';
|
||||||
select * from t1 where (convert(f1,datetime)) != 1;
|
select * from t1 where (convert(f1,datetime)) != 1;
|
||||||
f1
|
f1
|
||||||
|
45:44:44
|
||||||
15:44:44
|
15:44:44
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '45:44:44'
|
Warning 1292 Incorrect datetime value: '1'
|
||||||
Warning 1292 Truncated incorrect datetime value: '1'
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a tinyint);
|
create table t1 (a tinyint);
|
||||||
insert into t1 values (), (), ();
|
insert into t1 values (), (), ();
|
||||||
@ -618,21 +618,21 @@ ERROR 42000: Invalid default value for 'da'
|
|||||||
create table t1 (t time default '916:00:00 a');
|
create table t1 (t time default '916:00:00 a');
|
||||||
ERROR 42000: Invalid default value for 't'
|
ERROR 42000: Invalid default value for 't'
|
||||||
set @@sql_mode= @org_mode;
|
set @@sql_mode= @org_mode;
|
||||||
SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME) AS DECIMAL(30,7));
|
SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
|
||||||
CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME) AS DECIMAL(30,7))
|
CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7))
|
||||||
20060810101112.0123450
|
20060810101112.0123450
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '2006-08-10 10:11:12.0123450'
|
Warning 1292 Truncated incorrect datetime value: '2006-08-10 10:11:12.0123450'
|
||||||
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME) AS DECIMAL(30,7));
|
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
|
||||||
CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME) AS DECIMAL(30,7))
|
CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7))
|
||||||
20060810101112.0123450
|
20060810101112.0123450
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '00000002006-000008-0000010 000010:0000011:00000012.0123450'
|
Warning 1292 Truncated incorrect datetime value: '00000002006-000008-0000010 000010:0000011:00000012.0123450'
|
||||||
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME) AS DECIMAL(30,7));
|
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7));
|
||||||
CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME) AS DECIMAL(30,7))
|
CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7))
|
||||||
20060810101112.0123450
|
20060810101112.0123450
|
||||||
SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
|
SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7));
|
||||||
CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7))
|
CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7))
|
||||||
20080729104251.1234560
|
20080729104251.1234560
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567'
|
Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567'
|
||||||
|
@ -115,7 +115,106 @@ Table Create Table
|
|||||||
t3 CREATE TABLE `t3` (
|
t3 CREATE TABLE `t3` (
|
||||||
`a` datetime(4) DEFAULT NULL
|
`a` datetime(4) DEFAULT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
|
drop table t2, t3;
|
||||||
|
insert t1 values ('2010-12-13 14:15:16.222222');
|
||||||
|
select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
a a+0 a-1 a*1 a/2
|
||||||
|
2012-12-11 01:02:13.3332 20121211010213.3332 20121211010212.3332 20121211010213.3332 10060605505106.66660000
|
||||||
|
2010-12-13 14:15:16.2222 20101213141516.2222 20101213141515.2222 20101213141516.2222 10050606570758.11110000
|
||||||
|
select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
max(a) min(a) sum(a) avg(a)
|
||||||
|
2012-12-11 01:02:13.3332 2010-12-13 14:15:16.2222 40222424151729.5554 20111212075864.77770000
|
||||||
|
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`a` datetime(4) DEFAULT NULL,
|
||||||
|
`a+0` decimal(25,4) DEFAULT NULL,
|
||||||
|
`a-1` decimal(25,4) DEFAULT NULL,
|
||||||
|
`a*1` decimal(25,4) DEFAULT NULL,
|
||||||
|
`a/2` decimal(28,8) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
show create table t3;
|
||||||
|
Table Create Table
|
||||||
|
t3 CREATE TABLE `t3` (
|
||||||
|
`max(a)` datetime(4) DEFAULT NULL,
|
||||||
|
`min(a)` datetime(4) DEFAULT NULL,
|
||||||
|
`sum(a)` decimal(46,4) DEFAULT NULL,
|
||||||
|
`avg(a)` decimal(28,8) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
|
create table t1 (f0_datetime datetime(0), f1_datetime datetime(1), f2_datetime datetime(2), f3_datetime datetime(3), f4_datetime datetime(4), f5_datetime datetime(5), f6_datetime datetime(6));
|
||||||
|
insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
||||||
|
select * from t1;
|
||||||
|
f0_datetime 2010-11-12 11:14:17
|
||||||
|
f1_datetime 2010-11-12 11:14:17.7
|
||||||
|
f2_datetime 2010-11-12 11:14:17.76
|
||||||
|
f3_datetime 2010-11-12 11:14:17.765
|
||||||
|
f4_datetime 2010-11-12 11:14:17.7654
|
||||||
|
f5_datetime 2010-11-12 11:14:17.76543
|
||||||
|
f6_datetime 2010-11-12 11:14:17.765432
|
||||||
|
select cast(f0_datetime as time(4)) time4_f0_datetime, cast(f1_datetime as datetime(3)) datetime3_f1_datetime, cast(f2_datetime as date) date_f2_datetime, cast(f4_datetime as double) double_f3_datetime, cast(f4_datetime as decimal(40,5)) decimal5_f4_datetime, cast(f5_datetime as signed) bigint_f5_datetime, cast(f6_datetime as char(255)) varchar_f6_datetime from t1;
|
||||||
|
time4_f0_datetime 11:14:17.0000
|
||||||
|
datetime3_f1_datetime 2010-11-12 11:14:17.700
|
||||||
|
date_f2_datetime 2010-11-12
|
||||||
|
double_f3_datetime 20101112111417.8
|
||||||
|
decimal5_f4_datetime 20101112111417.76540
|
||||||
|
bigint_f5_datetime 20101112111417
|
||||||
|
varchar_f6_datetime 2010-11-12 11:14:17.765432
|
||||||
|
create table t2 (time4_f0_datetime time(4), datetime3_f1_datetime datetime(3), date_f2_datetime date, double_f3_datetime double, decimal5_f4_datetime decimal(40,5), bigint_f5_datetime bigint, varchar_f6_datetime varchar(255));
|
||||||
|
insert t2 select * from t1;
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'time4_f0_datetime' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'date_f2_datetime' at row 1
|
||||||
|
select * from t2;
|
||||||
|
time4_f0_datetime 11:14:17.0000
|
||||||
|
datetime3_f1_datetime 2010-11-12 11:14:17.700
|
||||||
|
date_f2_datetime 2010-11-12
|
||||||
|
double_f3_datetime 20101112111417.8
|
||||||
|
decimal5_f4_datetime 20101112111417.76540
|
||||||
|
bigint_f5_datetime 20101112111417
|
||||||
|
varchar_f6_datetime 2010-11-12 11:14:17.765432
|
||||||
|
alter table t1 change f0_datetime time4_f0_datetime time(4), change f1_datetime datetime3_f1_datetime datetime(3), change f2_datetime date_f2_datetime date, change f3_datetime double_f3_datetime double, change f4_datetime decimal5_f4_datetime decimal(40,5), change f5_datetime bigint_f5_datetime bigint, change f6_datetime varchar_f6_datetime varchar(255);
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'time4_f0_datetime' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'date_f2_datetime' at row 1
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_datetime 11:14:17.0000
|
||||||
|
datetime3_f1_datetime 2010-11-12 11:14:17.700
|
||||||
|
date_f2_datetime 2010-11-12
|
||||||
|
double_f3_datetime 20101112111417.8
|
||||||
|
decimal5_f4_datetime 20101112111417.76540
|
||||||
|
bigint_f5_datetime 20101112111417
|
||||||
|
varchar_f6_datetime 2010-11-12 11:14:17.765432
|
||||||
|
alter table t1 modify time4_f0_datetime datetime(0), modify datetime3_f1_datetime datetime(1), modify date_f2_datetime datetime(2), modify double_f3_datetime datetime(3), modify decimal5_f4_datetime datetime(4), modify bigint_f5_datetime datetime(5), modify varchar_f6_datetime datetime(6);
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_datetime 0000-00-00 11:14:17
|
||||||
|
datetime3_f1_datetime 2010-11-12 11:14:17.7
|
||||||
|
date_f2_datetime 2010-11-12 00:00:00.00
|
||||||
|
double_f3_datetime 2010-11-12 11:14:17.800
|
||||||
|
decimal5_f4_datetime 2010-11-12 11:14:17.7654
|
||||||
|
bigint_f5_datetime 2010-11-12 11:14:17.00000
|
||||||
|
varchar_f6_datetime 2010-11-12 11:14:17.765432
|
||||||
|
delete from t1;
|
||||||
|
insert t1 select * from t2;
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_datetime 0000-00-00 11:14:17
|
||||||
|
datetime3_f1_datetime 2010-11-12 11:14:17.7
|
||||||
|
date_f2_datetime 2010-11-12 00:00:00.00
|
||||||
|
double_f3_datetime 2010-11-12 11:14:17.765
|
||||||
|
decimal5_f4_datetime 2010-11-12 11:14:17.7654
|
||||||
|
bigint_f5_datetime 2010-11-12 11:14:17.00000
|
||||||
|
varchar_f6_datetime 2010-11-12 11:14:17.765432
|
||||||
|
drop table t1, t2;
|
||||||
create table t1 (a datetime(6), b datetime(6));
|
create table t1 (a datetime(6), b datetime(6));
|
||||||
create procedure foo(x datetime, y datetime(4)) insert into t1 values (x, y);
|
create procedure foo(x datetime, y datetime(4)) insert into t1 values (x, y);
|
||||||
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
||||||
@ -228,132 +327,6 @@ t2 p01 RANGE extract(microsecond from taken) 123000 3
|
|||||||
t2 p02 RANGE extract(microsecond from taken) 500000 4
|
t2 p02 RANGE extract(microsecond from taken) 500000 4
|
||||||
t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3
|
t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
create table t1 (
|
|
||||||
q_date date,
|
|
||||||
q_time time,
|
|
||||||
q_time5 time(5),
|
|
||||||
q_datetime datetime,
|
|
||||||
q_datetime1 datetime(1),
|
|
||||||
q_datetime3 datetime(3),
|
|
||||||
q_datetime5 datetime(5),
|
|
||||||
q_timestamp timestamp,
|
|
||||||
q_timestamp2 timestamp(2),
|
|
||||||
q_timestamp4 timestamp(4),
|
|
||||||
q_timestamp6 timestamp(6),
|
|
||||||
q_varchar50 varchar(50),
|
|
||||||
q_varchar60 varchar(60),
|
|
||||||
q_varchar70 varchar(70),
|
|
||||||
q_varchar80 varchar(80));
|
|
||||||
create table t2 (
|
|
||||||
date_datetime datetime,
|
|
||||||
time_datetime datetime,
|
|
||||||
time5_varchar100 varchar(100),
|
|
||||||
datetime_time time,
|
|
||||||
datetime1_date date,
|
|
||||||
datetime3_timestamp timestamp,
|
|
||||||
datetime5_varchar100 varchar(100),
|
|
||||||
timestamp_datetime datetime,
|
|
||||||
timestamp2_date date,
|
|
||||||
timestamp4_time time,
|
|
||||||
timestamp6_varchar100 varchar(100),
|
|
||||||
varchar50_date date,
|
|
||||||
varchar60_datetime datetime,
|
|
||||||
varchar70_time time,
|
|
||||||
varchar80_timestamp timestamp);
|
|
||||||
insert t1 values ('2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
|
||||||
Warnings:
|
|
||||||
Note 1265 Data truncated for column 'q_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'q_time' at row 1
|
|
||||||
Note 1265 Data truncated for column 'q_time5' at row 1
|
|
||||||
select * from t1;;
|
|
||||||
q_date 2010-11-12
|
|
||||||
q_time 11:14:17
|
|
||||||
q_time5 11:14:17.76543
|
|
||||||
q_datetime 2010-11-12 11:14:17
|
|
||||||
q_datetime1 2010-11-12 11:14:17.7
|
|
||||||
q_datetime3 2010-11-12 11:14:17.765
|
|
||||||
q_datetime5 2010-11-12 11:14:17.76543
|
|
||||||
q_timestamp 2010-11-12 11:14:17
|
|
||||||
q_timestamp2 2010-11-12 11:14:17.76
|
|
||||||
q_timestamp4 2010-11-12 11:14:17.7654
|
|
||||||
q_timestamp6 2010-11-12 11:14:17.765432
|
|
||||||
q_varchar50 2010-11-12 11:14:17.765432
|
|
||||||
q_varchar60 2010-11-12 11:14:17.765432
|
|
||||||
q_varchar70 2010-11-12 11:14:17.765432
|
|
||||||
q_varchar80 2010-11-12 11:14:17.765432
|
|
||||||
insert t2 select * from t1;
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'time_datetime' at row 1
|
|
||||||
Note 1265 Data truncated for column 'datetime_time' at row 1
|
|
||||||
Note 1265 Data truncated for column 'datetime1_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'timestamp2_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'timestamp4_time' at row 1
|
|
||||||
Note 1265 Data truncated for column 'varchar50_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'varchar70_time' at row 1
|
|
||||||
select * from t2;;
|
|
||||||
date_datetime 2010-11-12 00:00:00
|
|
||||||
time_datetime 0000-00-00 00:00:00
|
|
||||||
time5_varchar100 11:14:17.76543
|
|
||||||
datetime_time 11:14:17
|
|
||||||
datetime1_date 2010-11-12
|
|
||||||
datetime3_timestamp 2010-11-12 11:14:17
|
|
||||||
datetime5_varchar100 2010-11-12 11:14:17.76543
|
|
||||||
timestamp_datetime 2010-11-12 11:14:17
|
|
||||||
timestamp2_date 2010-11-12
|
|
||||||
timestamp4_time 11:14:17
|
|
||||||
timestamp6_varchar100 2010-11-12 11:14:17.765432
|
|
||||||
varchar50_date 2010-11-12
|
|
||||||
varchar60_datetime 2010-11-12 11:14:17
|
|
||||||
varchar70_time 11:14:17
|
|
||||||
varchar80_timestamp 2010-11-12 11:14:17
|
|
||||||
alter table t1
|
|
||||||
change q_date date_datetime datetime,
|
|
||||||
change q_time time_datetime datetime,
|
|
||||||
change q_time5 time5_varchar100 varchar(100),
|
|
||||||
change q_datetime datetime_time time,
|
|
||||||
change q_datetime1 datetime1_date date,
|
|
||||||
change q_datetime3 datetime3_timestamp timestamp,
|
|
||||||
change q_datetime5 datetime5_varchar100 varchar(100),
|
|
||||||
change q_timestamp timestamp_datetime datetime,
|
|
||||||
change q_timestamp2 timestamp2_date date,
|
|
||||||
change q_timestamp4 timestamp4_time time,
|
|
||||||
change q_timestamp6 timestamp6_varchar100 varchar(100),
|
|
||||||
change q_varchar50 varchar50_date date,
|
|
||||||
change q_varchar60 varchar60_datetime datetime,
|
|
||||||
change q_varchar70 varchar70_time time,
|
|
||||||
change q_varchar80 varchar80_timestamp timestamp;
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'time_datetime' at row 1
|
|
||||||
Note 1265 Data truncated for column 'datetime_time' at row 1
|
|
||||||
Note 1265 Data truncated for column 'datetime1_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'timestamp2_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'timestamp4_time' at row 1
|
|
||||||
Note 1265 Data truncated for column 'varchar50_date' at row 1
|
|
||||||
Note 1265 Data truncated for column 'varchar70_time' at row 1
|
|
||||||
select * from t1;;
|
|
||||||
date_datetime 2010-11-12 00:00:00
|
|
||||||
time_datetime 0000-00-00 00:00:00
|
|
||||||
time5_varchar100 11:14:17.76543
|
|
||||||
datetime_time 11:14:17
|
|
||||||
datetime1_date 2010-11-12
|
|
||||||
datetime3_timestamp 2010-11-12 11:14:17
|
|
||||||
datetime5_varchar100 2010-11-12 11:14:17.76543
|
|
||||||
timestamp_datetime 2010-11-12 11:14:17
|
|
||||||
timestamp2_date 2010-11-12
|
|
||||||
timestamp4_time 11:14:17
|
|
||||||
timestamp6_varchar100 2010-11-12 11:14:17.765432
|
|
||||||
varchar50_date 2010-11-12
|
|
||||||
varchar60_datetime 2010-11-12 11:14:17
|
|
||||||
varchar70_time 11:14:17
|
|
||||||
varchar80_timestamp 2010-11-12 11:14:17
|
|
||||||
drop table t1, t2;
|
|
||||||
create table t1 (a datetime, b datetime(6));
|
create table t1 (a datetime, b datetime(6));
|
||||||
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
|
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
|
||||||
update t1 set b=a;
|
update t1 set b=a;
|
||||||
|
@ -29,8 +29,8 @@ insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:2
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 't' at row 1
|
Warning 1265 Data truncated for column 't' at row 1
|
||||||
Warning 1265 Data truncated for column 't' at row 2
|
Warning 1265 Data truncated for column 't' at row 2
|
||||||
Warning 1264 Out of range value for column 't' at row 3
|
Warning 1265 Data truncated for column 't' at row 3
|
||||||
Warning 1264 Out of range value for column 't' at row 4
|
Warning 1265 Data truncated for column 't' at row 4
|
||||||
Warning 1265 Data truncated for column 't' at row 6
|
Warning 1265 Data truncated for column 't' at row 6
|
||||||
select * from t1;
|
select * from t1;
|
||||||
t
|
t
|
||||||
@ -55,8 +55,8 @@ t
|
|||||||
36:30:31
|
36:30:31
|
||||||
00:00:10
|
00:00:10
|
||||||
00:00:00
|
00:00:00
|
||||||
838:59:59
|
00:00:00
|
||||||
838:59:59
|
00:00:00
|
||||||
262:22:00
|
262:22:00
|
||||||
00:00:12
|
00:00:12
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -10,52 +10,52 @@ Warnings:
|
|||||||
Note 1265 Data truncated for column 'a' at row 1
|
Note 1265 Data truncated for column 'a' at row 1
|
||||||
insert t1 values (20101211010203.45678);
|
insert t1 values (20101211010203.45678);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1265 Data truncated for column 'a' at row 1
|
||||||
insert t1 values (20101211030405.789e0);
|
insert t1 values (20101211030405.789e0);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1265 Data truncated for column 'a' at row 1
|
||||||
insert t1 values (99991231235959e1);
|
insert t1 values (99991231235959e1);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1265 Data truncated for column 'a' at row 1
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
|
00:00:00.000
|
||||||
00:20:03.123
|
00:20:03.123
|
||||||
|
01:02:03.456
|
||||||
|
03:04:05.789
|
||||||
15:47:11.123
|
15:47:11.123
|
||||||
838:59:59.999
|
|
||||||
838:59:59.999
|
|
||||||
838:59:59.999
|
|
||||||
select truncate(a, 6) from t1;
|
select truncate(a, 6) from t1;
|
||||||
truncate(a, 6)
|
truncate(a, 6)
|
||||||
|
0.000000
|
||||||
2003.123000
|
2003.123000
|
||||||
|
10203.456000
|
||||||
|
30405.789062
|
||||||
154711.123000
|
154711.123000
|
||||||
8385959.999000
|
|
||||||
8385959.999000
|
|
||||||
8385959.999000
|
|
||||||
select a DIV 1 from t1;
|
select a DIV 1 from t1;
|
||||||
a DIV 1
|
a DIV 1
|
||||||
|
0
|
||||||
2003
|
2003
|
||||||
|
10203
|
||||||
|
30405
|
||||||
154711
|
154711
|
||||||
8385959
|
|
||||||
8385959
|
|
||||||
8385959
|
|
||||||
select group_concat(distinct a) from t1;
|
select group_concat(distinct a) from t1;
|
||||||
group_concat(distinct a)
|
group_concat(distinct a)
|
||||||
00:20:03.123,15:47:11.123,838:59:59.999
|
00:00:00.000,00:20:03.123,01:02:03.456,03:04:05.789,15:47:11.123
|
||||||
alter table t1 engine=innodb;
|
alter table t1 engine=innodb;
|
||||||
select * from t1 order by a;
|
select * from t1 order by a;
|
||||||
a
|
a
|
||||||
|
00:00:00.000
|
||||||
00:20:03.123
|
00:20:03.123
|
||||||
|
01:02:03.456
|
||||||
|
03:04:05.789
|
||||||
15:47:11.123
|
15:47:11.123
|
||||||
838:59:59.999
|
|
||||||
838:59:59.999
|
|
||||||
838:59:59.999
|
|
||||||
select * from t1 order by a+0;
|
select * from t1 order by a+0;
|
||||||
a
|
a
|
||||||
|
00:00:00.000
|
||||||
00:20:03.123
|
00:20:03.123
|
||||||
|
01:02:03.456
|
||||||
|
03:04:05.789
|
||||||
15:47:11.123
|
15:47:11.123
|
||||||
838:59:59.999
|
|
||||||
838:59:59.999
|
|
||||||
838:59:59.999
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a time(4)) engine=innodb;
|
create table t1 (a time(4)) engine=innodb;
|
||||||
insert t1 values ('2010-12-11 01:02:03.456789');
|
insert t1 values ('2010-12-11 01:02:03.456789');
|
||||||
@ -101,17 +101,21 @@ a
|
|||||||
01:02:13.3332
|
01:02:13.3332
|
||||||
select a, a + interval 2 year from t1;
|
select a, a + interval 2 year from t1;
|
||||||
a a + interval 2 year
|
a a + interval 2 year
|
||||||
01:02:13.3332 0002-00-00 01:02:13.3332
|
01:02:13.3332 NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1441 Datetime function: time field overflow
|
||||||
insert t1 select a + interval 2 year from t1;
|
insert t1 select a + interval 2 year from t1;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'a' at row 1
|
Warning 1441 Datetime function: time field overflow
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
01:02:13.3332
|
01:02:13.3332
|
||||||
00:00:00.0000
|
NULL
|
||||||
delete from t1 where a < 20110101;
|
delete from t1 where a < 20110101;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
|
01:02:13.3332
|
||||||
|
NULL
|
||||||
create table t2 select * from t1;
|
create table t2 select * from t1;
|
||||||
create table t3 like t1;
|
create table t3 like t1;
|
||||||
show create table t2;
|
show create table t2;
|
||||||
@ -124,7 +128,125 @@ Table Create Table
|
|||||||
t3 CREATE TABLE `t3` (
|
t3 CREATE TABLE `t3` (
|
||||||
`a` time(4) DEFAULT NULL
|
`a` time(4) DEFAULT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
|
drop table t2, t3;
|
||||||
|
insert t1 values ('2010-12-13 14:15:16.222222');
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'a' at row 1
|
||||||
|
select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
a a+0 a-1 a*1 a/2
|
||||||
|
01:02:13.3332 10213.3332 10212.3332 10213.3332 5106.66660000
|
||||||
|
NULL NULL NULL NULL NULL
|
||||||
|
14:15:16.2222 141516.2222 141515.2222 141516.2222 70758.11110000
|
||||||
|
select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
max(a) min(a) sum(a) avg(a)
|
||||||
|
14:15:16.2222 01:02:13.3332 151729.5554 75864.77770000
|
||||||
|
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`a` time(4) DEFAULT NULL,
|
||||||
|
`a+0` decimal(16,4) DEFAULT NULL,
|
||||||
|
`a-1` decimal(16,4) DEFAULT NULL,
|
||||||
|
`a*1` decimal(16,4) DEFAULT NULL,
|
||||||
|
`a/2` decimal(19,8) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
show create table t3;
|
||||||
|
Table Create Table
|
||||||
|
t3 CREATE TABLE `t3` (
|
||||||
|
`max(a)` time(4) DEFAULT NULL,
|
||||||
|
`min(a)` time(4) DEFAULT NULL,
|
||||||
|
`sum(a)` decimal(37,4) DEFAULT NULL,
|
||||||
|
`avg(a)` decimal(19,8) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
|
create table t1 (f0_time time(0), f1_time time(1), f2_time time(2), f3_time time(3), f4_time time(4), f5_time time(5), f6_time time(6));
|
||||||
|
insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f0_time' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f1_time' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f2_time' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f3_time' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f4_time' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f5_time' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'f6_time' at row 1
|
||||||
|
select * from t1;
|
||||||
|
f0_time 11:14:17
|
||||||
|
f1_time 11:14:17.7
|
||||||
|
f2_time 11:14:17.76
|
||||||
|
f3_time 11:14:17.765
|
||||||
|
f4_time 11:14:17.7654
|
||||||
|
f5_time 11:14:17.76543
|
||||||
|
f6_time 11:14:17.765432
|
||||||
|
select cast(f0_time as time(4)) time4_f0_time, cast(f1_time as datetime(3)) datetime3_f1_time, cast(f2_time as date) date_f2_time, cast(f4_time as double) double_f3_time, cast(f4_time as decimal(40,5)) decimal5_f4_time, cast(f5_time as signed) bigint_f5_time, cast(f6_time as char(255)) varchar_f6_time from t1;
|
||||||
|
time4_f0_time 11:14:17.0000
|
||||||
|
datetime3_f1_time 0000-00-00 11:14:17.700
|
||||||
|
date_f2_time 0000-00-00
|
||||||
|
double_f3_time 111417.7654
|
||||||
|
decimal5_f4_time 111417.76540
|
||||||
|
bigint_f5_time 111417
|
||||||
|
varchar_f6_time 11:14:17.765432
|
||||||
|
create table t2 (time4_f0_time time(4), datetime3_f1_time datetime(3), date_f2_time date, double_f3_time double, decimal5_f4_time decimal(40,5), bigint_f5_time bigint, varchar_f6_time varchar(255));
|
||||||
|
insert t2 select * from t1;
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'date_f2_time' at row 1
|
||||||
|
select * from t2;
|
||||||
|
time4_f0_time 11:14:17.0000
|
||||||
|
datetime3_f1_time 0000-00-00 11:14:17.700
|
||||||
|
date_f2_time 0000-00-00
|
||||||
|
double_f3_time 111417.765
|
||||||
|
decimal5_f4_time 111417.76540
|
||||||
|
bigint_f5_time 111417
|
||||||
|
varchar_f6_time 11:14:17.765432
|
||||||
|
alter table t1 change f0_time time4_f0_time time(4), change f1_time datetime3_f1_time datetime(3), change f2_time date_f2_time date, change f3_time double_f3_time double, change f4_time decimal5_f4_time decimal(40,5), change f5_time bigint_f5_time bigint, change f6_time varchar_f6_time varchar(255);
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'date_f2_time' at row 1
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_time 11:14:17.0000
|
||||||
|
datetime3_f1_time 0000-00-00 11:14:17.700
|
||||||
|
date_f2_time 0000-00-00
|
||||||
|
double_f3_time 111417.765
|
||||||
|
decimal5_f4_time 111417.76540
|
||||||
|
bigint_f5_time 111417
|
||||||
|
varchar_f6_time 11:14:17.765432
|
||||||
|
alter table t1 modify time4_f0_time time(0), modify datetime3_f1_time time(1), modify date_f2_time time(2), modify double_f3_time time(3), modify decimal5_f4_time time(4), modify bigint_f5_time time(5), modify varchar_f6_time time(6);
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_time 11:14:17
|
||||||
|
datetime3_f1_time 11:14:17.7
|
||||||
|
date_f2_time 00:00:00.00
|
||||||
|
double_f3_time 11:14:17.765
|
||||||
|
decimal5_f4_time 11:14:17.7654
|
||||||
|
bigint_f5_time 11:14:17.00000
|
||||||
|
varchar_f6_time 11:14:17.765432
|
||||||
|
delete from t1;
|
||||||
|
insert t1 select * from t2;
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_time 11:14:17
|
||||||
|
datetime3_f1_time 11:14:17.7
|
||||||
|
date_f2_time 00:00:00.00
|
||||||
|
double_f3_time 11:14:17.764
|
||||||
|
decimal5_f4_time 11:14:17.7654
|
||||||
|
bigint_f5_time 11:14:17.00000
|
||||||
|
varchar_f6_time 11:14:17.765432
|
||||||
|
drop table t1, t2;
|
||||||
create table t1 (a time(6), b time(6));
|
create table t1 (a time(6), b time(6));
|
||||||
create procedure foo(x time, y time(4)) insert into t1 values (x, y);
|
create procedure foo(x time, y time(4)) insert into t1 values (x, y);
|
||||||
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
||||||
@ -179,18 +301,37 @@ a b
|
|||||||
04:05:06.000000 04:05:06.789100
|
04:05:06.000000 04:05:06.789100
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
create table t1 (a time(4) not null);
|
create table t1 (a time(4) not null, key(a));
|
||||||
insert into t1 values ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
|
insert into t1 values ('1:2:3.001'),('1:2:3'), ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
|
||||||
select * from t1;
|
select * from t1 order by a;
|
||||||
a
|
a
|
||||||
|
-00:00:01.1000
|
||||||
|
-00:00:01.1000
|
||||||
|
-00:00:01.0900
|
||||||
|
-00:00:01.0000
|
||||||
|
-00:00:01.0000
|
||||||
|
-00:00:01.0000
|
||||||
|
-00:00:00.9000
|
||||||
|
-00:00:00.8000
|
||||||
|
-00:00:00.7000
|
||||||
|
-00:00:00.6000
|
||||||
|
01:02:03.0000
|
||||||
|
01:02:03.0010
|
||||||
|
select * from t1 order by a desc;
|
||||||
|
a
|
||||||
|
01:02:03.0010
|
||||||
|
01:02:03.0000
|
||||||
-00:00:00.6000
|
-00:00:00.6000
|
||||||
-00:00:00.7000
|
-00:00:00.7000
|
||||||
-00:00:00.8000
|
-00:00:00.8000
|
||||||
-00:00:00.9000
|
-00:00:00.9000
|
||||||
-00:00:01.0000
|
-00:00:01.0000
|
||||||
-00:00:01.1000
|
|
||||||
-00:00:01.0000
|
-00:00:01.0000
|
||||||
-00:00:01.1000
|
|
||||||
-00:00:01.0000
|
-00:00:01.0000
|
||||||
-00:00:01.0900
|
-00:00:01.0900
|
||||||
|
-00:00:01.1000
|
||||||
|
-00:00:01.1000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
select cast(1e-6 as time(6));
|
||||||
|
cast(1e-6 as time(6))
|
||||||
|
00:00:00.000001
|
||||||
|
@ -115,7 +115,114 @@ Table Create Table
|
|||||||
t3 CREATE TABLE `t3` (
|
t3 CREATE TABLE `t3` (
|
||||||
`a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
`a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
|
drop table t2, t3;
|
||||||
|
insert t1 values ('2010-12-13 14:15:16.222222');
|
||||||
|
select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
a a+0 a-1 a*1 a/2
|
||||||
|
2012-12-11 01:02:13.3332 20121211010213.3332 20121211010212.3332 20121211010213.3332 10060605505106.66660000
|
||||||
|
2010-12-13 14:15:16.2222 20101213141516.2222 20101213141515.2222 20101213141516.2222 10050606570758.11110000
|
||||||
|
select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
max(a) min(a) sum(a) avg(a)
|
||||||
|
2012-12-11 01:02:13.3332 2010-12-13 14:15:16.2222 40222424151729.5554 20111212075864.77770000
|
||||||
|
create table t2 select a, a+0, a-1, a*1, a/2 from t1;
|
||||||
|
create table t3 select max(a), min(a), sum(a), avg(a) from t1;
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`a` timestamp(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000',
|
||||||
|
`a+0` decimal(25,4) NOT NULL DEFAULT '0.0000',
|
||||||
|
`a-1` decimal(25,4) NOT NULL DEFAULT '0.0000',
|
||||||
|
`a*1` decimal(25,4) NOT NULL DEFAULT '0.0000',
|
||||||
|
`a/2` decimal(28,8) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
show create table t3;
|
||||||
|
Table Create Table
|
||||||
|
t3 CREATE TABLE `t3` (
|
||||||
|
`max(a)` timestamp(4) NULL DEFAULT NULL,
|
||||||
|
`min(a)` timestamp(4) NULL DEFAULT NULL,
|
||||||
|
`sum(a)` decimal(46,4) DEFAULT NULL,
|
||||||
|
`avg(a)` decimal(28,8) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
|
create table t1 (f0_timestamp timestamp(0), f1_timestamp timestamp(1), f2_timestamp timestamp(2), f3_timestamp timestamp(3), f4_timestamp timestamp(4), f5_timestamp timestamp(5), f6_timestamp timestamp(6));
|
||||||
|
insert t1 values ( '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
||||||
|
select * from t1;
|
||||||
|
f0_timestamp 2010-11-12 11:14:17
|
||||||
|
f1_timestamp 2010-11-12 11:14:17.7
|
||||||
|
f2_timestamp 2010-11-12 11:14:17.76
|
||||||
|
f3_timestamp 2010-11-12 11:14:17.765
|
||||||
|
f4_timestamp 2010-11-12 11:14:17.7654
|
||||||
|
f5_timestamp 2010-11-12 11:14:17.76543
|
||||||
|
f6_timestamp 2010-11-12 11:14:17.765432
|
||||||
|
select cast(f0_timestamp as time(4)) time4_f0_timestamp, cast(f1_timestamp as datetime(3)) datetime3_f1_timestamp, cast(f2_timestamp as date) date_f2_timestamp, cast(f4_timestamp as double) double_f3_timestamp, cast(f4_timestamp as decimal(40,5)) decimal5_f4_timestamp, cast(f5_timestamp as signed) bigint_f5_timestamp, cast(f6_timestamp as char(255)) varchar_f6_timestamp from t1;
|
||||||
|
time4_f0_timestamp 11:14:17.0000
|
||||||
|
datetime3_f1_timestamp 2010-11-12 11:14:17.700
|
||||||
|
date_f2_timestamp 2010-11-12
|
||||||
|
double_f3_timestamp 20101112111417.8
|
||||||
|
decimal5_f4_timestamp 20101112111417.76540
|
||||||
|
bigint_f5_timestamp 20101112111417
|
||||||
|
varchar_f6_timestamp 2010-11-12 11:14:17.765432
|
||||||
|
create table t2 (time4_f0_timestamp time(4), datetime3_f1_timestamp datetime(3), date_f2_timestamp date, double_f3_timestamp double, decimal5_f4_timestamp decimal(40,5), bigint_f5_timestamp bigint, varchar_f6_timestamp varchar(255));
|
||||||
|
insert t2 select * from t1;
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'time4_f0_timestamp' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'date_f2_timestamp' at row 1
|
||||||
|
select * from t2;
|
||||||
|
time4_f0_timestamp 11:14:17.0000
|
||||||
|
datetime3_f1_timestamp 2010-11-12 11:14:17.700
|
||||||
|
date_f2_timestamp 2010-11-12
|
||||||
|
double_f3_timestamp 20101112111417.8
|
||||||
|
decimal5_f4_timestamp 20101112111417.76540
|
||||||
|
bigint_f5_timestamp 20101112111417
|
||||||
|
varchar_f6_timestamp 2010-11-12 11:14:17.765432
|
||||||
|
alter table t1 change f0_timestamp time4_f0_timestamp time(4), change f1_timestamp datetime3_f1_timestamp datetime(3), change f2_timestamp date_f2_timestamp date, change f3_timestamp double_f3_timestamp double, change f4_timestamp decimal5_f4_timestamp decimal(40,5), change f5_timestamp bigint_f5_timestamp bigint, change f6_timestamp varchar_f6_timestamp varchar(255);
|
||||||
|
Warnings:
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'time4_f0_timestamp' at row 1
|
||||||
|
Level Note
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'date_f2_timestamp' at row 1
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_timestamp 11:14:17.0000
|
||||||
|
datetime3_f1_timestamp 2010-11-12 11:14:17.700
|
||||||
|
date_f2_timestamp 2010-11-12
|
||||||
|
double_f3_timestamp 20101112111417.8
|
||||||
|
decimal5_f4_timestamp 20101112111417.76540
|
||||||
|
bigint_f5_timestamp 20101112111417
|
||||||
|
varchar_f6_timestamp 2010-11-12 11:14:17.765432
|
||||||
|
alter table t1 modify time4_f0_timestamp timestamp(0), modify datetime3_f1_timestamp timestamp(1), modify date_f2_timestamp timestamp(2), modify double_f3_timestamp timestamp(3), modify decimal5_f4_timestamp timestamp(4), modify bigint_f5_timestamp timestamp(5), modify varchar_f6_timestamp timestamp(6);
|
||||||
|
Warnings:
|
||||||
|
Level Warning
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'time4_f0_timestamp' at row 1
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_timestamp 0000-00-00 00:00:00
|
||||||
|
datetime3_f1_timestamp 2010-11-12 11:14:17.7
|
||||||
|
date_f2_timestamp 2010-11-12 00:00:00.00
|
||||||
|
double_f3_timestamp 2010-11-12 11:14:17.800
|
||||||
|
decimal5_f4_timestamp 2010-11-12 11:14:17.7654
|
||||||
|
bigint_f5_timestamp 2010-11-12 11:14:17.00000
|
||||||
|
varchar_f6_timestamp 2010-11-12 11:14:17.765432
|
||||||
|
delete from t1;
|
||||||
|
insert t1 select * from t2;
|
||||||
|
Warnings:
|
||||||
|
Level Warning
|
||||||
|
Code 1265
|
||||||
|
Message Data truncated for column 'time4_f0_timestamp' at row 1
|
||||||
|
select * from t1;
|
||||||
|
time4_f0_timestamp 0000-00-00 00:00:00
|
||||||
|
datetime3_f1_timestamp 2010-11-12 11:14:17.7
|
||||||
|
date_f2_timestamp 2010-11-12 00:00:00.00
|
||||||
|
double_f3_timestamp 2010-11-12 11:14:17.765
|
||||||
|
decimal5_f4_timestamp 2010-11-12 11:14:17.7654
|
||||||
|
bigint_f5_timestamp 2010-11-12 11:14:17.00000
|
||||||
|
varchar_f6_timestamp 2010-11-12 11:14:17.765432
|
||||||
|
drop table t1, t2;
|
||||||
create table t1 (a timestamp(6), b timestamp(6));
|
create table t1 (a timestamp(6), b timestamp(6));
|
||||||
create procedure foo(x timestamp, y timestamp(4)) insert into t1 values (x, y);
|
create procedure foo(x timestamp, y timestamp(4)) insert into t1 values (x, y);
|
||||||
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
||||||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
||||||
ERROR HY000: Can't create table 'test.table_54044' (errno: -1)
|
|
||||||
|
@ -2535,7 +2535,7 @@ INSERT INTO t1 VALUES (0);
|
|||||||
SET SQL_MODE='STRICT_ALL_TABLES';
|
SET SQL_MODE='STRICT_ALL_TABLES';
|
||||||
CREATE TABLE t2
|
CREATE TABLE t2
|
||||||
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
|
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
|
||||||
ERROR 22007: Truncated incorrect datetime value: ''
|
ERROR 22007: Incorrect datetime value: ''
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET SQL_MODE=DEFAULT;
|
SET SQL_MODE=DEFAULT;
|
||||||
#
|
#
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type
|
|
||||||
# during create table, so it will not trigger assertion failure.
|
|
||||||
|
|
||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
# This 'create table' operation should fail because of
|
|
||||||
# using NULL datatype
|
|
||||||
--error ER_CANT_CREATE_TABLE
|
|
||||||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
||||||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
||||||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
||||||
ERROR HY000: Can't create table 'test.table_54044' (errno: -1)
|
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
# This is the test for bug #54044. Special handle MYSQL_TYPE_NULL type
|
|
||||||
# during create table, so it will not trigger assertion failure.
|
|
||||||
|
|
||||||
--source include/have_innodb_plugin.inc
|
--source include/have_innodb_plugin.inc
|
||||||
|
|
||||||
# This 'create table' operation should fail because of
|
|
||||||
# using NULL datatype
|
|
||||||
--error ER_CANT_CREATE_TABLE
|
|
||||||
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
CREATE TEMPORARY TABLE table_54044 ENGINE = INNODB
|
||||||
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
AS SELECT IF(NULL IS NOT NULL, NULL, NULL);
|
||||||
|
@ -64,7 +64,7 @@ def test t9 t9 c12 c12 246 10 6 Y 0 4 63
|
|||||||
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
|
||||||
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
|
||||||
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
def test t9 t9 c15 c15 7 19 19 N 9377 0 63
|
||||||
def test t9 t9 c16 c16 11 9 8 Y 128 0 63
|
def test t9 t9 c16 c16 11 10 8 Y 128 0 63
|
||||||
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
|
||||||
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
|
||||||
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
|
||||||
@ -1793,8 +1793,8 @@ t5 CREATE TABLE `t5` (
|
|||||||
`param08` longtext,
|
`param08` longtext,
|
||||||
`const09` datetime DEFAULT NULL,
|
`const09` datetime DEFAULT NULL,
|
||||||
`param09` longblob,
|
`param09` longblob,
|
||||||
`const10` double NOT NULL DEFAULT '0',
|
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
|
||||||
`param10` double DEFAULT NULL,
|
`param10` decimal(65,30) DEFAULT NULL,
|
||||||
`const11` int(4) DEFAULT NULL,
|
`const11` int(4) DEFAULT NULL,
|
||||||
`param11` bigint(20) DEFAULT NULL,
|
`param11` bigint(20) DEFAULT NULL,
|
||||||
`const12` binary(0) DEFAULT NULL,
|
`const12` binary(0) DEFAULT NULL,
|
||||||
@ -1823,8 +1823,8 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
|||||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||||
def test t5 t5 const10 const10 5 49 9 N 32769 31 63
|
def test t5 t5 const10 const10 246 24 16 N 1 6 63
|
||||||
def test t5 t5 param10 param10 5 23 9 Y 32768 31 63
|
def test t5 t5 param10 param10 246 67 40 Y 0 30 63
|
||||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||||
@ -1850,8 +1850,8 @@ const08 1991-08-05 01:01:01
|
|||||||
param08 1991-08-05 01:01:01
|
param08 1991-08-05 01:01:01
|
||||||
const09 1991-08-05 01:01:01
|
const09 1991-08-05 01:01:01
|
||||||
param09 1991-08-05 01:01:01
|
param09 1991-08-05 01:01:01
|
||||||
const10 662680861
|
const10 662680861.000000
|
||||||
param10 662680861
|
param10 662680861.000000000000000000000000000000
|
||||||
const11 1991
|
const11 1991
|
||||||
param11 1991
|
param11 1991
|
||||||
const12 NULL
|
const12 NULL
|
||||||
@ -3215,7 +3215,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3225,7 +3225,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt1 from "insert into t9
|
prepare stmt1 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3236,7 +3236,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3247,7 +3247,7 @@ Warnings:
|
|||||||
Warning 1265 Data truncated for column 'c13' at row 1
|
Warning 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c14' at row 1
|
Warning 1265 Data truncated 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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 1.0e+10 ;
|
set @arg00= 1.0e+10 ;
|
||||||
insert into t9
|
insert into t9
|
||||||
@ -3256,7 +3256,7 @@ values
|
|||||||
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
insert into t9
|
insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3273,7 +3273,7 @@ values
|
|||||||
execute stmt1 ;
|
execute stmt1 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
prepare stmt2 from "insert into t9
|
prepare stmt2 from "insert into t9
|
||||||
( c1, c13, c14, c15, c16, c17 )
|
( c1, c13, c14, c15, c16, c17 )
|
||||||
@ -3282,7 +3282,7 @@ values
|
|||||||
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||||
Warnings:
|
Warnings:
|
||||||
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 for column 'c16' at row 1
|
Warning 1265 Data truncated for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
set @arg00= 'abc' ;
|
set @arg00= 'abc' ;
|
||||||
set @arg00= NULL ;
|
set @arg00= NULL ;
|
||||||
@ -3338,14 +3338,14 @@ c1 c13 c14 c15 c16 c17
|
|||||||
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
|
||||||
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 0000
|
||||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||||
|
@ -43,15 +43,9 @@ SELECT * FROM t1 WHERE c1 BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER B
|
|||||||
c1 c2 c3 c4
|
c1 c2 c3 c4
|
||||||
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
||||||
2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
|
2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2010-00-01 00:00:00' for column 'c1' at row 1
|
|
||||||
Warning 1292 Incorrect datetime value: '2010-00-01 00:00:00' for column 'c1' at row 1
|
|
||||||
SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2;
|
SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2;
|
||||||
c1 c2 c3 c4
|
c1 c2 c3 c4
|
||||||
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
||||||
2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
|
2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
|
||||||
Warnings:
|
|
||||||
Warning 1292 Incorrect datetime value: '2010-10-00 00:00:00' for column 'c2' at row 1
|
|
||||||
Warning 1292 Incorrect datetime value: '2010-10-00 00:00:00' for column 'c2' at row 1
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
set time_zone= @save_time_zone;
|
set time_zone= @save_time_zone;
|
||||||
|
@ -136,7 +136,7 @@ create table t3 select 1 union select UUID();
|
|||||||
create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
|
create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
|
||||||
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
|
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '3'
|
Warning 1292 Incorrect datetime value: '3'
|
||||||
insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
|
insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
|
||||||
create procedure foo()
|
create procedure foo()
|
||||||
begin
|
begin
|
||||||
|
@ -110,6 +110,7 @@ select column_get(column_create(1, "-1212" AS char), 1 as int);
|
|||||||
select column_get(column_create(1, "2011-04-05" AS date), 1 as int);
|
select column_get(column_create(1, "2011-04-05" AS date), 1 as int);
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int);
|
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int);
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int);
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
|
||||||
select column_get(column_create(1, NULL AS int), 1 as int);
|
select column_get(column_create(1, NULL AS int), 1 as int);
|
||||||
--echo #column gett truncation & warnings
|
--echo #column gett truncation & warnings
|
||||||
@ -145,6 +146,7 @@ select column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8
|
|||||||
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8);
|
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8);
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8);
|
select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8);
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8);
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8);
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8);
|
||||||
@ -169,6 +171,7 @@ select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1
|
|||||||
select column_get(column_create(1, "2011-04-05" AS date), 1 as double);
|
select column_get(column_create(1, "2011-04-05" AS date), 1 as double);
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double);
|
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double);
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double);
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double);
|
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double);
|
||||||
# The replace result is needed for windows.
|
# The replace result is needed for windows.
|
||||||
@ -197,6 +200,7 @@ select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1
|
|||||||
select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6));
|
select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6));
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6));
|
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6));
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
|
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6));
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
|
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6));
|
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6));
|
||||||
select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8));
|
select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8));
|
||||||
@ -245,6 +249,7 @@ select column_get(column_create(1, 0), 1 as datetime);
|
|||||||
select column_get(column_create(1, "2001021"), 1 as datetime);
|
select column_get(column_create(1, "2001021"), 1 as datetime);
|
||||||
|
|
||||||
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
|
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
|
||||||
|
select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime);
|
||||||
|
|
||||||
set @@sql_mode="allow_invalid_dates";
|
set @@sql_mode="allow_invalid_dates";
|
||||||
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
|
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
|
||||||
@ -318,7 +323,9 @@ select column_get(column_create(1, "0" AS CHAR), 1 as date);
|
|||||||
select column_get(column_create(1, 20010203101112.121314 as double), 1 as time);
|
select column_get(column_create(1, 20010203101112.121314 as double), 1 as time);
|
||||||
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time);
|
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time);
|
||||||
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
|
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
|
||||||
|
select column_get(column_create(1, 8080102 as unsigned int), 1 as time);
|
||||||
select column_get(column_create(1, 20010203101112 as int), 1 as time);
|
select column_get(column_create(1, 20010203101112 as int), 1 as time);
|
||||||
|
select column_get(column_create(1, -8080102 as int), 1 as time);
|
||||||
select column_get(column_create(1, "20010203101112" as char), 1 as time);
|
select column_get(column_create(1, "20010203101112" as char), 1 as time);
|
||||||
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time);
|
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time);
|
||||||
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time);
|
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time);
|
||||||
|
@ -1063,7 +1063,8 @@ insert into t1 values
|
|||||||
(02,2002,20020101,"2002-01-01 23:59:59"),
|
(02,2002,20020101,"2002-01-01 23:59:59"),
|
||||||
(60,2060,20600101,"2060-01-01 11:11:11"),
|
(60,2060,20600101,"2060-01-01 11:11:11"),
|
||||||
(70,1970,19700101,"1970-11-11 22:22:22"),
|
(70,1970,19700101,"1970-11-11 22:22:22"),
|
||||||
(NULL,NULL,NULL,NULL);
|
(NULL,NULL,NULL,NULL),
|
||||||
|
(71,1971,19710101,"1971-11-11 22:22:22");
|
||||||
select min(f1),max(f1) from t1;
|
select min(f1),max(f1) from t1;
|
||||||
select min(f2),max(f2) from t1;
|
select min(f2),max(f2) from t1;
|
||||||
select min(f3),max(f3) from t1;
|
select min(f3),max(f3) from t1;
|
||||||
|
@ -91,8 +91,8 @@ select microsecond("1997-12-31 23:59:59.000001");
|
|||||||
|
|
||||||
create table t1
|
create table t1
|
||||||
select makedate(1997,1) as f1,
|
select makedate(1997,1) as f1,
|
||||||
addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
|
addtime(cast("1997-12-31 23:59:59.000001" as datetime(6)), "1 1:1:1.000002") as f2,
|
||||||
addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
|
addtime(cast("23:59:59.999999" as time(6)) , "1 1:1:1.000002") as f3,
|
||||||
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
|
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
|
||||||
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
|
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
|
||||||
maketime(10,11,12) as f6,
|
maketime(10,11,12) as f6,
|
||||||
|
@ -17,6 +17,9 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
|
|||||||
sec_to_time(time_to_sec("0:30:47")/6.21);
|
sec_to_time(time_to_sec("0:30:47")/6.21);
|
||||||
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
|
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
|
||||||
select sec_to_time(time_to_sec('-838:59:59'));
|
select sec_to_time(time_to_sec('-838:59:59'));
|
||||||
|
select sec_to_time('9001.1'), sec_to_time('1234567890123.123');
|
||||||
|
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
|
||||||
|
select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
|
||||||
select now()-curdate()*1000000-curtime();
|
select now()-curdate()*1000000-curtime();
|
||||||
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
|
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
|
||||||
select strcmp(localtime(),concat(current_date()," ",current_time()));
|
select strcmp(localtime(),concat(current_date()," ",current_time()));
|
||||||
@ -68,10 +71,10 @@ select date_format('1999-12-31','%x-%v'),date_format('2000-01-01','%x-%v');
|
|||||||
|
|
||||||
select dayname("1962-03-03"),dayname("1962-03-03")+0;
|
select dayname("1962-03-03"),dayname("1962-03-03")+0;
|
||||||
select monthname("1972-03-04"),monthname("1972-03-04")+0;
|
select monthname("1972-03-04"),monthname("1972-03-04")+0;
|
||||||
select time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
select time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
select time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
select time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
|
||||||
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
||||||
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
|
||||||
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
|
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
|
||||||
@ -948,6 +951,9 @@ select time(' 1 02:03:04') - interval 2 day;
|
|||||||
select time('-1 02:03:04') + interval 2 day;
|
select time('-1 02:03:04') + interval 2 day;
|
||||||
select time('-1 02:03:04') - interval 2 day;
|
select time('-1 02:03:04') - interval 2 day;
|
||||||
|
|
||||||
|
select time('10 02:03:04') + interval 30 day;
|
||||||
|
select time('10 02:03:04') + interval 1 year;
|
||||||
|
|
||||||
# specially constructed queries to reach obscure places in the code
|
# specially constructed queries to reach obscure places in the code
|
||||||
# not touched by the more "normal" queries (and to increase the coverage)
|
# not touched by the more "normal" queries (and to increase the coverage)
|
||||||
select cast('131415.123e0' as time);
|
select cast('131415.123e0' as time);
|
||||||
|
@ -36,7 +36,7 @@ drop table t1;
|
|||||||
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
|
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
|
||||||
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
|
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
|
||||||
select 20010101000203.000000004 + interval 1 day;
|
select 20010101000203.000000004 + interval 1 day;
|
||||||
select 20010101000203.00004 + interval 1 day;
|
select 20010101000203.4 + interval 1 day;
|
||||||
#
|
#
|
||||||
# precision of expressions
|
# precision of expressions
|
||||||
#
|
#
|
||||||
@ -68,6 +68,8 @@ create table t1 select CAST(@a AS DATETIME) as dauto,
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
--query_vertical select * from t1
|
--query_vertical select * from t1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
explain extended select cast(cast(@a as datetime(4)) as time(0));
|
||||||
|
select cast(cast(@a as time(2)) as time(6));
|
||||||
|
|
||||||
--error ER_TOO_BIG_PRECISION
|
--error ER_TOO_BIG_PRECISION
|
||||||
select CAST(@a AS DATETIME(7));
|
select CAST(@a AS DATETIME(7));
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
drop table if exists t1_30237_bool;
|
drop table if exists t1_30237_bool;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
set sql_mode=NO_UNSIGNED_SUBTRACTION;
|
||||||
|
|
||||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||||
|
|
||||||
insert into t1_30237_bool values
|
insert into t1_30237_bool values
|
||||||
|
@ -137,9 +137,9 @@ DROP TABLE t1;
|
|||||||
# Bug 19491 (CAST DATE AS DECIMAL returns incorrect result
|
# Bug 19491 (CAST DATE AS DECIMAL returns incorrect result
|
||||||
#
|
#
|
||||||
SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6));
|
||||||
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6));
|
||||||
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
|
||||||
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
|
SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6));
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -432,18 +432,18 @@ set @@sql_mode= @org_mode;
|
|||||||
# Bug #42146 - DATETIME fractional seconds parse error
|
# Bug #42146 - DATETIME fractional seconds parse error
|
||||||
#
|
#
|
||||||
# show we trucate microseconds from the right -- special case: leftmost is 0
|
# show we trucate microseconds from the right -- special case: leftmost is 0
|
||||||
SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME) AS DECIMAL(30,7));
|
SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
|
||||||
|
|
||||||
# show that we ignore leading zeroes for all other fields
|
# show that we ignore leading zeroes for all other fields
|
||||||
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME) AS DECIMAL(30,7));
|
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
|
||||||
# once more with feeling (but no warnings)
|
# once more with feeling (but no warnings)
|
||||||
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME) AS DECIMAL(30,7));
|
SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7));
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE
|
# Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE
|
||||||
#
|
#
|
||||||
# show we truncate microseconds from the right
|
# show we truncate microseconds from the right
|
||||||
SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
|
SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7));
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
|
--echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
|
||||||
|
@ -61,74 +61,6 @@ select table_name,partition_name,partition_method,partition_expression,partition
|
|||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
#
|
|
||||||
# insert ... select with conversion
|
|
||||||
#
|
|
||||||
create table t1 (
|
|
||||||
q_date date,
|
|
||||||
q_time time,
|
|
||||||
q_time5 time(5),
|
|
||||||
q_datetime datetime,
|
|
||||||
q_datetime1 datetime(1),
|
|
||||||
q_datetime3 datetime(3),
|
|
||||||
q_datetime5 datetime(5),
|
|
||||||
q_timestamp timestamp,
|
|
||||||
q_timestamp2 timestamp(2),
|
|
||||||
q_timestamp4 timestamp(4),
|
|
||||||
q_timestamp6 timestamp(6),
|
|
||||||
q_varchar50 varchar(50),
|
|
||||||
q_varchar60 varchar(60),
|
|
||||||
q_varchar70 varchar(70),
|
|
||||||
q_varchar80 varchar(80));
|
|
||||||
|
|
||||||
create table t2 (
|
|
||||||
date_datetime datetime,
|
|
||||||
time_datetime datetime,
|
|
||||||
time5_varchar100 varchar(100),
|
|
||||||
datetime_time time,
|
|
||||||
datetime1_date date,
|
|
||||||
datetime3_timestamp timestamp,
|
|
||||||
datetime5_varchar100 varchar(100),
|
|
||||||
timestamp_datetime datetime,
|
|
||||||
timestamp2_date date,
|
|
||||||
timestamp4_time time,
|
|
||||||
timestamp6_varchar100 varchar(100),
|
|
||||||
varchar50_date date,
|
|
||||||
varchar60_datetime datetime,
|
|
||||||
varchar70_time time,
|
|
||||||
varchar80_timestamp timestamp);
|
|
||||||
|
|
||||||
insert t1 values ('2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432',
|
|
||||||
'2010-11-12 11:14:17.765432', '2010-11-12 11:14:17.765432');
|
|
||||||
--query_vertical select * from t1;
|
|
||||||
insert t2 select * from t1;
|
|
||||||
--query_vertical select * from t2;
|
|
||||||
alter table t1
|
|
||||||
change q_date date_datetime datetime,
|
|
||||||
change q_time time_datetime datetime,
|
|
||||||
change q_time5 time5_varchar100 varchar(100),
|
|
||||||
change q_datetime datetime_time time,
|
|
||||||
change q_datetime1 datetime1_date date,
|
|
||||||
change q_datetime3 datetime3_timestamp timestamp,
|
|
||||||
change q_datetime5 datetime5_varchar100 varchar(100),
|
|
||||||
change q_timestamp timestamp_datetime datetime,
|
|
||||||
change q_timestamp2 timestamp2_date date,
|
|
||||||
change q_timestamp4 timestamp4_time time,
|
|
||||||
change q_timestamp6 timestamp6_varchar100 varchar(100),
|
|
||||||
change q_varchar50 varchar50_date date,
|
|
||||||
change q_varchar60 varchar60_datetime datetime,
|
|
||||||
change q_varchar70 varchar70_time time,
|
|
||||||
change q_varchar80 varchar80_timestamp timestamp;
|
|
||||||
--query_vertical select * from t1;
|
|
||||||
|
|
||||||
drop table t1, t2;
|
|
||||||
|
|
||||||
create table t1 (a datetime, b datetime(6));
|
create table t1 (a datetime, b datetime(6));
|
||||||
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
|
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
|
||||||
update t1 set b=a;
|
update t1 set b=a;
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
let type=time;
|
let type=time;
|
||||||
--source include/type_hrtime.inc
|
--source include/type_hrtime.inc
|
||||||
|
|
||||||
create table t1 (a time(4) not null);
|
create table t1 (a time(4) not null, key(a));
|
||||||
insert into t1 values ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
|
insert into t1 values ('1:2:3.001'),('1:2:3'), ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
|
||||||
select * from t1;
|
select * from t1 order by a;
|
||||||
|
select * from t1 order by a desc;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
select cast(1e-6 as time(6));
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
/* Windows version of localtime_r() is declared in my_ptrhead.h */
|
/* Windows version of localtime_r() is declared in my_ptrhead.h */
|
||||||
#include <my_pthread.h>
|
#include <my_pthread.h>
|
||||||
|
#include <mysqld_error.h>
|
||||||
|
|
||||||
ulonglong log_10_int[20]=
|
ulonglong log_10_int[20]=
|
||||||
{
|
{
|
||||||
@ -732,7 +733,7 @@ void my_init_time(void)
|
|||||||
time_t seconds;
|
time_t seconds;
|
||||||
struct tm *l_time,tm_tmp;
|
struct tm *l_time,tm_tmp;
|
||||||
MYSQL_TIME my_time;
|
MYSQL_TIME my_time;
|
||||||
my_bool not_used;
|
uint not_used;
|
||||||
|
|
||||||
seconds= (time_t) time((time_t*) 0);
|
seconds= (time_t) time((time_t*) 0);
|
||||||
localtime_r(&seconds,&tm_tmp);
|
localtime_r(&seconds,&tm_tmp);
|
||||||
@ -818,7 +819,11 @@ long calc_daynr(uint year,uint month,uint day)
|
|||||||
t - time value to be converted
|
t - time value to be converted
|
||||||
my_timezone - pointer to long where offset of system time zone
|
my_timezone - pointer to long where offset of system time zone
|
||||||
from UTC will be stored for caching
|
from UTC will be stored for caching
|
||||||
in_dst_time_gap - set to true if time falls into spring time-gap
|
error_code - 0, if the conversion was successful;
|
||||||
|
ER_WARN_DATA_OUT_OF_RANGE, if t contains datetime value
|
||||||
|
which is out of TIMESTAMP range;
|
||||||
|
ER_WARN_INVALID_TIMESTAMP, if t represents value which
|
||||||
|
doesn't exists (falls into the spring time-gap).
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
The idea is to cache the time zone offset from UTC (including daylight
|
The idea is to cache the time zone offset from UTC (including daylight
|
||||||
@ -832,8 +837,7 @@ long calc_daynr(uint year,uint month,uint day)
|
|||||||
Time in UTC seconds since Unix Epoch representation.
|
Time in UTC seconds since Unix Epoch representation.
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone,
|
my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone, uint *error_code)
|
||||||
my_bool *in_dst_time_gap)
|
|
||||||
{
|
{
|
||||||
uint loop;
|
uint loop;
|
||||||
time_t tmp= 0;
|
time_t tmp= 0;
|
||||||
@ -843,8 +847,6 @@ my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone,
|
|||||||
struct tm *l_time,tm_tmp;
|
struct tm *l_time,tm_tmp;
|
||||||
long diff, current_timezone;
|
long diff, current_timezone;
|
||||||
|
|
||||||
*in_dst_time_gap= 0; /* Reset */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use temp variable to avoid trashing input data, which could happen in
|
Use temp variable to avoid trashing input data, which could happen in
|
||||||
case of shift required for boundary dates processing.
|
case of shift required for boundary dates processing.
|
||||||
@ -853,9 +855,10 @@ my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone,
|
|||||||
|
|
||||||
if (!validate_timestamp_range(t))
|
if (!validate_timestamp_range(t))
|
||||||
{
|
{
|
||||||
*in_dst_time_gap= 1;
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*error_code= 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculate the gmt time based on current time and timezone
|
Calculate the gmt time based on current time and timezone
|
||||||
@ -1001,7 +1004,7 @@ my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone,
|
|||||||
else if (diff == -3600)
|
else if (diff == -3600)
|
||||||
tmp-=t->minute*60 + t->second; /* Move to previous hour */
|
tmp-=t->minute*60 + t->second; /* Move to previous hour */
|
||||||
|
|
||||||
*in_dst_time_gap= 1;
|
*error_code= ER_WARN_INVALID_TIMESTAMP;
|
||||||
}
|
}
|
||||||
*my_timezone= current_timezone;
|
*my_timezone= current_timezone;
|
||||||
|
|
||||||
@ -1022,7 +1025,7 @@ my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone,
|
|||||||
if (!IS_TIME_T_VALID_FOR_TIMESTAMP(tmp))
|
if (!IS_TIME_T_VALID_FOR_TIMESTAMP(tmp))
|
||||||
{
|
{
|
||||||
tmp= 0;
|
tmp= 0;
|
||||||
*in_dst_time_gap= 1;
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (my_time_t) tmp;
|
return (my_time_t) tmp;
|
||||||
@ -1150,7 +1153,7 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to, uint digits)
|
|||||||
Datetime value in YYYYMMDDHHMMSS format.
|
Datetime value in YYYYMMDDHHMMSS format.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
|
||||||
uint flags, int *was_cut)
|
uint flags, int *was_cut)
|
||||||
{
|
{
|
||||||
long part1,part2;
|
long part1,part2;
|
||||||
@ -1158,7 +1161,7 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
|||||||
*was_cut= 0;
|
*was_cut= 0;
|
||||||
time_res->time_type=MYSQL_TIMESTAMP_DATE;
|
time_res->time_type=MYSQL_TIMESTAMP_DATE;
|
||||||
|
|
||||||
if (nr == LL(0) || nr >= LL(10000101000000))
|
if (nr == 0 || nr >= 10000101000000LL || sec_part)
|
||||||
{
|
{
|
||||||
time_res->time_type=MYSQL_TIMESTAMP_DATETIME;
|
time_res->time_type=MYSQL_TIMESTAMP_DATETIME;
|
||||||
goto ok;
|
goto ok;
|
||||||
@ -1208,13 +1211,14 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
|||||||
time_res->hour= (int) (part2/10000L); part2%=10000L;
|
time_res->hour= (int) (part2/10000L); part2%=10000L;
|
||||||
time_res->minute=(int) part2 / 100;
|
time_res->minute=(int) part2 / 100;
|
||||||
time_res->second=(int) part2 % 100;
|
time_res->second=(int) part2 % 100;
|
||||||
time_res->second_part= 0;
|
time_res->second_part= sec_part;
|
||||||
time_res->neg= 0;
|
time_res->neg= 0;
|
||||||
|
|
||||||
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 &&
|
||||||
!check_date(time_res, (nr != 0), flags, was_cut))
|
sec_part <= TIME_MAX_SECOND_PART &&
|
||||||
|
!check_date(time_res, nr || sec_part, flags, was_cut))
|
||||||
return nr;
|
return nr;
|
||||||
|
|
||||||
/* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */
|
/* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */
|
||||||
@ -1234,7 +1238,7 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a double to a MYSQL_TIME struct.
|
Convert a pair of integers to a MYSQL_TIME struct.
|
||||||
|
|
||||||
@param[in] nr a number to convert
|
@param[in] nr a number to convert
|
||||||
@param[out] ltime Date to check.
|
@param[out] ltime Date to check.
|
||||||
@ -1242,81 +1246,53 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
|||||||
modified to fit in the valid range. Otherwise 0.
|
modified to fit in the valid range. Otherwise 0.
|
||||||
|
|
||||||
@details
|
@details
|
||||||
Takes a number in the [-]HHHMMSS.uuuuuu format.
|
Takes a number in the [-]HHHMMSS.uuuuuu,
|
||||||
|
YYMMDDHHMMSS.uuuuuu, or in the YYYYMMDDHHMMSS.uuuuuu formats.
|
||||||
number_to_datetime() cannot take a double, because double precision is not
|
|
||||||
enough for YYYYMMDDHHMMSS.uuuuuu
|
|
||||||
|
|
||||||
@return
|
@return
|
||||||
0 time value is valid, but was possibly truncated
|
0 time value is valid, but was possibly truncated
|
||||||
1 time value is invalid
|
-1 time value is invalid
|
||||||
*/
|
*/
|
||||||
int number_to_time(double nr, MYSQL_TIME *ltime, int *was_cut)
|
int number_to_time(my_bool neg, longlong nr, ulong sec_part,
|
||||||
|
MYSQL_TIME *ltime, int *was_cut)
|
||||||
{
|
{
|
||||||
ulong tmp;
|
if (nr > 9999999 && neg == 0)
|
||||||
|
{
|
||||||
|
if (number_to_datetime(nr, sec_part, ltime,
|
||||||
|
TIME_FUZZY_DATE | TIME_INVALID_DATES, was_cut) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
ltime->year= ltime->month= ltime->day= 0;
|
||||||
|
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
||||||
|
*was_cut= MYSQL_TIME_WARN_TRUNCATED;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
*was_cut= 0;
|
*was_cut= 0;
|
||||||
ltime->year= ltime->month= ltime->day= 0;
|
ltime->year= ltime->month= ltime->day= 0;
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
||||||
|
|
||||||
if ((ltime->neg= nr < 0))
|
ltime->neg= neg;
|
||||||
nr= -nr;
|
|
||||||
|
|
||||||
if (nr > TIME_MAX_VALUE)
|
if (nr > TIME_MAX_VALUE)
|
||||||
{
|
{
|
||||||
nr= TIME_MAX_VALUE;
|
nr= TIME_MAX_VALUE;
|
||||||
|
sec_part= TIME_MAX_SECOND_PART;
|
||||||
*was_cut= MYSQL_TIME_WARN_OUT_OF_RANGE;
|
*was_cut= MYSQL_TIME_WARN_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
tmp=(ulong)floor(nr);
|
ltime->hour = nr/100/100;
|
||||||
ltime->hour = tmp/100/100;
|
ltime->minute= nr/100%100;
|
||||||
ltime->minute= tmp/100%100;
|
ltime->second= nr%100;
|
||||||
ltime->second= tmp%100;
|
ltime->second_part= sec_part;
|
||||||
ltime->second_part= (ulong)((nr-tmp)*TIME_SECOND_PART_FACTOR);
|
|
||||||
|
|
||||||
if (ltime->minute < 60 && ltime->second < 60)
|
if (ltime->minute < 60 && ltime->second < 60 && sec_part <= TIME_MAX_SECOND_PART)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*was_cut= MYSQL_TIME_WARN_TRUNCATED;
|
*was_cut= MYSQL_TIME_WARN_TRUNCATED;
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Convert a double to a date/datetime
|
|
||||||
|
|
||||||
Note that for sub seconds, the precision of double is not good enough!
|
|
||||||
|
|
||||||
RESULT:
|
|
||||||
0 ok
|
|
||||||
1 error ; ltime is zeroed
|
|
||||||
*/
|
|
||||||
|
|
||||||
my_bool double_to_datetime(double value, MYSQL_TIME *ltime,
|
|
||||||
uint fuzzydate)
|
|
||||||
{
|
|
||||||
double datepart_value;
|
|
||||||
int was_cut;
|
|
||||||
|
|
||||||
if (value < 0 || value > 99991231235959.0)
|
|
||||||
{
|
|
||||||
bzero((char*) ltime, sizeof(*ltime));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
datepart_value= floor(value);
|
|
||||||
if (number_to_datetime((longlong) datepart_value, ltime, fuzzydate,
|
|
||||||
&was_cut) == LL(-1))
|
|
||||||
return 1;
|
|
||||||
if (ltime->time_type == MYSQL_TIMESTAMP_DATETIME ||
|
|
||||||
ltime->time_type == MYSQL_TIMESTAMP_TIME)
|
|
||||||
{
|
|
||||||
/* Add sub seconds to results */
|
|
||||||
ltime->second_part= (ulong) (floor((value - datepart_value) *
|
|
||||||
TIME_SECOND_PART_FACTOR));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Convert time value to integer in YYYYMMDDHHMMSS format */
|
/* Convert time value to integer in YYYYMMDDHHMMSS format */
|
||||||
|
|
||||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time)
|
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time)
|
||||||
|
@ -464,7 +464,7 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
starts_null= table->field[ET_FIELD_STARTS]->is_null();
|
starts_null= table->field[ET_FIELD_STARTS]->is_null();
|
||||||
my_bool not_used= FALSE;
|
uint not_used;
|
||||||
if (!starts_null)
|
if (!starts_null)
|
||||||
{
|
{
|
||||||
table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE);
|
table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE);
|
||||||
@ -646,7 +646,7 @@ add_interval(MYSQL_TIME *ltime, const Time_zone *time_zone,
|
|||||||
if (date_add_interval(ltime, scale, interval))
|
if (date_add_interval(ltime, scale, interval))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
my_bool not_used;
|
uint not_used;
|
||||||
return time_zone->TIME_to_gmt_sec(ltime, ¬_used);
|
return time_zone->TIME_to_gmt_sec(ltime, ¬_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ mysql_event_fill_row(THD *thd,
|
|||||||
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->starts);
|
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->starts);
|
||||||
|
|
||||||
fields[ET_FIELD_STARTS]->set_notnull();
|
fields[ET_FIELD_STARTS]->set_notnull();
|
||||||
fields[ET_FIELD_STARTS]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
fields[ET_FIELD_STARTS]->store_time(&time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!et->ends_null)
|
if (!et->ends_null)
|
||||||
@ -290,7 +290,7 @@ mysql_event_fill_row(THD *thd,
|
|||||||
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->ends);
|
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->ends);
|
||||||
|
|
||||||
fields[ET_FIELD_ENDS]->set_notnull();
|
fields[ET_FIELD_ENDS]->set_notnull();
|
||||||
fields[ET_FIELD_ENDS]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
fields[ET_FIELD_ENDS]->store_time(&time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (et->execute_at)
|
else if (et->execute_at)
|
||||||
@ -309,8 +309,7 @@ mysql_event_fill_row(THD *thd,
|
|||||||
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->execute_at);
|
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->execute_at);
|
||||||
|
|
||||||
fields[ET_FIELD_EXECUTE_AT]->set_notnull();
|
fields[ET_FIELD_EXECUTE_AT]->set_notnull();
|
||||||
fields[ET_FIELD_EXECUTE_AT]->
|
fields[ET_FIELD_EXECUTE_AT]->store_time(&time);
|
||||||
store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1088,8 +1087,7 @@ update_timing_fields_for_event(THD *thd,
|
|||||||
my_tz_OFFSET0->gmt_sec_to_TIME(&time, last_executed);
|
my_tz_OFFSET0->gmt_sec_to_TIME(&time, last_executed);
|
||||||
|
|
||||||
fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
|
fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
|
||||||
fields[ET_FIELD_LAST_EXECUTED]->store_time(&time,
|
fields[ET_FIELD_LAST_EXECUTED]->store_time(&time);
|
||||||
MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
}
|
}
|
||||||
if (update_status)
|
if (update_status)
|
||||||
{
|
{
|
||||||
|
241
sql/field.cc
241
sql/field.cc
@ -80,7 +80,7 @@ const char field_separator=',';
|
|||||||
#define FIELDTYPE_TEAR_FROM (MYSQL_TYPE_BIT + 1)
|
#define FIELDTYPE_TEAR_FROM (MYSQL_TYPE_BIT + 1)
|
||||||
#define FIELDTYPE_TEAR_TO (MYSQL_TYPE_NEWDECIMAL - 1)
|
#define FIELDTYPE_TEAR_TO (MYSQL_TYPE_NEWDECIMAL - 1)
|
||||||
#define FIELDTYPE_NUM (FIELDTYPE_TEAR_FROM + (255 - FIELDTYPE_TEAR_TO))
|
#define FIELDTYPE_NUM (FIELDTYPE_TEAR_FROM + (255 - FIELDTYPE_TEAR_TO))
|
||||||
inline int field_type2index (enum_field_types field_type)
|
static inline int field_type2index (enum_field_types field_type)
|
||||||
{
|
{
|
||||||
return (field_type < FIELDTYPE_TEAR_FROM ?
|
return (field_type < FIELDTYPE_TEAR_FROM ?
|
||||||
field_type :
|
field_type :
|
||||||
@ -1749,11 +1749,11 @@ bool Field::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
|||||||
Needs to be changed if/when we want to support different time formats.
|
Needs to be changed if/when we want to support different time formats.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int Field::store_time(MYSQL_TIME *ltime, timestamp_type type_arg)
|
int Field::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||||
uint length= (uint) my_TIME_to_str(ltime, buff, decimals());
|
uint length= (uint) my_TIME_to_str(ltime, buff, dec);
|
||||||
return store(buff, length, &my_charset_bin);
|
return store(buff, length, &my_charset_bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2743,10 +2743,10 @@ int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_new_decimal::store_time(MYSQL_TIME *ltime, timestamp_type t_type)
|
int Field_new_decimal::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
{
|
{
|
||||||
my_decimal decimal_value;
|
my_decimal decimal_value;
|
||||||
return store_value(date2my_decimal(ltime, &decimal_value));
|
return store_value(date2my_decimal(ltime, &decimal_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2951,6 +2951,15 @@ Field_new_decimal::unpack(uchar* to, const uchar *from, uint param_data)
|
|||||||
return from+len;
|
return from+len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Field_num::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
|
{
|
||||||
|
longlong v= TIME_to_ulonglong(ltime);
|
||||||
|
if (ltime->neg == 0)
|
||||||
|
return store(v, true);
|
||||||
|
return store(-v, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** tiny int
|
** tiny int
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -4240,6 +4249,12 @@ int Field_real::store_decimal(const my_decimal *dm)
|
|||||||
return store(dbl);
|
return store(dbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Field_real::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
|
{
|
||||||
|
return store(TIME_to_double(ltime));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double Field_double::val_real(void)
|
double Field_double::val_real(void)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
@ -4279,6 +4294,14 @@ my_decimal *Field_real::val_decimal(my_decimal *decimal_value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Field_real::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
|
{
|
||||||
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
|
double nr= val_real();
|
||||||
|
return double_to_datetime_with_warn(nr, ltime, fuzzydate, field_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String *Field_double::val_str(String *val_buffer,
|
String *Field_double::val_str(String *val_buffer,
|
||||||
String *val_ptr __attribute__((unused)))
|
String *val_ptr __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -4543,6 +4566,8 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, MYSQL_TIME *l_time,
|
|||||||
{
|
{
|
||||||
uint conversion_error;
|
uint conversion_error;
|
||||||
timestamp= TIME_to_timestamp(thd, l_time, &conversion_error);
|
timestamp= TIME_to_timestamp(thd, l_time, &conversion_error);
|
||||||
|
if (timestamp == 0 && l_time->second_part == 0)
|
||||||
|
conversion_error= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
if (conversion_error)
|
if (conversion_error)
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, conversion_error,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, conversion_error,
|
||||||
@ -4560,7 +4585,7 @@ int Field_timestamp::store_TIME_with_warning(THD *thd, MYSQL_TIME *l_time,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_timestamp::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
|
int Field_timestamp::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
{
|
{
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
int unused;
|
int unused;
|
||||||
@ -4598,16 +4623,15 @@ int Field_timestamp::store(double nr)
|
|||||||
int error;
|
int error;
|
||||||
Lazy_string_double str(nr);
|
Lazy_string_double str(nr);
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
longlong tmp;
|
|
||||||
|
|
||||||
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||||
if (nr < 0 || nr > LONGLONG_MAX)
|
if (nr < 0 || nr > LONGLONG_MAX)
|
||||||
nr= (double)LONGLONG_MAX;
|
nr= static_cast<double>(LONGLONG_MAX);
|
||||||
tmp= number_to_datetime((longlong) floor(nr),
|
longlong tmp= number_to_datetime((longlong) floor(nr),
|
||||||
&l_time, (thd->variables.sql_mode &
|
(nr-floor(nr))*TIME_SECOND_PART_FACTOR,
|
||||||
MODE_NO_ZERO_DATE) |
|
&l_time, (thd->variables.sql_mode &
|
||||||
MODE_NO_ZERO_IN_DATE, &error);
|
MODE_NO_ZERO_DATE) |
|
||||||
l_time.second_part= (ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR);
|
MODE_NO_ZERO_IN_DATE, &error);
|
||||||
return store_TIME_with_warning(thd, &l_time, &str, error, tmp != -1);
|
return store_TIME_with_warning(thd, &l_time, &str, error, tmp != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4620,7 +4644,7 @@ int Field_timestamp::store(longlong nr, bool unsigned_val)
|
|||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
|
|
||||||
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||||
longlong tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
|
longlong tmp= number_to_datetime(nr, 0, &l_time, (thd->variables.sql_mode &
|
||||||
MODE_NO_ZERO_DATE) |
|
MODE_NO_ZERO_DATE) |
|
||||||
MODE_NO_ZERO_IN_DATE, &error);
|
MODE_NO_ZERO_IN_DATE, &error);
|
||||||
return store_TIME_with_warning(thd, &l_time, &str, error, tmp != LL(-1));
|
return store_TIME_with_warning(thd, &l_time, &str, error, tmp != LL(-1));
|
||||||
@ -4923,14 +4947,35 @@ String *Field_timestamp_hires::val_str(String *val_buffer, String *val_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
my_decimal *Field_timestamp_hires::val_decimal(my_decimal *d)
|
||||||
|
{
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
get_date(<ime, 0);
|
||||||
|
longlong intg= TIME_to_ulonglong(<ime);
|
||||||
|
return seconds2my_decimal(ltime.neg, intg, ltime.second_part, d);
|
||||||
|
}
|
||||||
|
|
||||||
int Field_timestamp_hires::store_decimal(const my_decimal *d)
|
int Field_timestamp_hires::store_decimal(const my_decimal *d)
|
||||||
{
|
{
|
||||||
char buff[DECIMAL_MAX_STR_LENGTH+1];
|
ulonglong nr;
|
||||||
String str(buff, sizeof(buff), &my_charset_bin);
|
ulong sec_part;
|
||||||
my_decimal2string(E_DEC_FATAL_ERROR, d,
|
int error;
|
||||||
MAX_DATETIME_COMPRESSED_WIDTH + MAX_DATETIME_PRECISION,
|
MYSQL_TIME ltime;
|
||||||
6, '0', &str);
|
longlong tmp;
|
||||||
return store(str.ptr(), str.length(), str.charset());
|
THD *thd= table->in_use;
|
||||||
|
Lazy_string_decimal str(d);
|
||||||
|
|
||||||
|
if (my_decimal2seconds(d, &nr, &sec_part))
|
||||||
|
{
|
||||||
|
tmp= -1;
|
||||||
|
error= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tmp= number_to_datetime(nr, sec_part, <ime, TIME_NO_ZERO_IN_DATE |
|
||||||
|
(thd->variables.sql_mode &
|
||||||
|
MODE_NO_ZERO_DATE), &error);
|
||||||
|
|
||||||
|
return store_TIME_with_warning(thd, <ime, &str, error, tmp != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Field_timestamp_hires::set_time()
|
int Field_timestamp_hires::set_time()
|
||||||
@ -5075,14 +5120,15 @@ int Field_temporal::store(double nr)
|
|||||||
Lazy_string_double str(nr);
|
Lazy_string_double str(nr);
|
||||||
|
|
||||||
if (nr < 0 || nr > LONGLONG_MAX)
|
if (nr < 0 || nr > LONGLONG_MAX)
|
||||||
nr= (double)LONGLONG_MAX;
|
nr= static_cast<double>(LONGLONG_MAX);
|
||||||
longlong tmp= number_to_datetime((longlong) floor(nr), <ime,
|
longlong tmp= number_to_datetime((longlong) floor(nr),
|
||||||
(TIME_FUZZY_DATE |
|
((nr-floor(nr))*TIME_SECOND_PART_FACTOR),
|
||||||
|
<ime,
|
||||||
|
(TIME_FUZZY_DATE |
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE |
|
(MODE_NO_ZERO_IN_DATE |
|
||||||
MODE_NO_ZERO_DATE |
|
MODE_NO_ZERO_DATE |
|
||||||
MODE_INVALID_DATES))), &error);
|
MODE_INVALID_DATES))), &error);
|
||||||
ltime.second_part= (ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR);
|
|
||||||
return store_TIME_with_warning(<ime, &str, error, tmp != -1);
|
return store_TIME_with_warning(<ime, &str, error, tmp != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5095,7 +5141,7 @@ int Field_temporal::store(longlong nr, bool unsigned_val)
|
|||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
Lazy_string_num str(nr);
|
Lazy_string_num str(nr);
|
||||||
|
|
||||||
tmp= number_to_datetime(nr, <ime, (TIME_FUZZY_DATE |
|
tmp= number_to_datetime(nr, 0, <ime, (TIME_FUZZY_DATE |
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE |
|
(MODE_NO_ZERO_IN_DATE |
|
||||||
MODE_NO_ZERO_DATE |
|
MODE_NO_ZERO_DATE |
|
||||||
@ -5105,7 +5151,7 @@ int Field_temporal::store(longlong nr, bool unsigned_val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_temporal::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
|
int Field_temporal::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
{
|
{
|
||||||
int error = 0, have_smth_to_conv= 1;
|
int error = 0, have_smth_to_conv= 1;
|
||||||
MYSQL_TIME l_time= *ltime;
|
MYSQL_TIME l_time= *ltime;
|
||||||
@ -5114,23 +5160,26 @@ int Field_temporal::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
|
|||||||
We don't perform range checking here since values stored in TIME
|
We don't perform range checking here since values stored in TIME
|
||||||
structure always fit into DATETIME range.
|
structure always fit into DATETIME range.
|
||||||
*/
|
*/
|
||||||
if (time_type == MYSQL_TIMESTAMP_DATE ||
|
have_smth_to_conv= !check_date(&l_time, pack_time(&l_time) != 0,
|
||||||
time_type == MYSQL_TIMESTAMP_DATETIME)
|
(TIME_FUZZY_DATE |
|
||||||
{
|
(current_thd->variables.sql_mode &
|
||||||
have_smth_to_conv= !check_date(&l_time, pack_time(&l_time) != 0,
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||||
(TIME_FUZZY_DATE |
|
MODE_INVALID_DATES))), &error);
|
||||||
(current_thd->variables.sql_mode &
|
|
||||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
|
||||||
MODE_INVALID_DATES))), &error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error= 1;
|
|
||||||
have_smth_to_conv= 0;
|
|
||||||
}
|
|
||||||
return store_TIME_with_warning(&l_time, &str, error, have_smth_to_conv);
|
return store_TIME_with_warning(&l_time, &str, error, have_smth_to_conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my_decimal *Field_temporal::val_decimal(my_decimal *d)
|
||||||
|
{
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
|
{
|
||||||
|
bzero(<ime, sizeof(ltime));
|
||||||
|
ltime.time_type= mysql_type_to_time_type(type());
|
||||||
|
}
|
||||||
|
longlong intg= TIME_to_ulonglong(<ime);
|
||||||
|
return seconds2my_decimal(ltime.neg, intg, ltime.second_part, d);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** time type
|
** time type
|
||||||
** In string context: HH:MM:SS
|
** In string context: HH:MM:SS
|
||||||
@ -5163,7 +5212,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_time::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
|
int Field_time::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
{
|
{
|
||||||
MYSQL_TIME l_time= *ltime;
|
MYSQL_TIME l_time= *ltime;
|
||||||
Lazy_string_time str(ltime);
|
Lazy_string_time str(ltime);
|
||||||
@ -5179,7 +5228,12 @@ int Field_time::store(double nr)
|
|||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
Lazy_string_double str(nr);
|
Lazy_string_double str(nr);
|
||||||
int was_cut;
|
int was_cut;
|
||||||
int have_smth_to_conv= !number_to_time(nr, <ime, &was_cut);
|
bool neg= nr < 0;
|
||||||
|
if (neg)
|
||||||
|
nr= -nr;
|
||||||
|
int have_smth_to_conv= !number_to_time(neg, nr,
|
||||||
|
(nr - trunc(nr)) * TIME_SECOND_PART_FACTOR,
|
||||||
|
<ime, &was_cut);
|
||||||
|
|
||||||
return store_TIME_with_warning(<ime, &str, was_cut, have_smth_to_conv);
|
return store_TIME_with_warning(<ime, &str, was_cut, have_smth_to_conv);
|
||||||
}
|
}
|
||||||
@ -5190,7 +5244,8 @@ int Field_time::store(longlong nr, bool unsigned_val)
|
|||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
Lazy_string_num str(nr);
|
Lazy_string_num str(nr);
|
||||||
int was_cut;
|
int was_cut;
|
||||||
int have_smth_to_conv= !number_to_time((double)nr, <ime, &was_cut);
|
int have_smth_to_conv= !number_to_time(nr < 0, nr < 0 ? -nr : nr,
|
||||||
|
0, <ime, &was_cut);
|
||||||
|
|
||||||
return store_TIME_with_warning(<ime, &str, was_cut, have_smth_to_conv);
|
return store_TIME_with_warning(<ime, &str, was_cut, have_smth_to_conv);
|
||||||
}
|
}
|
||||||
@ -5303,17 +5358,42 @@ void Field_time::sql_type(String &res) const
|
|||||||
res.set_ascii(STRING_WITH_LEN("time"));
|
res.set_ascii(STRING_WITH_LEN("time"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const longlong t_shift= ((TIME_MAX_VALUE_SECONDS+1)*TIME_SECOND_PART_FACTOR);
|
||||||
void Field_time_hires::store_TIME(MYSQL_TIME *ltime)
|
void Field_time_hires::store_TIME(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
ulonglong packed= sec_part_shift(pack_time(ltime), dec);
|
ulonglong packed= sec_part_shift(pack_time(ltime), dec) +
|
||||||
|
sec_part_shift(t_shift, dec);
|
||||||
store_bigendian(packed, ptr, Field_time_hires::pack_length());
|
store_bigendian(packed, ptr, Field_time_hires::pack_length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Field_time_hires::store_decimal(const my_decimal *d)
|
||||||
|
{
|
||||||
|
ulonglong nr;
|
||||||
|
ulong sec_part;
|
||||||
|
Lazy_string_decimal str(d);
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
int was_cut;
|
||||||
|
bool neg= my_decimal2seconds(d, &nr, &sec_part);
|
||||||
|
|
||||||
|
int have_smth_to_conv= !number_to_time(neg, nr, sec_part, <ime, &was_cut);
|
||||||
|
|
||||||
|
return store_TIME_with_warning(<ime, &str, was_cut, have_smth_to_conv);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 Field_time_hires::pack_length() const
|
uint32 Field_time_hires::pack_length() const
|
||||||
{
|
{
|
||||||
return time_hires_bytes[dec];
|
return time_hires_bytes[dec];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
longlong Field_time_hires::val_int(void)
|
||||||
|
{
|
||||||
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
Field_time_hires::get_date(<ime, TIME_TIME_ONLY);
|
||||||
|
longlong val= TIME_to_ulonglong_time(<ime);
|
||||||
|
return ltime.neg ? -val : val;
|
||||||
|
}
|
||||||
|
|
||||||
double Field_time_hires::val_real(void)
|
double Field_time_hires::val_real(void)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
@ -5339,20 +5419,18 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
|||||||
uint32 len= pack_length();
|
uint32 len= pack_length();
|
||||||
longlong packed= read_bigendian(ptr, len);
|
longlong packed= read_bigendian(ptr, len);
|
||||||
|
|
||||||
/* sign extension */
|
if (packed)
|
||||||
longlong mask= 1LL << (len*8 - 1);
|
packed= sec_part_unshift(packed - sec_part_shift(t_shift, dec), dec);
|
||||||
if (packed & mask)
|
|
||||||
packed|= ~(mask-1);
|
|
||||||
|
|
||||||
unpack_time(sec_part_unshift(packed, dec), ltime);
|
unpack_time(packed, ltime);
|
||||||
/*
|
/*
|
||||||
unpack_time() returns MYSQL_TIMESTAMP_DATETIME.
|
unpack_time() returns MYSQL_TIMESTAMP_DATETIME.
|
||||||
To get MYSQL_TIMESTAMP_TIME we few some adjustments
|
To get MYSQL_TIMESTAMP_TIME we few adjustments
|
||||||
*/
|
*/
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
||||||
ltime->hour+= (ltime->month*32+ltime->day)*24;
|
ltime->hour+= (ltime->month*32+ltime->day)*24;
|
||||||
ltime->month= ltime->day= 0;
|
ltime->month= ltime->day= 0;
|
||||||
return fuzzydate & (TIME_FUZZY_DATE|TIME_TIME_ONLY) ? 0 : 1;
|
return fuzzydate & (TIME_FUZZY_DATE | TIME_TIME_ONLY) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5466,6 +5544,17 @@ int Field_year::store(longlong nr, bool unsigned_val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Field_year::store_time_dec(MYSQL_TIME *ltime, uint dec)
|
||||||
|
{
|
||||||
|
Lazy_string_time str(ltime);
|
||||||
|
if (Field_year::store(ltime->year, 0))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
|
||||||
|
&str, ltime->time_type, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool Field_year::send_binary(Protocol *protocol)
|
bool Field_year::send_binary(Protocol *protocol)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
@ -5505,6 +5594,15 @@ String *Field_year::val_str(String *val_buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Field_year::get_date(MYSQL_TIME *ltime,uint 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Field_year::sql_type(String &res) const
|
void Field_year::sql_type(String &res) const
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs=res.charset();
|
CHARSET_INFO *cs=res.charset();
|
||||||
@ -5837,12 +5935,27 @@ void Field_datetime_hires::store_TIME(MYSQL_TIME *ltime)
|
|||||||
|
|
||||||
int Field_datetime_hires::store_decimal(const my_decimal *d)
|
int Field_datetime_hires::store_decimal(const my_decimal *d)
|
||||||
{
|
{
|
||||||
char buff[DECIMAL_MAX_STR_LENGTH+1];
|
ulonglong nr;
|
||||||
String str(buff, sizeof(buff), &my_charset_bin);
|
ulong sec_part;
|
||||||
my_decimal2string(E_DEC_FATAL_ERROR, d,
|
int error;
|
||||||
MAX_DATETIME_COMPRESSED_WIDTH + MAX_DATETIME_PRECISION,
|
MYSQL_TIME ltime;
|
||||||
6, '0', &str);
|
longlong tmp;
|
||||||
return store(str.ptr(), str.length(), str.charset());
|
THD *thd= table->in_use;
|
||||||
|
Lazy_string_decimal str(d);
|
||||||
|
|
||||||
|
if (my_decimal2seconds(d, &nr, &sec_part))
|
||||||
|
{
|
||||||
|
tmp= -1;
|
||||||
|
error= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tmp= number_to_datetime(nr, sec_part, <ime, (TIME_FUZZY_DATE |
|
||||||
|
(thd->variables.sql_mode &
|
||||||
|
(MODE_NO_ZERO_IN_DATE |
|
||||||
|
MODE_NO_ZERO_DATE |
|
||||||
|
MODE_INVALID_DATES))), &error);
|
||||||
|
|
||||||
|
return store_TIME_with_warning(<ime, &str, error, tmp != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Field_datetime_hires::send_binary(Protocol *protocol)
|
bool Field_datetime_hires::send_binary(Protocol *protocol)
|
||||||
@ -9854,7 +9967,7 @@ uint32 Field_blob::max_display_length()
|
|||||||
0 otherwise
|
0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
void
|
||||||
Field::set_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
Field::set_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
||||||
int cuted_increment)
|
int cuted_increment)
|
||||||
{
|
{
|
||||||
@ -9862,15 +9975,13 @@ Field::set_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
|||||||
If this field was created only for type conversion purposes it
|
If this field was created only for type conversion purposes it
|
||||||
will have table == NULL.
|
will have table == NULL.
|
||||||
*/
|
*/
|
||||||
THD *thd= table->in_use;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
if (thd->count_cuted_fields)
|
if (thd->count_cuted_fields)
|
||||||
{
|
{
|
||||||
thd->cuted_fields+= cuted_increment;
|
thd->cuted_fields+= cuted_increment;
|
||||||
push_warning_printf(thd, level, code, ER(code), field_name,
|
push_warning_printf(thd, level, code, ER(code), field_name,
|
||||||
thd->row_count);
|
thd->row_count);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return level >= MYSQL_ERROR::WARN_LEVEL_WARN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -9897,8 +10008,8 @@ void Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level,
|
|||||||
timestamp_type ts_type, int cuted_increment)
|
timestamp_type ts_type, int cuted_increment)
|
||||||
{
|
{
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
if ((thd->really_abort_on_warning() &&
|
if (thd->really_abort_on_warning() && level >= MYSQL_ERROR::WARN_LEVEL_WARN)
|
||||||
level >= MYSQL_ERROR::WARN_LEVEL_WARN) ||
|
|
||||||
set_warning(level, code, cuted_increment))
|
|
||||||
make_truncated_value_warning(thd, level, str, ts_type, field_name);
|
make_truncated_value_warning(thd, level, str, ts_type, field_name);
|
||||||
|
else
|
||||||
|
set_warning(level, code, cuted_increment);
|
||||||
}
|
}
|
||||||
|
82
sql/field.h
82
sql/field.h
@ -204,7 +204,9 @@ public:
|
|||||||
virtual int store(double nr)=0;
|
virtual int store(double nr)=0;
|
||||||
virtual int store(longlong nr, bool unsigned_val)=0;
|
virtual int store(longlong nr, bool unsigned_val)=0;
|
||||||
virtual int store_decimal(const my_decimal *d)=0;
|
virtual int store_decimal(const my_decimal *d)=0;
|
||||||
virtual int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
|
virtual int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
|
int store_time(MYSQL_TIME *ltime)
|
||||||
|
{ return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
|
||||||
int store(const char *to, uint length, CHARSET_INFO *cs,
|
int store(const char *to, uint length, CHARSET_INFO *cs,
|
||||||
enum_check_fields check_level);
|
enum_check_fields check_level);
|
||||||
virtual double val_real(void)=0;
|
virtual double val_real(void)=0;
|
||||||
@ -386,7 +388,6 @@ public:
|
|||||||
virtual void make_field(Send_field *);
|
virtual void make_field(Send_field *);
|
||||||
virtual void sort_string(uchar *buff,uint length)=0;
|
virtual void sort_string(uchar *buff,uint length)=0;
|
||||||
virtual bool optimize_range(uint idx, uint part);
|
virtual bool optimize_range(uint idx, uint part);
|
||||||
virtual bool special_const_compare() const { return FALSE; }
|
|
||||||
virtual void free() {}
|
virtual void free() {}
|
||||||
virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table,
|
virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table,
|
||||||
bool keep_type);
|
bool keep_type);
|
||||||
@ -531,7 +532,7 @@ public:
|
|||||||
{ return DERIVATION_IMPLICIT; }
|
{ return DERIVATION_IMPLICIT; }
|
||||||
virtual void set_derivation(enum Derivation derivation_arg) { }
|
virtual void set_derivation(enum Derivation derivation_arg) { }
|
||||||
virtual int set_time() { return 1; }
|
virtual int set_time() { return 1; }
|
||||||
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
|
void set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
|
||||||
int cuted_increment);
|
int cuted_increment);
|
||||||
void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code,
|
void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code,
|
||||||
const Lazy_string *str, timestamp_type ts_type,
|
const Lazy_string *str, timestamp_type ts_type,
|
||||||
@ -628,49 +629,26 @@ private:
|
|||||||
{ return 0; }
|
{ return 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*
|
uchar *pack_int(uchar *to, const uchar *from, size_t size)
|
||||||
Helper function to pack()/unpack() int32 values
|
|
||||||
*/
|
|
||||||
static void handle_int32(uchar *to, const uchar *from)
|
|
||||||
{
|
{
|
||||||
int32 val;
|
memcpy(to, from, size);
|
||||||
val = sint4korr(from);
|
return to + size;
|
||||||
int4store(to, val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
const uchar *unpack_int(uchar* to, const uchar *from, size_t size)
|
||||||
Helper function to pack()/unpack() int64 values
|
|
||||||
*/
|
|
||||||
static void handle_int64(uchar* to, const uchar *from)
|
|
||||||
{
|
{
|
||||||
int64 val;
|
memcpy(to, from, size);
|
||||||
val = sint8korr(from);
|
return from + size;
|
||||||
int8store(to, val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uchar *pack_int32(uchar *to, const uchar *from)
|
uchar *pack_int32(uchar *to, const uchar *from)
|
||||||
{
|
{ return pack_int(to, from, 4); }
|
||||||
handle_int32(to, from);
|
|
||||||
return to + sizeof(int32);
|
|
||||||
}
|
|
||||||
|
|
||||||
const uchar *unpack_int32(uchar* to, const uchar *from)
|
const uchar *unpack_int32(uchar* to, const uchar *from)
|
||||||
{
|
{ return unpack_int(to, from, 4); }
|
||||||
handle_int32(to, from);
|
|
||||||
return from + sizeof(int32);
|
|
||||||
}
|
|
||||||
|
|
||||||
uchar *pack_int64(uchar* to, const uchar *from)
|
uchar *pack_int64(uchar* to, const uchar *from)
|
||||||
{
|
{ return pack_int(to, from, 8); }
|
||||||
handle_int64(to, from);
|
|
||||||
return to + sizeof(int64);
|
|
||||||
}
|
|
||||||
|
|
||||||
const uchar *unpack_int64(uchar* to, const uchar *from)
|
const uchar *unpack_int64(uchar* to, const uchar *from)
|
||||||
{
|
{ return unpack_int(to, from, 8); }
|
||||||
handle_int64(to, from);
|
|
||||||
return from + sizeof(int64);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool field_flags_are_binary()
|
bool field_flags_are_binary()
|
||||||
{
|
{
|
||||||
@ -688,7 +666,7 @@ public:
|
|||||||
uchar null_bit_arg, utype unireg_check_arg,
|
uchar null_bit_arg, utype unireg_check_arg,
|
||||||
const char *field_name_arg,
|
const char *field_name_arg,
|
||||||
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
|
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
|
||||||
Item_result result_type () const { return REAL_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
void prepend_zeros(String *value);
|
void prepend_zeros(String *value);
|
||||||
void add_zerofill_and_unsigned(String &res) const;
|
void add_zerofill_and_unsigned(String &res) const;
|
||||||
friend class Create_field;
|
friend class Create_field;
|
||||||
@ -699,6 +677,7 @@ public:
|
|||||||
int store_decimal(const my_decimal *);
|
int store_decimal(const my_decimal *);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
uint is_equal(Create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
int check_int(CHARSET_INFO *cs, const char *str, int length,
|
int check_int(CHARSET_INFO *cs, const char *str, int length,
|
||||||
const char *int_end, int error);
|
const char *int_end, int error);
|
||||||
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
|
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
|
||||||
@ -768,7 +747,10 @@ public:
|
|||||||
field_name_arg, dec_arg, zero_arg, unsigned_arg),
|
field_name_arg, dec_arg, zero_arg, unsigned_arg),
|
||||||
not_fixed(dec_arg >= NOT_FIXED_DEC)
|
not_fixed(dec_arg >= NOT_FIXED_DEC)
|
||||||
{}
|
{}
|
||||||
|
Item_result result_type () const { return REAL_RESULT; }
|
||||||
int store_decimal(const my_decimal *);
|
int store_decimal(const my_decimal *);
|
||||||
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
uint32 max_display_length() { return field_length; }
|
uint32 max_display_length() { return field_length; }
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
@ -841,7 +823,7 @@ public:
|
|||||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
int store_decimal(const my_decimal *);
|
int store_decimal(const my_decimal *);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
@ -874,7 +856,6 @@ public:
|
|||||||
unireg_check_arg, field_name_arg,
|
unireg_check_arg, field_name_arg,
|
||||||
0, zero_arg,unsigned_arg)
|
0, zero_arg,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
|
||||||
enum_field_types type() const { return MYSQL_TYPE_TINY;}
|
enum_field_types type() const { return MYSQL_TYPE_TINY;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
|
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
|
||||||
@ -921,7 +902,6 @@ public:
|
|||||||
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg, 0, 0, unsigned_arg)
|
NONE, field_name_arg, 0, 0, unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
|
||||||
enum_field_types type() const { return MYSQL_TYPE_SHORT;}
|
enum_field_types type() const { return MYSQL_TYPE_SHORT;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
|
{ return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
|
||||||
@ -966,7 +946,6 @@ public:
|
|||||||
unireg_check_arg, field_name_arg,
|
unireg_check_arg, field_name_arg,
|
||||||
0, zero_arg,unsigned_arg)
|
0, zero_arg,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
|
||||||
enum_field_types type() const { return MYSQL_TYPE_INT24;}
|
enum_field_types type() const { return MYSQL_TYPE_INT24;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
|
{ return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
|
||||||
@ -1011,7 +990,6 @@ public:
|
|||||||
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg,0,0,unsigned_arg)
|
NONE, field_name_arg,0,0,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
|
||||||
enum_field_types type() const { return MYSQL_TYPE_LONG;}
|
enum_field_types type() const { return MYSQL_TYPE_LONG;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
|
{ return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
|
||||||
@ -1057,7 +1035,6 @@ public:
|
|||||||
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg,0,0,unsigned_arg)
|
NONE, field_name_arg,0,0,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
|
||||||
enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
|
enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
|
{ return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
|
||||||
@ -1200,6 +1177,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
class Field_timestamp :public Field_str {
|
class Field_timestamp :public Field_str {
|
||||||
|
protected:
|
||||||
int store_TIME_with_warning(THD *, MYSQL_TIME *, const Lazy_string *,
|
int store_TIME_with_warning(THD *, MYSQL_TIME *, const Lazy_string *,
|
||||||
bool, bool);
|
bool, bool);
|
||||||
public:
|
public:
|
||||||
@ -1215,7 +1193,7 @@ public:
|
|||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
@ -1274,6 +1252,7 @@ public:
|
|||||||
my_time_t get_timestamp(ulong *sec_part) const;
|
my_time_t get_timestamp(ulong *sec_part) const;
|
||||||
void store_TIME(my_time_t timestamp, ulong sec_part);
|
void store_TIME(my_time_t timestamp, ulong sec_part);
|
||||||
int store_decimal(const my_decimal *d);
|
int store_decimal(const my_decimal *d);
|
||||||
|
my_decimal* val_decimal(my_decimal*);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
bool send_binary(Protocol *protocol);
|
bool send_binary(Protocol *protocol);
|
||||||
@ -1309,13 +1288,13 @@ public:
|
|||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool send_binary(Protocol *protocol);
|
bool send_binary(Protocol *protocol);
|
||||||
uint32 max_display_length() { return field_length; }
|
uint32 max_display_length() { return field_length; }
|
||||||
/* 99 should compare with 1999 */
|
|
||||||
bool special_const_compare() const { return TRUE; }
|
|
||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1336,8 +1315,8 @@ public:
|
|||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
bool special_const_compare() const { return TRUE; }
|
my_decimal *val_decimal(my_decimal*);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Field_date :public Field_temporal {
|
class Field_date :public Field_temporal {
|
||||||
@ -1418,7 +1397,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
enum_field_types type() const { return MYSQL_TYPE_TIME;}
|
enum_field_types type() const { return MYSQL_TYPE_TIME;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
||||||
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
int store_time_dec(MYSQL_TIME *ltime, uint dec);
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
@ -1451,7 +1430,8 @@ public:
|
|||||||
}
|
}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||||
uint decimals() const { return dec; }
|
uint decimals() const { return dec; }
|
||||||
longlong val_int(void) { return (longlong)floor(val_real()); }
|
int store_decimal(const my_decimal *d);
|
||||||
|
longlong val_int(void);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
|
||||||
@ -1522,9 +1502,9 @@ public:
|
|||||||
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
|
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
|
||||||
}
|
}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||||
int store_decimal(const my_decimal *d);
|
|
||||||
uint decimals() const { return dec; }
|
uint decimals() const { return dec; }
|
||||||
void make_field(Send_field *field);
|
void make_field(Send_field *field);
|
||||||
|
int store_decimal(const my_decimal *d);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
|
@ -369,7 +369,7 @@ static void do_field_temporal(Copy_field *copy)
|
|||||||
{
|
{
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
copy->from_field->get_date(<ime, TIME_FUZZY_DATE);
|
copy->from_field->get_date(<ime, TIME_FUZZY_DATE);
|
||||||
copy->to_field->store_time(<ime, ltime.time_type);
|
copy->to_field->store_time_dec(<ime, copy->from_field->decimals());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -665,7 +665,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
|
|||||||
return do_field_int;
|
return do_field_int;
|
||||||
if (to->result_type() == DECIMAL_RESULT)
|
if (to->result_type() == DECIMAL_RESULT)
|
||||||
return do_field_decimal;
|
return do_field_decimal;
|
||||||
if (to->cmp_type() == TIME_RESULT) // TODO; Optimize this
|
if (from->cmp_type() == TIME_RESULT)
|
||||||
{
|
{
|
||||||
/* If types are not 100 % identical then convert trough get_date() */
|
/* If types are not 100 % identical then convert trough get_date() */
|
||||||
if (!to->eq_def(from) ||
|
if (!to->eq_def(from) ||
|
||||||
@ -677,7 +677,6 @@ Copy_field::get_copy_func(Field *to,Field *from)
|
|||||||
return do_field_temporal;
|
return do_field_temporal;
|
||||||
/* Do binary copy */
|
/* Do binary copy */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if identical fields
|
// Check if identical fields
|
||||||
if (from->result_type() == STRING_RESULT)
|
if (from->result_type() == STRING_RESULT)
|
||||||
{
|
{
|
||||||
@ -690,10 +689,6 @@ Copy_field::get_copy_func(Field *to,Field *from)
|
|||||||
to->type() == MYSQL_TYPE_VARCHAR && !to->has_charset())
|
to->type() == MYSQL_TYPE_VARCHAR && !to->has_charset())
|
||||||
return do_field_varbinary_pre50;
|
return do_field_varbinary_pre50;
|
||||||
|
|
||||||
/*
|
|
||||||
If we are copying date or datetime's we have to check the dates
|
|
||||||
if we don't allow 'all' dates.
|
|
||||||
*/
|
|
||||||
if (to->real_type() != from->real_type())
|
if (to->real_type() != from->real_type())
|
||||||
{
|
{
|
||||||
if (from->real_type() == MYSQL_TYPE_ENUM ||
|
if (from->real_type() == MYSQL_TYPE_ENUM ||
|
||||||
@ -832,7 +827,22 @@ int field_conv(Field *to,Field *from)
|
|||||||
((Field_enum *)(to))->store_type(0);
|
((Field_enum *)(to))->store_type(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((from->result_type() == STRING_RESULT &&
|
if (from->result_type() == REAL_RESULT)
|
||||||
|
return to->store(from->val_real());
|
||||||
|
if (from->result_type() == DECIMAL_RESULT)
|
||||||
|
{
|
||||||
|
my_decimal buff;
|
||||||
|
return to->store_decimal(from->val_decimal(&buff));
|
||||||
|
}
|
||||||
|
if (from->cmp_type() == TIME_RESULT)
|
||||||
|
{
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
if (from->get_date(<ime, TIME_FUZZY_DATE))
|
||||||
|
return to->reset();
|
||||||
|
else
|
||||||
|
return to->store_time_dec(<ime, from->decimals());
|
||||||
|
}
|
||||||
|
if ((from->result_type() == STRING_RESULT &&
|
||||||
(to->result_type() == STRING_RESULT ||
|
(to->result_type() == STRING_RESULT ||
|
||||||
(from->real_type() != MYSQL_TYPE_ENUM &&
|
(from->real_type() != MYSQL_TYPE_ENUM &&
|
||||||
from->real_type() != MYSQL_TYPE_SET))) ||
|
from->real_type() != MYSQL_TYPE_SET))) ||
|
||||||
@ -849,13 +859,5 @@ int field_conv(Field *to,Field *from)
|
|||||||
*/
|
*/
|
||||||
return to->store(result.c_ptr_quick(),result.length(),from->charset());
|
return to->store(result.c_ptr_quick(),result.length(),from->charset());
|
||||||
}
|
}
|
||||||
else if (from->result_type() == REAL_RESULT)
|
return to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
|
||||||
return to->store(from->val_real());
|
|
||||||
else if (from->result_type() == DECIMAL_RESULT)
|
|
||||||
{
|
|
||||||
my_decimal buff;
|
|
||||||
return to->store_decimal(from->val_decimal(&buff));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
|
|
||||||
}
|
}
|
||||||
|
151
sql/item.cc
151
sql/item.cc
@ -333,7 +333,7 @@ int Item::save_time_in_field(Field *field)
|
|||||||
if (get_time(<ime))
|
if (get_time(<ime))
|
||||||
return set_field_to_null_with_conversions(field, 0);
|
return set_field_to_null_with_conversions(field, 0);
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
return field->store_time(<ime, MYSQL_TIMESTAMP_TIME);
|
return field->store_time_dec(<ime, decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ int Item::save_date_in_field(Field *field)
|
|||||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return set_field_to_null_with_conversions(field, 0);
|
return set_field_to_null_with_conversions(field, 0);
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
return field->store_time(<ime, MYSQL_TIMESTAMP_DATETIME);
|
return field->store_time_dec(<ime, decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1057,75 +1057,60 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
|
|||||||
|
|
||||||
bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
Item_result res_type;
|
|
||||||
|
|
||||||
if (field_type() == MYSQL_TYPE_TIME)
|
if (field_type() == MYSQL_TYPE_TIME)
|
||||||
fuzzydate|= TIME_TIME_ONLY;
|
fuzzydate|= TIME_TIME_ONLY;
|
||||||
|
|
||||||
/* This function only supports time with strings */
|
switch (result_type()) {
|
||||||
res_type= result_type();
|
|
||||||
if (fuzzydate & TIME_TIME_ONLY)
|
|
||||||
res_type= STRING_RESULT;
|
|
||||||
|
|
||||||
switch (res_type) {
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
{
|
{
|
||||||
int was_cut;
|
|
||||||
longlong value= val_int();
|
longlong value= val_int();
|
||||||
if (null_value)
|
if (field_type() == MYSQL_TYPE_YEAR)
|
||||||
goto err;
|
|
||||||
if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
|
|
||||||
{
|
{
|
||||||
Lazy_string_num str(value);
|
if (max_length == 2)
|
||||||
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
{
|
||||||
&str, MYSQL_TIMESTAMP_NONE, NullS);
|
if (value < 70)
|
||||||
null_value= 1;
|
value+= 2000;
|
||||||
goto err;
|
else if (value <= 1900)
|
||||||
|
value+= 1900;
|
||||||
|
}
|
||||||
|
value*= 10000; /* make it YYYYMMHH */
|
||||||
}
|
}
|
||||||
|
if (null_value || int_to_datetime_with_warn(value, ltime, fuzzydate,
|
||||||
|
field_name_or_null()))
|
||||||
|
goto err;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
{
|
{
|
||||||
double value= val_real();
|
double value= val_real();
|
||||||
if (null_value)
|
if (null_value || double_to_datetime_with_warn(value, ltime, fuzzydate,
|
||||||
|
field_name_or_null()))
|
||||||
goto err;
|
goto err;
|
||||||
if (double_to_datetime_with_warn(value, ltime, fuzzydate))
|
|
||||||
{
|
|
||||||
null_value= 1;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
{
|
{
|
||||||
my_decimal value, *res;
|
my_decimal value, *res;
|
||||||
if (!(res= val_decimal(&value)))
|
if (!(res= val_decimal(&value)) ||
|
||||||
goto err; // Null
|
decimal_to_datetime_with_warn(res, ltime, fuzzydate,
|
||||||
if (decimal_to_datetime_with_warn(res, ltime, fuzzydate))
|
field_name_or_null()))
|
||||||
{
|
|
||||||
null_value= 1;
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
case STRING_RESULT:
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Default go trough string as this is the safest way to ensure that
|
|
||||||
we also get the microseconds.
|
|
||||||
*/
|
|
||||||
char buff[40];
|
char buff[40];
|
||||||
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
|
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
|
||||||
if (!(res=val_str(&tmp)) ||
|
if (!(res=val_str(&tmp)) ||
|
||||||
str_to_datetime_with_warn(res->ptr(), res->length(),
|
str_to_datetime_with_warn(res->ptr(), res->length(),
|
||||||
ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
|
ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
|
||||||
{
|
|
||||||
null_value= 1;
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -1133,37 +1118,22 @@ err:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool Item::get_seconds(ulonglong *sec, ulong *sec_part)
|
||||||
Get time of first argument.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool Item::get_time(MYSQL_TIME *ltime)
|
|
||||||
{
|
{
|
||||||
char buff[40];
|
if (result_type() == INT_RESULT)
|
||||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
{ // optimize for an important special case
|
||||||
|
longlong val= val_int();
|
||||||
if (cmp_type() == TIME_RESULT)
|
bool neg= val < 0 && !unsigned_flag;
|
||||||
{
|
*sec= neg ? -val : val;
|
||||||
/*
|
*sec_part= 0;
|
||||||
This is true for functions like Item_date_typecast() which
|
return neg;
|
||||||
doesn't have a explicit get_time() function.
|
|
||||||
*/
|
|
||||||
return (get_date(ltime, TIME_TIME_ONLY | TIME_FUZZY_DATE |
|
|
||||||
sql_mode_for_dates()));
|
|
||||||
}
|
}
|
||||||
|
my_decimal tmp, *dec= val_decimal(&tmp);
|
||||||
if (!(res=val_str(&tmp)) ||
|
if (!dec)
|
||||||
str_to_time_with_warn(res->ptr(), res->length(), ltime,
|
return 0;
|
||||||
TIME_FUZZY_DATE | sql_mode_for_dates()))
|
return my_decimal2seconds(dec, sec, sec_part);
|
||||||
{
|
|
||||||
bzero((char*) ltime,sizeof(*ltime)); // Safety
|
|
||||||
null_value= 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CHARSET_INFO *Item::default_charset()
|
CHARSET_INFO *Item::default_charset()
|
||||||
{
|
{
|
||||||
return current_thd->variables.collation_connection;
|
return current_thd->variables.collation_connection;
|
||||||
@ -3141,7 +3111,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
|
|||||||
case DECIMAL_VALUE:
|
case DECIMAL_VALUE:
|
||||||
return field->store_decimal(&decimal_value);
|
return field->store_decimal(&decimal_value);
|
||||||
case TIME_VALUE:
|
case TIME_VALUE:
|
||||||
field->store_time(&value.time, value.time.time_type);
|
field->store_time_dec(&value.time, decimals);
|
||||||
return 0;
|
return 0;
|
||||||
case STRING_VALUE:
|
case STRING_VALUE:
|
||||||
case LONG_DATA_VALUE:
|
case LONG_DATA_VALUE:
|
||||||
@ -5497,7 +5467,7 @@ void Item_datetime::set(longlong packed)
|
|||||||
int Item_datetime::save_in_field(Field *field, bool no_conversions)
|
int Item_datetime::save_in_field(Field *field, bool no_conversions)
|
||||||
{
|
{
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
return field->store_time(<ime, ltime.time_type);
|
return field->store_time_dec(<ime, decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong Item_datetime::val_int()
|
longlong Item_datetime::val_int()
|
||||||
@ -7226,25 +7196,6 @@ bool Item_cache_wrapper::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the time value of the possibly cached item
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool Item_cache_wrapper::get_time(MYSQL_TIME *ltime)
|
|
||||||
{
|
|
||||||
Item *cached_value;
|
|
||||||
DBUG_ENTER("Item_cache_wrapper::get_time");
|
|
||||||
if (!expr_cache)
|
|
||||||
DBUG_RETURN((null_value= orig_item->get_time(ltime)));
|
|
||||||
|
|
||||||
if ((cached_value= check_cache()))
|
|
||||||
DBUG_RETURN((null_value= cached_value->get_time(ltime)));
|
|
||||||
|
|
||||||
cache();
|
|
||||||
DBUG_RETURN((null_value= expr_value->get_time(ltime)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Item_cache_wrapper::save_in_field(Field *to, bool no_conversions)
|
int Item_cache_wrapper::save_in_field(Field *to, bool no_conversions)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@ -8247,30 +8198,22 @@ longlong Item_cache_int::val_int()
|
|||||||
|
|
||||||
bool Item_cache_int::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
bool Item_cache_int::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
||||||
{
|
{
|
||||||
|
Lazy_string_num str(value);
|
||||||
|
|
||||||
if (!value_cached && !cache_value())
|
if (!value_cached && !cache_value())
|
||||||
goto err;
|
{
|
||||||
|
bzero((char*) ltime,sizeof(*ltime));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (cmp_type() == TIME_RESULT)
|
if (cmp_type() == TIME_RESULT)
|
||||||
{
|
{
|
||||||
unpack_time(value, ltime);
|
unpack_time(value, ltime);
|
||||||
ltime->time_type= mysql_type_to_time_type(field_type());
|
ltime->time_type= mysql_type_to_time_type(field_type());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
int was_cut;
|
|
||||||
if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == -1LL)
|
|
||||||
{
|
|
||||||
Lazy_string_num str(value);
|
|
||||||
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
&str, MYSQL_TIMESTAMP_NONE, NullS);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err:
|
return Item::get_date(ltime, fuzzydate);
|
||||||
bzero((char*) ltime,sizeof(*ltime));
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8286,7 +8229,7 @@ int Item_cache_int::save_in_field(Field *field, bool no_conversions)
|
|||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
unpack_time(value, <ime);
|
unpack_time(value, <ime);
|
||||||
ltime.time_type= mysql_type_to_time_type(field_type());
|
ltime.time_type= mysql_type_to_time_type(field_type());
|
||||||
error= field->store_time(<ime, ltime.time_type);
|
error= field->store_time_dec(<ime, decimals);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error= field->store(value, unsigned_flag);
|
error= field->store(value, unsigned_flag);
|
||||||
|
@ -913,7 +913,9 @@ public:
|
|||||||
void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields,
|
void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields,
|
||||||
Item **ref, bool skip_registered);
|
Item **ref, bool skip_registered);
|
||||||
virtual bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
virtual bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool get_time(MYSQL_TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime)
|
||||||
|
{ return get_date(ltime, TIME_TIME_ONLY | TIME_FUZZY_DATE); }
|
||||||
|
bool get_seconds(ulonglong *sec, ulong *sec_part);
|
||||||
virtual bool get_date_result(MYSQL_TIME *ltime,uint fuzzydate)
|
virtual bool get_date_result(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{ return get_date(ltime,fuzzydate); }
|
{ return get_date(ltime,fuzzydate); }
|
||||||
/*
|
/*
|
||||||
@ -2757,7 +2759,6 @@ public:
|
|||||||
bool val_bool();
|
bool val_bool();
|
||||||
bool is_null();
|
bool is_null();
|
||||||
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
|
||||||
bool get_time(MYSQL_TIME *ltime);
|
|
||||||
bool send(Protocol *protocol, String *buffer)
|
bool send(Protocol *protocol, String *buffer)
|
||||||
{
|
{
|
||||||
if (result_field)
|
if (result_field)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
#include "sql_select.h"
|
#include "sql_select.h"
|
||||||
|
|
||||||
static bool convert_constant_item(THD *, Item_field *, Item **);
|
static bool convert_const_to_int(THD *, Item_field *, Item **);
|
||||||
|
|
||||||
static Item_result item_store_type(Item_result a, Item *item,
|
static Item_result item_store_type(Item_result a, Item *item,
|
||||||
my_bool unsigned_flag)
|
my_bool unsigned_flag)
|
||||||
@ -73,6 +73,30 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
find an temporal type (item) that others will be converted to
|
||||||
|
for the purpose of comparison.
|
||||||
|
|
||||||
|
this is the type that will be used in warnings like
|
||||||
|
"Incorrect <<TYPE>> value".
|
||||||
|
*/
|
||||||
|
Item *find_date_time_item(Item **args, uint nargs, uint col)
|
||||||
|
{
|
||||||
|
Item *date_arg= 0, **arg, **arg_end;
|
||||||
|
for (arg= args, arg_end= args + nargs; arg != arg_end ; arg++)
|
||||||
|
{
|
||||||
|
Item *item= arg[0]->element_index(col);
|
||||||
|
if (item->cmp_type() != TIME_RESULT)
|
||||||
|
continue;
|
||||||
|
if (item->field_type() == MYSQL_TYPE_DATETIME)
|
||||||
|
return item;
|
||||||
|
if (!date_arg)
|
||||||
|
date_arg= item;
|
||||||
|
}
|
||||||
|
return date_arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compare row signature of two expressions
|
Compare row signature of two expressions
|
||||||
|
|
||||||
@ -204,7 +228,7 @@ static uint collect_cmp_types(Item **items, uint nitems, bool skip_nulls= FALSE)
|
|||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
uint found_types;
|
uint found_types;
|
||||||
Item_result left_result= items[0]->result_type();
|
Item_result left_result= items[0]->cmp_type();
|
||||||
DBUG_ASSERT(nitems > 1);
|
DBUG_ASSERT(nitems > 1);
|
||||||
found_types= 0;
|
found_types= 0;
|
||||||
for (i= 1; i < nitems ; i++)
|
for (i= 1; i < nitems ; i++)
|
||||||
@ -212,11 +236,11 @@ static uint collect_cmp_types(Item **items, uint nitems, bool skip_nulls= FALSE)
|
|||||||
if (skip_nulls && items[i]->type() == Item::NULL_ITEM)
|
if (skip_nulls && items[i]->type() == Item::NULL_ITEM)
|
||||||
continue; // Skip NULL constant items
|
continue; // Skip NULL constant items
|
||||||
if ((left_result == ROW_RESULT ||
|
if ((left_result == ROW_RESULT ||
|
||||||
items[i]->result_type() == ROW_RESULT) &&
|
items[i]->cmp_type() == ROW_RESULT) &&
|
||||||
cmp_row_type(items[0], items[i]))
|
cmp_row_type(items[0], items[i]))
|
||||||
return 0;
|
return 0;
|
||||||
found_types|= 1<< (uint)item_cmp_type(left_result,
|
found_types|= 1<< (uint)item_cmp_type(left_result,
|
||||||
items[i]->result_type());
|
items[i]->cmp_type());
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Even if all right-hand items are NULLs and we are skipping them all, we need
|
Even if all right-hand items are NULLs and we are skipping them all, we need
|
||||||
@ -392,12 +416,24 @@ longlong Item_func_nop_all::val_int()
|
|||||||
1 Item was replaced with an integer version of the item
|
1 Item was replaced with an integer version of the item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool convert_constant_item(THD *thd, Item_field *field_item,
|
static bool convert_const_to_int(THD *thd, Item_field *field_item,
|
||||||
Item **item)
|
Item **item)
|
||||||
{
|
{
|
||||||
Field *field= field_item->field;
|
Field *field= field_item->field;
|
||||||
int result= 0;
|
int result= 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
We don't need to convert an integer to an integer,
|
||||||
|
pretend it's already converted.
|
||||||
|
|
||||||
|
But we still convert it if it is compared with a Field_year,
|
||||||
|
as YEAR(2) may change the value of an integer when converting it
|
||||||
|
to an integer (say, 0 to 70).
|
||||||
|
*/
|
||||||
|
if ((*item)->cmp_type() == INT_RESULT &&
|
||||||
|
field_item->field_type() != MYSQL_TYPE_YEAR)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if ((*item)->const_item())
|
if ((*item)->const_item())
|
||||||
{
|
{
|
||||||
TABLE *table= field->table;
|
TABLE *table= field->table;
|
||||||
@ -502,9 +538,7 @@ void Item_bool_func2::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
Item_field *field_item= (Item_field*) (args[field]->real_item());
|
Item_field *field_item= (Item_field*) (args[field]->real_item());
|
||||||
if (field_item->cmp_type() == INT_RESULT &&
|
if (field_item->cmp_type() == INT_RESULT &&
|
||||||
(field_item->field->special_const_compare() ||
|
convert_const_to_int(thd, field_item, &args[!field]))
|
||||||
args[!field]->result_type() == STRING_RESULT) &&
|
|
||||||
convert_constant_item(thd, field_item, &args[!field]))
|
|
||||||
args[0]->cmp_context= args[1]->cmp_context= INT_RESULT;
|
args[0]->cmp_context= args[1]->cmp_context= INT_RESULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,36 +713,6 @@ bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Convert date provided in a string to the int representation.
|
|
||||||
|
|
||||||
@param[in] thd thread handle
|
|
||||||
@param[in] str a string to convert
|
|
||||||
@param[in] warn_type type of the timestamp for issuing the warning
|
|
||||||
@param[in] warn_name field name for issuing the warning
|
|
||||||
@param[out] error_arg could not extract a DATE or DATETIME
|
|
||||||
|
|
||||||
@details Convert date provided in the string str to the int
|
|
||||||
representation. If the string contains wrong date or doesn't
|
|
||||||
contain it at all then a warning is issued. The warn_type and
|
|
||||||
the warn_name arguments are used as the name and the type of the
|
|
||||||
field when issuing the warning.
|
|
||||||
|
|
||||||
@return
|
|
||||||
converted value. 0 on error and on zero-dates -- check 'failure'
|
|
||||||
*/
|
|
||||||
static ulonglong get_date_from_str(THD *thd, String *str,
|
|
||||||
timestamp_type warn_type,
|
|
||||||
const char *warn_name, bool *error_arg)
|
|
||||||
{
|
|
||||||
MYSQL_TIME l_time;
|
|
||||||
*error_arg= get_mysql_time_from_str(thd, str, warn_type, warn_name, &l_time);
|
|
||||||
|
|
||||||
if (*error_arg)
|
|
||||||
return 0;
|
|
||||||
return pack_time(&l_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prepare the comparator (set the comparison function) for comparing
|
Prepare the comparator (set the comparison function) for comparing
|
||||||
items *a1 and *a2 in the context of 'type'.
|
items *a1 and *a2 in the context of 'type'.
|
||||||
@ -841,108 +845,28 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
|||||||
{
|
{
|
||||||
longlong UNINIT_VAR(value);
|
longlong UNINIT_VAR(value);
|
||||||
Item *item= **item_arg;
|
Item *item= **item_arg;
|
||||||
enum_field_types f_type= warn_item->field_type();
|
enum_field_types f_type= item->cmp_type() == TIME_RESULT ?
|
||||||
|
item->field_type() : warn_item->field_type();
|
||||||
|
|
||||||
switch (item->cmp_type()) {
|
if (item->result_type() == INT_RESULT && item->cmp_type() == TIME_RESULT)
|
||||||
case TIME_RESULT:
|
{
|
||||||
/* if it's our Item_cache_int, as created below, we simply use the value */
|
/* it's our Item_cache_int, as created below */
|
||||||
if (item->result_type() == INT_RESULT)
|
|
||||||
{
|
|
||||||
value= item->val_int();
|
|
||||||
cache_arg= 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MYSQL_TIME buf;
|
|
||||||
if (item->get_date_result(&buf, TIME_FUZZY_DATE | TIME_INVALID_DATES))
|
|
||||||
DBUG_ASSERT(item->null_value);
|
|
||||||
else
|
|
||||||
value= pack_time(&buf);
|
|
||||||
f_type= item->field_type(); // for Item_cache_int below.
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case INT_RESULT:
|
|
||||||
value= item->val_int();
|
value= item->val_int();
|
||||||
|
}
|
||||||
if (item->field_type() == MYSQL_TYPE_YEAR)
|
else
|
||||||
{
|
{
|
||||||
/*
|
MYSQL_TIME ltime;
|
||||||
Coerce value to the 19XX form in order to correctly compare
|
uint fuzzydate= TIME_FUZZY_DATE | TIME_INVALID_DATES;
|
||||||
YEAR(2) & YEAR(4) types.
|
if (f_type == MYSQL_TYPE_TIME)
|
||||||
Here we are converting all item values but YEAR(4) fields since
|
fuzzydate|= TIME_TIME_ONLY;
|
||||||
1) YEAR(4) already has a regular YYYY form and
|
if (item->get_date(<ime, fuzzydate))
|
||||||
2) we don't want to convert zero/bad YEAR(4) values to the
|
value= 0; /* invalid date */
|
||||||
value of 2000.
|
|
||||||
*/
|
|
||||||
Item *real_item= item->real_item();
|
|
||||||
if (real_item->max_length == 2)
|
|
||||||
{
|
|
||||||
if (value < 70)
|
|
||||||
value+= 100;
|
|
||||||
if (value <= 1900)
|
|
||||||
value+= 1900;
|
|
||||||
}
|
|
||||||
value*= 13ULL * 32ULL * 24ULL * 60ULL * 60ULL * 1000000ULL;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
value= pack_time(<ime);
|
||||||
MYSQL_TIME buf;
|
|
||||||
int was_cut;
|
|
||||||
longlong res;
|
|
||||||
|
|
||||||
if (f_type == MYSQL_TYPE_TIME)
|
|
||||||
res= number_to_time((double)value, &buf, &was_cut);
|
|
||||||
else
|
|
||||||
res= number_to_datetime(value, &buf, TIME_INVALID_DATES|TIME_FUZZY_DATE,
|
|
||||||
&was_cut);
|
|
||||||
if (res == -1)
|
|
||||||
{
|
|
||||||
const Lazy_string_num str(value);
|
|
||||||
make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, &str,
|
|
||||||
mysql_type_to_time_type(f_type),
|
|
||||||
warn_item->field_name_or_null());
|
|
||||||
value= 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
value= pack_time(&buf);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STRING_RESULT:
|
|
||||||
case DECIMAL_RESULT:
|
|
||||||
case REAL_RESULT:
|
|
||||||
{
|
|
||||||
char strbuf[MAX_DATETIME_FULL_WIDTH];
|
|
||||||
String buf(strbuf, sizeof(strbuf), &my_charset_bin), *str;
|
|
||||||
if ((str= item->val_str(&buf)))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Convert strings to the integer DATE/DATETIME representation.
|
|
||||||
|
|
||||||
Even if both dates provided in strings we cannot compare them
|
|
||||||
directly as strings as there is no warranty that they are correct
|
|
||||||
and do not miss some insignificant zeros.
|
|
||||||
*/
|
|
||||||
bool error;
|
|
||||||
value= (longlong) get_date_from_str(thd, str,
|
|
||||||
mysql_type_to_time_type(f_type),
|
|
||||||
warn_item->field_name_or_null(),
|
|
||||||
&error);
|
|
||||||
/*
|
|
||||||
If str did not contain a valid date according to the current
|
|
||||||
SQL_MODE, get_date_from_str() has already thrown a warning,
|
|
||||||
and we don't want to throw NULL on invalid date (see 5.2.6
|
|
||||||
"SQL modes" in the manual), so we're done here.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ROW_RESULT:
|
|
||||||
case IMPOSSIBLE_RESULT:
|
|
||||||
DBUG_ASSERT(0);
|
|
||||||
}
|
}
|
||||||
if ((*is_null= item->null_value))
|
if ((*is_null= item->null_value))
|
||||||
return ~(ulonglong) 0;
|
return ~(ulonglong) 0;
|
||||||
if (cache_arg && item->const_item())
|
if (cache_arg && item->const_item() && item->type() != Item::CACHE_ITEM)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
cache the packed datetime value in the Item_cache object.
|
cache the packed datetime value in the Item_cache object.
|
||||||
@ -952,8 +876,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
|||||||
MYSQL_TIMESTAMP_DATE or MYSQL_TYPE_DATETIME), and thus it will have
|
MYSQL_TIMESTAMP_DATE or MYSQL_TYPE_DATETIME), and thus it will have
|
||||||
cmp_type() == TIME_RESULT.
|
cmp_type() == TIME_RESULT.
|
||||||
As no other item can have this combination of cmp_type() and
|
As no other item can have this combination of cmp_type() and
|
||||||
result_type(), it allows us to identify our cache items, see
|
result_type(), it allows us to identify our cache items.
|
||||||
'case TIME_RESULT:' above.
|
|
||||||
*/
|
*/
|
||||||
Query_arena backup;
|
Query_arena backup;
|
||||||
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
|
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
|
||||||
@ -2178,18 +2101,7 @@ void Item_func_between::fix_length_and_dec()
|
|||||||
strings as.
|
strings as.
|
||||||
*/
|
*/
|
||||||
if (cmp_type == TIME_RESULT)
|
if (cmp_type == TIME_RESULT)
|
||||||
{
|
compare_as_dates= find_date_time_item(args, 3, 0);
|
||||||
for (int i= 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
if (args[i]->cmp_type() == TIME_RESULT)
|
|
||||||
{
|
|
||||||
if (args[i]->field_type() != MYSQL_TYPE_TIME ||
|
|
||||||
(args[i]->field_type() == MYSQL_TYPE_TIME && compare_as_dates==0))
|
|
||||||
compare_as_dates= args[i];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See the comment about the similar block in Item_bool_func2 */
|
/* See the comment about the similar block in Item_bool_func2 */
|
||||||
if (args[0]->real_item()->type() == FIELD_ITEM &&
|
if (args[0]->real_item()->type() == FIELD_ITEM &&
|
||||||
@ -2198,17 +2110,14 @@ void Item_func_between::fix_length_and_dec()
|
|||||||
Item_field *field_item= (Item_field*) (args[0]->real_item());
|
Item_field *field_item= (Item_field*) (args[0]->real_item());
|
||||||
if (field_item->cmp_type() == INT_RESULT)
|
if (field_item->cmp_type() == INT_RESULT)
|
||||||
{
|
{
|
||||||
bool special= field_item->field->special_const_compare();
|
|
||||||
/*
|
/*
|
||||||
The following can't be recoded with || as convert_constant_item
|
The following can't be recoded with || as convert_const_to_int
|
||||||
changes the argument
|
changes the argument
|
||||||
*/
|
*/
|
||||||
if ((special || args[1]->result_type() == STRING_RESULT) &&
|
if (convert_const_to_int(thd, field_item, &args[1]))
|
||||||
convert_constant_item(thd, field_item, &args[1]))
|
cmp_type=INT_RESULT;
|
||||||
cmp_type=INT_RESULT; // Works for all types.
|
if (convert_const_to_int(thd, field_item, &args[2]))
|
||||||
if ((special || args[2]->result_type() == STRING_RESULT) &&
|
cmp_type=INT_RESULT;
|
||||||
convert_constant_item(thd, field_item, &args[2]))
|
|
||||||
cmp_type=INT_RESULT; // Works for all types.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2966,16 +2875,17 @@ void Item_func_case::fix_length_and_dec()
|
|||||||
found_types |= (1 << item_cmp_type(left_result_type, STRING_RESULT));
|
found_types |= (1 << item_cmp_type(left_result_type, STRING_RESULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i= 0; i <= (uint)DECIMAL_RESULT; i++)
|
for (i= 0; i <= (uint)TIME_RESULT; i++)
|
||||||
{
|
{
|
||||||
if (found_types & (1 << i) && !cmp_items[i])
|
if (found_types & (1 << i) && !cmp_items[i])
|
||||||
{
|
{
|
||||||
DBUG_ASSERT((Item_result)i != ROW_RESULT);
|
DBUG_ASSERT((Item_result)i != ROW_RESULT);
|
||||||
|
DBUG_ASSERT((Item_result)i != TIME_RESULT);
|
||||||
if ((Item_result)i == STRING_RESULT &&
|
if ((Item_result)i == STRING_RESULT &&
|
||||||
agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV, 1))
|
agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV, 1))
|
||||||
return;
|
return;
|
||||||
if (!(cmp_items[i]=
|
if (!(cmp_items[i]=
|
||||||
cmp_item::get_comparator((Item_result)i,
|
cmp_item::get_comparator((Item_result)i, 0,
|
||||||
cmp_collation.collation)))
|
cmp_collation.collation)))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3055,7 +2965,7 @@ void Item_func_case::cleanup()
|
|||||||
uint i;
|
uint i;
|
||||||
DBUG_ENTER("Item_func_case::cleanup");
|
DBUG_ENTER("Item_func_case::cleanup");
|
||||||
Item_func::cleanup();
|
Item_func::cleanup();
|
||||||
for (i= 0; i <= (uint)DECIMAL_RESULT; i++)
|
for (i= 0; i <= (uint)TIME_RESULT; i++)
|
||||||
{
|
{
|
||||||
delete cmp_items[i];
|
delete cmp_items[i];
|
||||||
cmp_items[i]= 0;
|
cmp_items[i]= 0;
|
||||||
@ -3486,7 +3396,7 @@ uchar *in_decimal::get_value(Item *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cmp_item* cmp_item::get_comparator(Item_result type,
|
cmp_item* cmp_item::get_comparator(Item_result type, Item *warn_item,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -3501,6 +3411,7 @@ cmp_item* cmp_item::get_comparator(Item_result type,
|
|||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
return new cmp_item_decimal;
|
return new cmp_item_decimal;
|
||||||
case TIME_RESULT:
|
case TIME_RESULT:
|
||||||
|
return new cmp_item_datetime(warn_item);
|
||||||
case IMPOSSIBLE_RESULT:
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
break;
|
break;
|
||||||
@ -3566,7 +3477,7 @@ void cmp_item_row::store_value(Item *item)
|
|||||||
{
|
{
|
||||||
if (!comparators[i])
|
if (!comparators[i])
|
||||||
if (!(comparators[i]=
|
if (!(comparators[i]=
|
||||||
cmp_item::get_comparator(item->element_index(i)->result_type(),
|
cmp_item::get_comparator(item->element_index(i)->result_type(), 0,
|
||||||
item->element_index(i)->collation.collation)))
|
item->element_index(i)->collation.collation)))
|
||||||
break; // new failed
|
break; // new failed
|
||||||
comparators[i]->store_value(item->element_index(i));
|
comparators[i]->store_value(item->element_index(i));
|
||||||
@ -3767,20 +3678,17 @@ static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
|
|||||||
(uchar *) y->ptr(),y->length(), 0);
|
(uchar *) y->ptr(),y->length(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_func_in::fix_length_and_dec()
|
void Item_func_in::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
Item **arg, **arg_end;
|
Item **arg, **arg_end;
|
||||||
bool const_itm= 1;
|
bool const_itm= 1;
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
bool datetime_found= FALSE;
|
|
||||||
/* TRUE <=> arguments values will be compared as DATETIMEs. */
|
/* TRUE <=> arguments values will be compared as DATETIMEs. */
|
||||||
bool compare_as_datetime= FALSE;
|
|
||||||
Item *date_arg= 0;
|
Item *date_arg= 0;
|
||||||
uint found_types= 0;
|
uint found_types= 0;
|
||||||
uint type_cnt= 0, i;
|
uint type_cnt= 0, i;
|
||||||
Item_result cmp_type= STRING_RESULT;
|
Item_result cmp_type= STRING_RESULT;
|
||||||
left_result_type= args[0]->result_type();
|
left_result_type= args[0]->cmp_type();
|
||||||
if (!(found_types= collect_cmp_types(args, arg_count, true)))
|
if (!(found_types= collect_cmp_types(args, arg_count, true)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -3792,7 +3700,7 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i= 0; i <= (uint)DECIMAL_RESULT; i++)
|
for (i= 0; i <= (uint)TIME_RESULT; i++)
|
||||||
{
|
{
|
||||||
if (found_types & 1 << i)
|
if (found_types & 1 << i)
|
||||||
{
|
{
|
||||||
@ -3807,16 +3715,12 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1))
|
agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1))
|
||||||
return;
|
return;
|
||||||
arg_types_compatible= TRUE;
|
arg_types_compatible= TRUE;
|
||||||
}
|
|
||||||
if (type_cnt == 1)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
When comparing rows create the row comparator object beforehand to ease
|
|
||||||
the DATETIME comparison detection procedure.
|
|
||||||
*/
|
|
||||||
if (cmp_type == ROW_RESULT)
|
if (cmp_type == ROW_RESULT)
|
||||||
{
|
{
|
||||||
|
uint cols= args[0]->cols();
|
||||||
cmp_item_row *cmp= 0;
|
cmp_item_row *cmp= 0;
|
||||||
|
|
||||||
if (const_itm && !nulls_in_row())
|
if (const_itm && !nulls_in_row())
|
||||||
{
|
{
|
||||||
array= new in_row(arg_count-1, 0);
|
array= new in_row(arg_count-1, 0);
|
||||||
@ -3828,66 +3732,20 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
return;
|
return;
|
||||||
cmp_items[ROW_RESULT]= cmp;
|
cmp_items[ROW_RESULT]= cmp;
|
||||||
}
|
}
|
||||||
cmp->n= args[0]->cols();
|
cmp->n= cols;
|
||||||
cmp->alloc_comparators();
|
cmp->alloc_comparators();
|
||||||
}
|
|
||||||
/* All DATE/DATETIME fields/functions has the STRING result type. */
|
|
||||||
if (cmp_type == STRING_RESULT || cmp_type == ROW_RESULT)
|
|
||||||
{
|
|
||||||
uint col, cols= args[0]->cols();
|
|
||||||
|
|
||||||
for (col= 0; col < cols; col++)
|
for (uint col= 0; col < cols; col++)
|
||||||
{
|
{
|
||||||
bool skip_column= FALSE;
|
date_arg= find_date_time_item(args, arg_count, col);
|
||||||
/*
|
if (date_arg)
|
||||||
Check that all items to be compared has the STRING result type and at
|
|
||||||
least one of them is a DATE/DATETIME item.
|
|
||||||
*/
|
|
||||||
for (arg= args, arg_end= args + arg_count; arg != arg_end ; arg++)
|
|
||||||
{
|
{
|
||||||
Item *itm= ((cmp_type == STRING_RESULT) ? arg[0] :
|
cmp_item **cmp= 0;
|
||||||
arg[0]->element_index(col));
|
if (array)
|
||||||
if (itm->result_type() != STRING_RESULT)
|
cmp= ((in_row*)array)->tmp.comparators + col;
|
||||||
{
|
|
||||||
skip_column= TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (itm->cmp_type() == TIME_RESULT)
|
|
||||||
{
|
|
||||||
datetime_found= TRUE;
|
|
||||||
/*
|
|
||||||
Internally all DATE/DATETIME values are converted to the DATETIME
|
|
||||||
type. So try to find a DATETIME item to issue correct warnings.
|
|
||||||
*/
|
|
||||||
if (!date_arg)
|
|
||||||
date_arg= itm;
|
|
||||||
else if (itm->field_type() == MYSQL_TYPE_DATETIME)
|
|
||||||
{
|
|
||||||
date_arg= itm;
|
|
||||||
/* All arguments are already checked to have the STRING result. */
|
|
||||||
if (cmp_type == STRING_RESULT)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (skip_column)
|
|
||||||
continue;
|
|
||||||
if (datetime_found)
|
|
||||||
{
|
|
||||||
if (cmp_type == ROW_RESULT)
|
|
||||||
{
|
|
||||||
cmp_item **cmp= 0;
|
|
||||||
if (array)
|
|
||||||
cmp= ((in_row*)array)->tmp.comparators + col;
|
|
||||||
else
|
|
||||||
cmp= ((cmp_item_row*)cmp_items[ROW_RESULT])->comparators + col;
|
|
||||||
*cmp= new cmp_item_datetime(date_arg);
|
|
||||||
/* Reset variables for the next column. */
|
|
||||||
date_arg= 0;
|
|
||||||
datetime_found= FALSE;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
compare_as_datetime= TRUE;
|
cmp= ((cmp_item_row*)cmp_items[ROW_RESULT])->comparators + col;
|
||||||
|
*cmp= new cmp_item_datetime(date_arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3898,65 +3756,60 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
*/
|
*/
|
||||||
if (type_cnt == 1 && const_itm && !nulls_in_row())
|
if (type_cnt == 1 && const_itm && !nulls_in_row())
|
||||||
{
|
{
|
||||||
if (compare_as_datetime)
|
/*
|
||||||
array= new in_datetime(date_arg, arg_count - 1);
|
IN must compare INT columns and constants as int values (the same
|
||||||
else
|
way as equality does).
|
||||||
{
|
So we must check here if the column on the left and all the constant
|
||||||
/*
|
values on the right can be compared as integers and adjust the
|
||||||
IN must compare INT columns and constants as int values (the same
|
comparison type accordingly.
|
||||||
way as equality does).
|
|
||||||
So we must check here if the column on the left and all the constant
|
|
||||||
values on the right can be compared as integers and adjust the
|
|
||||||
comparison type accordingly.
|
|
||||||
|
|
||||||
See the comment about the similar block in Item_bool_func2
|
See the comment about the similar block in Item_bool_func2
|
||||||
*/
|
*/
|
||||||
if (args[0]->real_item()->type() == FIELD_ITEM &&
|
if (args[0]->real_item()->type() == FIELD_ITEM &&
|
||||||
!thd->lex->is_ps_or_view_context_analysis() &&
|
!thd->lex->is_ps_or_view_context_analysis() && cmp_type != INT_RESULT)
|
||||||
cmp_type != INT_RESULT)
|
{
|
||||||
|
Item_field *field_item= (Item_field*) (args[0]->real_item());
|
||||||
|
if (field_item->cmp_type() == INT_RESULT)
|
||||||
{
|
{
|
||||||
Item_field *field_item= (Item_field*) (args[0]->real_item());
|
bool all_converted= TRUE;
|
||||||
if (field_item->cmp_type() == INT_RESULT)
|
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
|
||||||
{
|
{
|
||||||
bool special= field_item->field->special_const_compare();
|
if (!convert_const_to_int(thd, field_item, &arg[0]))
|
||||||
bool all_converted= TRUE;
|
all_converted= FALSE;
|
||||||
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
|
|
||||||
{
|
|
||||||
if (!(special || arg[0]->result_type() == STRING_RESULT) ||
|
|
||||||
!convert_constant_item(thd, field_item, &arg[0]))
|
|
||||||
all_converted= FALSE;
|
|
||||||
}
|
|
||||||
if (all_converted)
|
|
||||||
cmp_type= INT_RESULT;
|
|
||||||
}
|
}
|
||||||
|
if (all_converted)
|
||||||
|
cmp_type= INT_RESULT;
|
||||||
}
|
}
|
||||||
switch (cmp_type) {
|
}
|
||||||
case STRING_RESULT:
|
switch (cmp_type) {
|
||||||
array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
|
case STRING_RESULT:
|
||||||
cmp_collation.collation);
|
array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
|
||||||
break;
|
cmp_collation.collation);
|
||||||
case INT_RESULT:
|
break;
|
||||||
array= new in_longlong(arg_count-1);
|
case INT_RESULT:
|
||||||
break;
|
array= new in_longlong(arg_count-1);
|
||||||
case REAL_RESULT:
|
break;
|
||||||
array= new in_double(arg_count-1);
|
case REAL_RESULT:
|
||||||
break;
|
array= new in_double(arg_count-1);
|
||||||
case ROW_RESULT:
|
break;
|
||||||
/*
|
case ROW_RESULT:
|
||||||
The row comparator was created at the beginning but only DATETIME
|
/*
|
||||||
items comparators were initialized. Call store_value() to setup
|
The row comparator was created at the beginning but only DATETIME
|
||||||
others.
|
items comparators were initialized. Call store_value() to setup
|
||||||
*/
|
others.
|
||||||
((in_row*)array)->tmp.store_value(args[0]);
|
*/
|
||||||
break;
|
((in_row*)array)->tmp.store_value(args[0]);
|
||||||
case DECIMAL_RESULT:
|
break;
|
||||||
array= new in_decimal(arg_count - 1);
|
case DECIMAL_RESULT:
|
||||||
break;
|
array= new in_decimal(arg_count - 1);
|
||||||
case TIME_RESULT:
|
break;
|
||||||
case IMPOSSIBLE_RESULT:
|
case TIME_RESULT:
|
||||||
DBUG_ASSERT(0);
|
date_arg= find_date_time_item(args, arg_count, 0);
|
||||||
break;
|
array= new in_datetime(date_arg, arg_count - 1);
|
||||||
}
|
break;
|
||||||
|
case IMPOSSIBLE_RESULT:
|
||||||
|
DBUG_ASSERT(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (array && !(thd->is_fatal_error)) // If not EOM
|
if (array && !(thd->is_fatal_error)) // If not EOM
|
||||||
{
|
{
|
||||||
@ -3975,23 +3828,21 @@ void Item_func_in::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (compare_as_datetime)
|
for (i= 0; i <= (uint) TIME_RESULT; i++)
|
||||||
cmp_items[STRING_RESULT]= new cmp_item_datetime(date_arg);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
for (i= 0; i <= (uint) DECIMAL_RESULT; i++)
|
if (found_types & (1 << i) && !cmp_items[i])
|
||||||
{
|
{
|
||||||
if (found_types & (1 << i) && !cmp_items[i])
|
if ((Item_result)i == STRING_RESULT &&
|
||||||
{
|
agg_arg_charsets(cmp_collation, args, arg_count,
|
||||||
if ((Item_result)i == STRING_RESULT &&
|
MY_COLL_CMP_CONV, 1))
|
||||||
agg_arg_charsets(cmp_collation, args, arg_count,
|
return;
|
||||||
MY_COLL_CMP_CONV, 1))
|
if ((Item_result)i == TIME_RESULT)
|
||||||
return;
|
date_arg= find_date_time_item(args, arg_count, 0);
|
||||||
if (!cmp_items[i] && !(cmp_items[i]=
|
|
||||||
cmp_item::get_comparator((Item_result)i,
|
if (!cmp_items[i] && !(cmp_items[i]=
|
||||||
cmp_collation.collation)))
|
cmp_item::get_comparator((Item_result)i, date_arg,
|
||||||
return;
|
cmp_collation.collation)))
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4059,7 +3910,7 @@ longlong Item_func_in::val_int()
|
|||||||
have_null= TRUE;
|
have_null= TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Item_result cmp_type= item_cmp_type(left_result_type, args[i]->result_type());
|
Item_result cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type());
|
||||||
in_item= cmp_items[(uint)cmp_type];
|
in_item= cmp_items[(uint)cmp_type];
|
||||||
DBUG_ASSERT(in_item);
|
DBUG_ASSERT(in_item);
|
||||||
if (!(value_added_map & (1 << (uint)cmp_type)))
|
if (!(value_added_map & (1 << (uint)cmp_type)))
|
||||||
@ -5677,7 +5528,7 @@ longlong Item_equal::val_int()
|
|||||||
void Item_equal::fix_length_and_dec()
|
void Item_equal::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
Item *item= get_first(NULL);
|
Item *item= get_first(NULL);
|
||||||
eval_item= cmp_item::get_comparator(item->result_type(),
|
eval_item= cmp_item::get_comparator(item->result_type(), 0,
|
||||||
item->collation.collation);
|
item->collation.collation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,7 +972,8 @@ public:
|
|||||||
virtual int cmp(Item *item)= 0;
|
virtual int cmp(Item *item)= 0;
|
||||||
// for optimized IN with row
|
// for optimized IN with row
|
||||||
virtual int compare(cmp_item *item)= 0;
|
virtual int compare(cmp_item *item)= 0;
|
||||||
static cmp_item* get_comparator(Item_result type, CHARSET_INFO *cs);
|
static cmp_item* get_comparator(Item_result type, Item * warn_item,
|
||||||
|
CHARSET_INFO *cs);
|
||||||
virtual cmp_item *make_same()= 0;
|
virtual cmp_item *make_same()= 0;
|
||||||
virtual void store_value_by_template(cmp_item *tmpl, Item *item)
|
virtual void store_value_by_template(cmp_item *tmpl, Item *item)
|
||||||
{
|
{
|
||||||
@ -1168,7 +1169,7 @@ class Item_func_case :public Item_func
|
|||||||
Item_result cmp_type;
|
Item_result cmp_type;
|
||||||
DTCollation cmp_collation;
|
DTCollation cmp_collation;
|
||||||
enum_field_types cached_field_type;
|
enum_field_types cached_field_type;
|
||||||
cmp_item *cmp_items[5]; /* For all result types */
|
cmp_item *cmp_items[6]; /* For all result types */
|
||||||
cmp_item *case_item;
|
cmp_item *case_item;
|
||||||
public:
|
public:
|
||||||
Item_func_case(List<Item> &list, Item *first_expr_arg, Item *else_expr_arg)
|
Item_func_case(List<Item> &list, Item *first_expr_arg, Item *else_expr_arg)
|
||||||
@ -1258,7 +1259,7 @@ public:
|
|||||||
Item_int_func::cleanup();
|
Item_int_func::cleanup();
|
||||||
delete array;
|
delete array;
|
||||||
array= 0;
|
array= 0;
|
||||||
for (i= 0; i <= (uint)DECIMAL_RESULT + 1; i++)
|
for (i= 0; i <= (uint)TIME_RESULT; i++)
|
||||||
{
|
{
|
||||||
delete cmp_items[i];
|
delete cmp_items[i];
|
||||||
cmp_items[i]= 0;
|
cmp_items[i]= 0;
|
||||||
|
@ -712,8 +712,8 @@ void Item_num_op::find_num_type(void)
|
|||||||
DBUG_ENTER("Item_num_op::find_num_type");
|
DBUG_ENTER("Item_num_op::find_num_type");
|
||||||
DBUG_PRINT("info", ("name %s", func_name()));
|
DBUG_PRINT("info", ("name %s", func_name()));
|
||||||
DBUG_ASSERT(arg_count == 2);
|
DBUG_ASSERT(arg_count == 2);
|
||||||
Item_result r0= args[0]->result_type();
|
Item_result r0= args[0]->cast_to_int_type();
|
||||||
Item_result r1= args[1]->result_type();
|
Item_result r1= args[1]->cast_to_int_type();
|
||||||
|
|
||||||
if (r0 == REAL_RESULT || r1 == REAL_RESULT ||
|
if (r0 == REAL_RESULT || r1 == REAL_RESULT ||
|
||||||
r0 == STRING_RESULT || r1 ==STRING_RESULT)
|
r0 == STRING_RESULT || r1 ==STRING_RESULT)
|
||||||
@ -722,7 +722,8 @@ void Item_num_op::find_num_type(void)
|
|||||||
max_length= float_length(decimals);
|
max_length= float_length(decimals);
|
||||||
hybrid_type= REAL_RESULT;
|
hybrid_type= REAL_RESULT;
|
||||||
}
|
}
|
||||||
else if (r0 == DECIMAL_RESULT || r1 == DECIMAL_RESULT)
|
else if (r0 == DECIMAL_RESULT || r1 == DECIMAL_RESULT ||
|
||||||
|
r0 == TIME_RESULT || r1 == TIME_RESULT)
|
||||||
{
|
{
|
||||||
hybrid_type= DECIMAL_RESULT;
|
hybrid_type= DECIMAL_RESULT;
|
||||||
result_precision();
|
result_precision();
|
||||||
@ -753,7 +754,7 @@ void Item_func_num1::find_num_type()
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("Item_func_num1::find_num_type");
|
DBUG_ENTER("Item_func_num1::find_num_type");
|
||||||
DBUG_PRINT("info", ("name %s", func_name()));
|
DBUG_PRINT("info", ("name %s", func_name()));
|
||||||
switch (hybrid_type= args[0]->result_type()) {
|
switch (hybrid_type= args[0]->cast_to_int_type()) {
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
unsigned_flag= args[0]->unsigned_flag;
|
unsigned_flag= args[0]->unsigned_flag;
|
||||||
break;
|
break;
|
||||||
@ -762,9 +763,10 @@ void Item_func_num1::find_num_type()
|
|||||||
hybrid_type= REAL_RESULT;
|
hybrid_type= REAL_RESULT;
|
||||||
max_length= float_length(decimals);
|
max_length= float_length(decimals);
|
||||||
break;
|
break;
|
||||||
|
case TIME_RESULT:
|
||||||
|
hybrid_type= DECIMAL_RESULT;
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
break;
|
break;
|
||||||
case TIME_RESULT:
|
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
case IMPOSSIBLE_RESULT:
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
@ -1949,13 +1951,15 @@ void Item_func_int_val::find_num_type()
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("Item_func_int_val::find_num_type");
|
DBUG_ENTER("Item_func_int_val::find_num_type");
|
||||||
DBUG_PRINT("info", ("name %s", func_name()));
|
DBUG_PRINT("info", ("name %s", func_name()));
|
||||||
switch (hybrid_type= args[0]->result_type()) {
|
switch (hybrid_type= args[0]->cast_to_int_type())
|
||||||
|
{
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
hybrid_type= REAL_RESULT;
|
hybrid_type= REAL_RESULT;
|
||||||
max_length= float_length(decimals);
|
max_length= float_length(decimals);
|
||||||
break;
|
break;
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
|
case TIME_RESULT:
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
/*
|
/*
|
||||||
-2 because in most high position can't be used any digit for longlong
|
-2 because in most high position can't be used any digit for longlong
|
||||||
@ -1973,7 +1977,6 @@ void Item_func_int_val::find_num_type()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
case TIME_RESULT:
|
|
||||||
case IMPOSSIBLE_RESULT:
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
@ -2374,16 +2377,9 @@ void Item_func_min_max::fix_length_and_dec()
|
|||||||
if (args[i]->maybe_null)
|
if (args[i]->maybe_null)
|
||||||
maybe_null= 1;
|
maybe_null= 1;
|
||||||
cmp_type= item_cmp_type(cmp_type,args[i]->result_type());
|
cmp_type= item_cmp_type(cmp_type,args[i]->result_type());
|
||||||
if (args[i]->cmp_type() == TIME_RESULT)
|
|
||||||
{
|
|
||||||
if (!compare_as_dates || args[i]->field_type() == MYSQL_TYPE_DATETIME)
|
|
||||||
compare_as_dates= args[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (cmp_type == STRING_RESULT)
|
if (cmp_type == STRING_RESULT)
|
||||||
{
|
|
||||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
|
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
|
||||||
}
|
|
||||||
else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
|
else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
|
||||||
max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
|
max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
|
||||||
decimals, decimals,
|
decimals, decimals,
|
||||||
@ -2391,8 +2387,15 @@ void Item_func_min_max::fix_length_and_dec()
|
|||||||
else if (cmp_type == REAL_RESULT)
|
else if (cmp_type == REAL_RESULT)
|
||||||
max_length= float_length(decimals);
|
max_length= float_length(decimals);
|
||||||
|
|
||||||
|
compare_as_dates= find_date_time_item(args, arg_count, 0);
|
||||||
if (compare_as_dates)
|
if (compare_as_dates)
|
||||||
|
{
|
||||||
cached_field_type= compare_as_dates->field_type();
|
cached_field_type= compare_as_dates->field_type();
|
||||||
|
if (mysql_type_to_time_type(cached_field_type) == MYSQL_TIMESTAMP_DATE)
|
||||||
|
decimals= 0;
|
||||||
|
else
|
||||||
|
set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cached_field_type= agg_field_type(args, arg_count);
|
cached_field_type= agg_field_type(args, arg_count);
|
||||||
}
|
}
|
||||||
|
@ -4033,8 +4033,11 @@ longlong Item_dyncol_get::val_int()
|
|||||||
case DYN_COL_DATETIME:
|
case DYN_COL_DATETIME:
|
||||||
case DYN_COL_DATE:
|
case DYN_COL_DATE:
|
||||||
case DYN_COL_TIME:
|
case DYN_COL_TIME:
|
||||||
unsigned_flag= 1;
|
unsigned_flag= !val.time_value.neg;
|
||||||
return TIME_to_ulonglong(&val.time_value);
|
if (unsigned_flag)
|
||||||
|
return TIME_to_ulonglong(&val.time_value);
|
||||||
|
else
|
||||||
|
return -(longlong)TIME_to_ulonglong(&val.time_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
null:
|
null:
|
||||||
@ -4091,8 +4094,7 @@ double Item_dyncol_get::val_real()
|
|||||||
case DYN_COL_DATETIME:
|
case DYN_COL_DATETIME:
|
||||||
case DYN_COL_DATE:
|
case DYN_COL_DATE:
|
||||||
case DYN_COL_TIME:
|
case DYN_COL_TIME:
|
||||||
return (ulonglong2double(TIME_to_ulonglong(&val.time_value)) +
|
return TIME_to_double(&val.time_value);
|
||||||
val.time_value.second_part / (double) TIME_SECOND_PART_FACTOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
null:
|
null:
|
||||||
@ -4140,26 +4142,17 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DYN_COL_DECIMAL:
|
case DYN_COL_DECIMAL:
|
||||||
{
|
|
||||||
int length= STRING_BUFFER_USUAL_SIZE;
|
|
||||||
decimal2string(&val.decimal_value, buff, &length, 0,0, 0);
|
|
||||||
decimal2my_decimal(&val.decimal_value, decimal_value);
|
decimal2my_decimal(&val.decimal_value, decimal_value);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case DYN_COL_DATETIME:
|
case DYN_COL_DATETIME:
|
||||||
case DYN_COL_DATE:
|
case DYN_COL_DATE:
|
||||||
case DYN_COL_TIME:
|
case DYN_COL_TIME:
|
||||||
{
|
decimal_value= seconds2my_decimal(val.time_value.neg,
|
||||||
my_decimal time_part, sub_second, fractions;
|
TIME_to_ulonglong(&val.time_value),
|
||||||
longlong2decimal(TIME_to_ulonglong(&val.time_value), &time_part);
|
val.time_value.second_part,
|
||||||
longlong2decimal(val.time_value.second_part, &sub_second);
|
decimal_value);
|
||||||
my_decimal_div(E_DEC_FATAL_ERROR, &fractions, &sub_second,
|
|
||||||
&time_second_part_factor, TIME_SECOND_PART_DIGITS);
|
|
||||||
my_decimal_add(E_DEC_FATAL_ERROR, decimal_value, &time_part, &fractions);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return decimal_value;
|
return decimal_value;
|
||||||
|
|
||||||
null:
|
null:
|
||||||
@ -4185,43 +4178,32 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
|||||||
signed_value= 1; // For error message
|
signed_value= 1; // For error message
|
||||||
/* fall_trough */
|
/* fall_trough */
|
||||||
case DYN_COL_UINT:
|
case DYN_COL_UINT:
|
||||||
{
|
if (signed_value || val.ulong_value <= LONGLONG_MAX)
|
||||||
ulonglong num;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
num= val.ulong_value;
|
|
||||||
number_to_datetime(num, ltime, fuzzy_date, &error);
|
|
||||||
if (error)
|
|
||||||
{
|
{
|
||||||
char buff[65];
|
if (int_to_datetime_with_warn(val.ulong_value, ltime, fuzzy_date,
|
||||||
int errnum= error == 2 ? ER_DATA_OVERFLOW : ER_BAD_DATA;
|
0 /* TODO */))
|
||||||
longlong2str(num, buff, signed_value ? -10 : 10, 1);
|
goto null;
|
||||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
return 0;
|
||||||
errnum,
|
|
||||||
ER(errnum),
|
|
||||||
buff, "DATE or DATETIME");
|
|
||||||
goto null;
|
|
||||||
}
|
}
|
||||||
return 0;
|
/* let double_to_datetime_with_warn() issue the warning message */
|
||||||
}
|
val.double_value= ULONGLONG_MAX;
|
||||||
|
/* fall_trough */
|
||||||
case DYN_COL_DOUBLE:
|
case DYN_COL_DOUBLE:
|
||||||
{
|
if (double_to_datetime_with_warn(val.double_value, ltime, fuzzy_date,
|
||||||
if (double_to_datetime_with_warn(val.double_value, ltime, fuzzy_date))
|
0 /* TODO */))
|
||||||
goto null;
|
goto null;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
case DYN_COL_DECIMAL:
|
case DYN_COL_DECIMAL:
|
||||||
if (decimal_to_datetime_with_warn(&val.decimal_value, ltime, fuzzy_date))
|
if (decimal_to_datetime_with_warn((my_decimal*)&val.decimal_value, ltime,
|
||||||
|
fuzzy_date, 0 /* TODO */))
|
||||||
goto null;
|
goto null;
|
||||||
return 0;
|
return 0;
|
||||||
case DYN_COL_STRING:
|
case DYN_COL_STRING:
|
||||||
{
|
|
||||||
if (str_to_datetime_with_warn(val.string_value.str,
|
if (str_to_datetime_with_warn(val.string_value.str,
|
||||||
val.string_value.length,
|
val.string_value.length,
|
||||||
ltime, fuzzy_date) <= MYSQL_TIMESTAMP_ERROR)
|
ltime, fuzzy_date) <= MYSQL_TIMESTAMP_ERROR)
|
||||||
goto null;
|
goto null;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
case DYN_COL_DATETIME:
|
case DYN_COL_DATETIME:
|
||||||
case DYN_COL_DATE:
|
case DYN_COL_DATE:
|
||||||
case DYN_COL_TIME:
|
case DYN_COL_TIME:
|
||||||
|
@ -502,7 +502,8 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
|
|||||||
field= Field_new_decimal::create_from_item(this);
|
field= Field_new_decimal::create_from_item(this);
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
case TIME_RESULT:
|
||||||
|
case IMPOSSIBLE_RESULT:
|
||||||
// This case should never be choosen
|
// This case should never be choosen
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
return 0;
|
return 0;
|
||||||
@ -617,7 +618,8 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
|
|||||||
max_length= float_length(decimals);
|
max_length= float_length(decimals);
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
case TIME_RESULT:
|
||||||
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
};
|
};
|
||||||
setup_hybrid(args[0], NULL);
|
setup_hybrid(args[0], NULL);
|
||||||
@ -770,13 +772,14 @@ void Item_sum_sum::fix_length_and_dec()
|
|||||||
DBUG_ENTER("Item_sum_sum::fix_length_and_dec");
|
DBUG_ENTER("Item_sum_sum::fix_length_and_dec");
|
||||||
maybe_null=null_value=1;
|
maybe_null=null_value=1;
|
||||||
decimals= args[0]->decimals;
|
decimals= args[0]->decimals;
|
||||||
switch (args[0]->result_type()) {
|
switch (args[0]->cast_to_int_type()) {
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
hybrid_type= REAL_RESULT;
|
hybrid_type= REAL_RESULT;
|
||||||
sum= 0.0;
|
sum= 0.0;
|
||||||
break;
|
break;
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
|
case TIME_RESULT:
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
{
|
{
|
||||||
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
|
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
|
||||||
@ -790,7 +793,7 @@ void Item_sum_sum::fix_length_and_dec()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("Type: %s (%d, %d)",
|
DBUG_PRINT("info", ("Type: %s (%d, %d)",
|
||||||
@ -979,7 +982,8 @@ void Item_sum_distinct::fix_length_and_dec()
|
|||||||
table_field_type= MYSQL_TYPE_NEWDECIMAL;
|
table_field_type= MYSQL_TYPE_NEWDECIMAL;
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
case TIME_RESULT:
|
||||||
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
val.traits->fix_length_and_dec(this, args[0]);
|
val.traits->fix_length_and_dec(this, args[0]);
|
||||||
@ -1431,7 +1435,8 @@ void Item_sum_variance::fix_length_and_dec()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
case TIME_RESULT:
|
||||||
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals));
|
DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals));
|
||||||
@ -1856,7 +1861,8 @@ void Item_sum_hybrid::reset_field()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
case TIME_RESULT:
|
||||||
|
case IMPOSSIBLE_RESULT:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,76 +45,6 @@ static bool make_datetime(MYSQL_TIME *ltime, String *str, uint decimals)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Convert seconds to MYSQL_TIME value with overflow checking
|
|
||||||
|
|
||||||
SYNOPSIS:
|
|
||||||
sec_to_time()
|
|
||||||
seconds number of seconds
|
|
||||||
ltime output MYSQL_TIME value
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
If the 'seconds' argument is inside MYSQL_TIME data range, convert it to a
|
|
||||||
corresponding value.
|
|
||||||
Otherwise, truncate the resulting value to the nearest endpoint, and
|
|
||||||
produce a warning message.
|
|
||||||
|
|
||||||
RETURN
|
|
||||||
1 if the value was truncated during conversion
|
|
||||||
0 otherwise
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool Item_func_sec_to_time::sec_to_time(my_decimal *seconds, MYSQL_TIME *ltime)
|
|
||||||
{
|
|
||||||
Lazy_string_decimal str(*seconds);
|
|
||||||
uint sec;
|
|
||||||
longlong full_seconds;
|
|
||||||
my_decimal tmp, sub_seconds;
|
|
||||||
|
|
||||||
bzero((char *)ltime, sizeof(*ltime));
|
|
||||||
|
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
|
||||||
|
|
||||||
if (seconds->sign())
|
|
||||||
{
|
|
||||||
ltime->neg= 1;
|
|
||||||
seconds->sign(0);
|
|
||||||
}
|
|
||||||
if (my_decimal_cmp(seconds, &max_seconds_for_time_type) > 0)
|
|
||||||
goto overflow;
|
|
||||||
|
|
||||||
/* We don't call my_decimal2int() here as we don't want rounding */
|
|
||||||
(void) decimal2longlong(seconds, &full_seconds);
|
|
||||||
|
|
||||||
sec= (uint) (full_seconds % 3600);
|
|
||||||
ltime->hour= (uint) (full_seconds/3600);
|
|
||||||
ltime->minute= sec/60;
|
|
||||||
ltime->second= sec % 60;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Calculate second_part
|
|
||||||
ltime->second_part= (seconds - floor(seconds)) * TIME_SECOND_PART_FACTOR
|
|
||||||
*/
|
|
||||||
my_decimal_floor(E_DEC_FATAL_ERROR, seconds, &tmp);
|
|
||||||
my_decimal_sub(E_DEC_FATAL_ERROR, &sub_seconds, seconds, &tmp);
|
|
||||||
my_decimal_mul(E_DEC_FATAL_ERROR, &tmp, &sub_seconds,
|
|
||||||
&time_second_part_factor);
|
|
||||||
(void) decimal2longlong(&tmp, &full_seconds);
|
|
||||||
ltime->second_part= (ulong)full_seconds;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
overflow:
|
|
||||||
/* use check_time_range() to set ltime to the max value depending on dec */
|
|
||||||
int unused;
|
|
||||||
ltime->hour= TIME_MAX_HOUR+1;
|
|
||||||
check_time_range(ltime, decimals, &unused);
|
|
||||||
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
&str, MYSQL_TIMESTAMP_TIME, NullS);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Date formats corresponding to compound %r and %T conversion specifiers
|
Date formats corresponding to compound %r and %T conversion specifiers
|
||||||
|
|
||||||
@ -1243,14 +1173,15 @@ longlong Item_func_unix_timestamp::int_op()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Item_func_unix_timestamp::real_op()
|
my_decimal *Item_func_unix_timestamp::decimal_op(my_decimal* buf)
|
||||||
{
|
{
|
||||||
ulong second_part;
|
ulong second_part;
|
||||||
my_time_t seconds;
|
my_time_t seconds;
|
||||||
if (get_timestamp_value(&seconds, &second_part))
|
if (get_timestamp_value(&seconds, &second_part))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return seconds + second_part/(double)TIME_SECOND_PART_FACTOR;
|
return seconds2my_decimal(seconds < 0, seconds < 0 ? -seconds : seconds,
|
||||||
|
second_part, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1258,21 +1189,23 @@ longlong Item_func_time_to_sec::int_op()
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
longlong seconds;
|
if (get_arg0_time(<ime))
|
||||||
(void) get_arg0_time(<ime);
|
return 0;
|
||||||
seconds=ltime.hour*3600L+ltime.minute*60+ltime.second;
|
|
||||||
|
longlong seconds=ltime.hour*3600L+ltime.minute*60+ltime.second;
|
||||||
return ltime.neg ? -seconds : seconds;
|
return ltime.neg ? -seconds : seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Item_func_time_to_sec::real_op()
|
my_decimal *Item_func_time_to_sec::decimal_op(my_decimal* buf)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
double seconds;
|
if (get_arg0_time(<ime))
|
||||||
(void) get_arg0_time(<ime);
|
return 0;
|
||||||
seconds=ltime.hour*3600L+ltime.minute*60+ltime.second+ltime.second_part/1e6;
|
|
||||||
return ltime.neg ? -seconds : seconds;
|
longlong seconds= ltime.hour*3600L+ltime.minute*60+ltime.second;
|
||||||
|
return seconds2my_decimal(ltime.neg, seconds, ltime.second_part, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1469,27 +1402,6 @@ double Item_temporal_func::val_real()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_temporal_func::get_time(MYSQL_TIME *ltime)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
All temporal functions have a get_date() function which also
|
|
||||||
returns the time.
|
|
||||||
*/
|
|
||||||
if (get_date(ltime, TIME_TIME_ONLY | TIME_FUZZY_DATE |
|
|
||||||
sql_mode_for_dates()))
|
|
||||||
return 1;
|
|
||||||
/* Convert date to time */
|
|
||||||
if (ltime->time_type == MYSQL_TIMESTAMP_DATE ||
|
|
||||||
ltime->time_type == MYSQL_TIMESTAMP_DATETIME)
|
|
||||||
{
|
|
||||||
ltime->year= ltime->month= ltime->day= 0;
|
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
longlong value=args[0]->val_int();
|
longlong value=args[0]->val_int();
|
||||||
@ -1510,7 +1422,7 @@ void Item_func_curdate::fix_length_and_dec()
|
|||||||
ltime.hour= ltime.minute= ltime.second= 0;
|
ltime.hour= ltime.minute= ltime.second= 0;
|
||||||
ltime.time_type= MYSQL_TIMESTAMP_DATE;
|
ltime.time_type= MYSQL_TIMESTAMP_DATE;
|
||||||
Item_datefunc::fix_length_and_dec();
|
Item_datefunc::fix_length_and_dec();
|
||||||
maybe_null= 0;
|
maybe_null= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1679,17 +1591,45 @@ bool Item_func_sysdate_local::get_date(MYSQL_TIME *res,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_sec_to_time::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
bool Item_func_sec_to_time::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
my_decimal tmp_buff, *tmp= args[0]->val_decimal(&tmp_buff);
|
bool sign;
|
||||||
|
ulonglong sec;
|
||||||
|
ulong sec_part;
|
||||||
|
|
||||||
|
bzero((char *)ltime, sizeof(*ltime));
|
||||||
|
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
||||||
|
|
||||||
|
sign= args[0]->get_seconds(&sec, &sec_part);
|
||||||
|
|
||||||
if ((null_value= args[0]->null_value))
|
if ((null_value= args[0]->null_value))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
sec_to_time(tmp, ltime);
|
ltime->neg= sign;
|
||||||
|
if (sec > TIME_MAX_VALUE_SECONDS)
|
||||||
|
goto overflow;
|
||||||
|
|
||||||
|
DBUG_ASSERT(sec_part <= TIME_MAX_SECOND_PART);
|
||||||
|
|
||||||
|
ltime->hour= (uint) (sec/3600);
|
||||||
|
ltime->minute= (uint) (sec % 3600) /60;
|
||||||
|
ltime->second= (uint) sec % 60;
|
||||||
|
ltime->second_part= sec_part;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
overflow:
|
||||||
|
/* use check_time_range() to set ltime to the max value depending on dec */
|
||||||
|
int unused;
|
||||||
|
char buf[100];
|
||||||
|
String tmp(buf, sizeof(buf), &my_charset_bin), *err= args[0]->val_str(&tmp);
|
||||||
|
|
||||||
|
ltime->hour= TIME_MAX_HOUR+1;
|
||||||
|
check_time_range(ltime, decimals, &unused);
|
||||||
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
err->ptr(), err->length(),
|
||||||
|
MYSQL_TIMESTAMP_TIME, NullS);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1880,13 +1820,21 @@ void Item_func_from_unixtime::fix_length_and_dec()
|
|||||||
bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime,
|
bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime,
|
||||||
uint fuzzy_date __attribute__((unused)))
|
uint fuzzy_date __attribute__((unused)))
|
||||||
{
|
{
|
||||||
double tmp= args[0]->val_real();
|
bool sign;
|
||||||
if (args[0]->null_value || tmp < 0 || tmp > TIMESTAMP_MAX_VALUE)
|
ulonglong sec;
|
||||||
|
ulong sec_part;
|
||||||
|
|
||||||
|
bzero((char *)ltime, sizeof(*ltime));
|
||||||
|
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
||||||
|
|
||||||
|
sign= args[0]->get_seconds(&sec, &sec_part);
|
||||||
|
|
||||||
|
if (args[0]->null_value || sign || sec > TIMESTAMP_MAX_VALUE)
|
||||||
return (null_value= 1);
|
return (null_value= 1);
|
||||||
|
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)tmp);
|
thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)sec);
|
||||||
|
|
||||||
ltime->second_part= (ulong)((tmp - floor(tmp))*TIME_SECOND_PART_FACTOR);
|
ltime->second_part= sec_part;
|
||||||
|
|
||||||
return (null_value= 0);
|
return (null_value= 0);
|
||||||
}
|
}
|
||||||
@ -1926,7 +1874,7 @@ bool Item_func_convert_tz::get_date(MYSQL_TIME *ltime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
my_bool not_used;
|
uint not_used;
|
||||||
my_time_tmp= from_tz->TIME_to_gmt_sec(ltime, ¬_used);
|
my_time_tmp= from_tz->TIME_to_gmt_sec(ltime, ¬_used);
|
||||||
ulong sec_part= ltime->second_part;
|
ulong sec_part= ltime->second_part;
|
||||||
/* my_time_tmp is guranteed to be in the allowed range */
|
/* my_time_tmp is guranteed to be in the allowed range */
|
||||||
@ -2186,10 +2134,17 @@ bool Item_char_typecast::eq(const Item *item, bool binary_cmp) const
|
|||||||
|
|
||||||
void Item_temporal_typecast::print(String *str, enum_query_type query_type)
|
void Item_temporal_typecast::print(String *str, enum_query_type query_type)
|
||||||
{
|
{
|
||||||
|
char buf[32];
|
||||||
str->append(STRING_WITH_LEN("cast("));
|
str->append(STRING_WITH_LEN("cast("));
|
||||||
args[0]->print(str, query_type);
|
args[0]->print(str, query_type);
|
||||||
str->append(STRING_WITH_LEN(" as "));
|
str->append(STRING_WITH_LEN(" as "));
|
||||||
str->append(cast_type());
|
str->append(cast_type());
|
||||||
|
if (decimals)
|
||||||
|
{
|
||||||
|
str->append('(');
|
||||||
|
str->append(llstr(decimals, buf));
|
||||||
|
str->append(')');
|
||||||
|
}
|
||||||
str->append(')');
|
str->append(')');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2347,6 +2302,8 @@ bool Item_time_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
|||||||
{
|
{
|
||||||
if (get_arg0_time(ltime))
|
if (get_arg0_time(ltime))
|
||||||
return 1;
|
return 1;
|
||||||
|
if (decimals < TIME_SECOND_PART_DIGITS)
|
||||||
|
ltime->second_part= sec_part_truncate(ltime->second_part, decimals);
|
||||||
/*
|
/*
|
||||||
MYSQL_TIMESTAMP_TIME value can have non-zero day part,
|
MYSQL_TIMESTAMP_TIME value can have non-zero day part,
|
||||||
which we should not lose.
|
which we should not lose.
|
||||||
@ -2373,16 +2330,28 @@ bool Item_datetime_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
|||||||
if (get_arg0_date(ltime, fuzzy_date & ~TIME_TIME_ONLY))
|
if (get_arg0_date(ltime, fuzzy_date & ~TIME_TIME_ONLY))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (decimals < TIME_SECOND_PART_DIGITS)
|
||||||
|
ltime->second_part= sec_part_truncate(ltime->second_part, decimals);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ltime is valid MYSQL_TYPE_TIME (according to fuzzy_date).
|
ltime is valid MYSQL_TYPE_TIME (according to fuzzy_date).
|
||||||
But not every valid TIME value is a valid DATETIME value!
|
But not every valid TIME value is a valid DATETIME value!
|
||||||
*/
|
*/
|
||||||
if (ltime->time_type == MYSQL_TIMESTAMP_TIME && ltime->hour >= 24)
|
if (ltime->time_type == MYSQL_TIMESTAMP_TIME)
|
||||||
{
|
{
|
||||||
Lazy_string_time str(ltime);
|
if (ltime->neg)
|
||||||
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
{
|
||||||
&str, MYSQL_TIMESTAMP_DATETIME, 0);
|
Lazy_string_time str(ltime);
|
||||||
return (null_value= 1);
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
&str, MYSQL_TIMESTAMP_DATETIME, 0);
|
||||||
|
return (null_value= 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint day= ltime->hour/24;
|
||||||
|
ltime->hour %= 24;
|
||||||
|
ltime->month= day / 31;
|
||||||
|
ltime->day= day % 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_DATETIME;
|
ltime->time_type= MYSQL_TIMESTAMP_DATETIME;
|
||||||
@ -2703,7 +2672,7 @@ longlong Item_func_microsecond::val_int()
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (!get_arg0_time(<ime))
|
if (!get_arg0_date(<ime, TIME_FUZZY_DATE))
|
||||||
return ltime.second_part;
|
return ltime.second_part;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -367,12 +367,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (arg_count)
|
if (arg_count)
|
||||||
decimals= args[0]->decimals;
|
decimals= args[0]->decimals;
|
||||||
if (decimals != NOT_FIXED_DEC)
|
set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
|
||||||
set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
|
|
||||||
max_length=17 + (decimals ? decimals + 1 : 0);
|
max_length=17 + (decimals ? decimals + 1 : 0);
|
||||||
}
|
}
|
||||||
void find_num_type() { hybrid_type= decimals ? REAL_RESULT : INT_RESULT; }
|
void find_num_type() { hybrid_type= decimals ? DECIMAL_RESULT : INT_RESULT; }
|
||||||
my_decimal *decimal_op(my_decimal* buf) { DBUG_ASSERT(0); return 0; }
|
double real_op() { DBUG_ASSERT(0); return 0; }
|
||||||
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
|
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -408,7 +407,7 @@ public:
|
|||||||
return trace_unsupported_by_check_vcol_func_processor(func_name());
|
return trace_unsupported_by_check_vcol_func_processor(func_name());
|
||||||
}
|
}
|
||||||
longlong int_op();
|
longlong int_op();
|
||||||
double real_op();
|
my_decimal *decimal_op(my_decimal* buf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -430,7 +429,7 @@ public:
|
|||||||
return !has_time_args();
|
return !has_time_args();
|
||||||
}
|
}
|
||||||
longlong int_op();
|
longlong int_op();
|
||||||
double real_op();
|
my_decimal *decimal_op(my_decimal* buf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -447,7 +446,6 @@ public:
|
|||||||
longlong val_int();
|
longlong val_int();
|
||||||
double val_real();
|
double val_real();
|
||||||
bool get_date(MYSQL_TIME *res, uint fuzzy_date) { DBUG_ASSERT(0); return 1; }
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date) { DBUG_ASSERT(0); return 1; }
|
||||||
bool get_time(MYSQL_TIME *res);
|
|
||||||
my_decimal *val_decimal(my_decimal *decimal_value)
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
||||||
{ return val_decimal_from_date(decimal_value); }
|
{ return val_decimal_from_date(decimal_value); }
|
||||||
Field *tmp_table_field(TABLE *table)
|
Field *tmp_table_field(TABLE *table)
|
||||||
@ -460,6 +458,7 @@ public:
|
|||||||
{ MAX_DATETIME_WIDTH, MAX_DATETIME_WIDTH, MAX_DATE_WIDTH,
|
{ MAX_DATETIME_WIDTH, MAX_DATETIME_WIDTH, MAX_DATE_WIDTH,
|
||||||
MAX_DATETIME_WIDTH, MIN_TIME_WIDTH };
|
MAX_DATETIME_WIDTH, MIN_TIME_WIDTH };
|
||||||
|
|
||||||
|
maybe_null= true;
|
||||||
max_length= max_time_type_width[mysql_type_to_time_type(field_type())+2];
|
max_length= max_time_type_width[mysql_type_to_time_type(field_type())+2];
|
||||||
if (decimals)
|
if (decimals)
|
||||||
{
|
{
|
||||||
@ -486,9 +485,6 @@ public:
|
|||||||
Item_datefunc() :Item_temporal_func() { }
|
Item_datefunc() :Item_temporal_func() { }
|
||||||
Item_datefunc(Item *a) :Item_temporal_func(a) { }
|
Item_datefunc(Item *a) :Item_temporal_func(a) { }
|
||||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||||
const char *func_name() const { return "date"; }
|
|
||||||
bool get_date(MYSQL_TIME *res, uint fuzzy_date)
|
|
||||||
{ return get_arg0_date(res, fuzzy_date); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -515,7 +511,7 @@ public:
|
|||||||
{
|
{
|
||||||
store_now_in_TIME(<ime);
|
store_now_in_TIME(<ime);
|
||||||
Item_timefunc::fix_length_and_dec();
|
Item_timefunc::fix_length_and_dec();
|
||||||
maybe_null= 0;
|
maybe_null= false;
|
||||||
}
|
}
|
||||||
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
/*
|
/*
|
||||||
@ -597,7 +593,7 @@ public:
|
|||||||
{
|
{
|
||||||
store_now_in_TIME(<ime);
|
store_now_in_TIME(<ime);
|
||||||
Item_temporal_func::fix_length_and_dec();
|
Item_temporal_func::fix_length_and_dec();
|
||||||
maybe_null= 0;
|
maybe_null= false;
|
||||||
}
|
}
|
||||||
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
|
||||||
@ -726,7 +722,6 @@ class Item_func_convert_tz :public Item_temporal_func
|
|||||||
|
|
||||||
class Item_func_sec_to_time :public Item_timefunc
|
class Item_func_sec_to_time :public Item_timefunc
|
||||||
{
|
{
|
||||||
bool sec_to_time(my_decimal *seconds, MYSQL_TIME *ltime);
|
|
||||||
public:
|
public:
|
||||||
Item_func_sec_to_time(Item *item) :Item_timefunc(item) {}
|
Item_func_sec_to_time(Item *item) :Item_timefunc(item) {}
|
||||||
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
|
@ -640,11 +640,11 @@ bool Log_to_csv_event_handler::
|
|||||||
|
|
||||||
/* fill in query_time field */
|
/* fill in query_time field */
|
||||||
calc_time_from_sec(&t, query_time, query_time_micro);
|
calc_time_from_sec(&t, query_time, query_time_micro);
|
||||||
if (table->field[2]->store_time(&t, MYSQL_TIMESTAMP_TIME))
|
if (table->field[2]->store_time(&t))
|
||||||
goto err;
|
goto err;
|
||||||
/* lock_time */
|
/* lock_time */
|
||||||
calc_time_from_sec(&t, lock_time, lock_time_micro);
|
calc_time_from_sec(&t, lock_time, lock_time_micro);
|
||||||
if (table->field[3]->store_time(&t, MYSQL_TIMESTAMP_TIME))
|
if (table->field[3]->store_time(&t))
|
||||||
goto err;
|
goto err;
|
||||||
/* rows_sent */
|
/* rows_sent */
|
||||||
if (table->field[4]->store((longlong) thd->sent_row_count, TRUE))
|
if (table->field[4]->store((longlong) thd->sent_row_count, TRUE))
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#define DIG_BASE 1000000000
|
||||||
|
#define DIG_PER_DEC1 9
|
||||||
|
#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
|
||||||
|
|
||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
/**
|
/**
|
||||||
@ -207,20 +211,69 @@ int str2my_decimal(uint mask, const char *from, uint length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
converts a decimal into a pair of integers - for integer and fractional parts
|
||||||
|
|
||||||
|
special version, for decimals representing number of seconds.
|
||||||
|
integer part cannot be larger that 1e18 (otherwise it's an overflow).
|
||||||
|
fractional part is microseconds.
|
||||||
|
*/
|
||||||
|
bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec)
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
|
||||||
|
if (d->intg)
|
||||||
|
{
|
||||||
|
pos= (d->intg-1)/DIG_PER_DEC1;
|
||||||
|
*sec= d->buf[pos];
|
||||||
|
if (pos > 0)
|
||||||
|
*sec+= static_cast<longlong>(d->buf[pos-1]) * DIG_BASE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*sec=0;
|
||||||
|
pos= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*microsec= d->frac ? static_cast<longlong>(d->buf[pos+1]) / (DIG_BASE/1000000) : 0;
|
||||||
|
|
||||||
|
if (pos > 1)
|
||||||
|
{
|
||||||
|
for (int i=0; i < pos-1; i++)
|
||||||
|
if (d->buf[i])
|
||||||
|
{
|
||||||
|
*sec= LONGLONG_MAX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d->sign();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
converts a pair of integers (seconds, microseconds) into a decimal
|
||||||
|
*/
|
||||||
|
my_decimal *seconds2my_decimal(bool sign,
|
||||||
|
ulonglong sec, ulong microsec, my_decimal *d)
|
||||||
|
{
|
||||||
|
d->init();
|
||||||
|
longlong2decimal(sec, d); // cannot fail
|
||||||
|
if (microsec)
|
||||||
|
{
|
||||||
|
d->buf[(d->intg-1) / DIG_PER_DEC1 + 1]= microsec * (DIG_BASE/1000000);
|
||||||
|
d->frac= 6;
|
||||||
|
}
|
||||||
|
((decimal_t *)d)->sign= sign;
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec)
|
my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec)
|
||||||
{
|
{
|
||||||
longlong date;
|
longlong date= (ltime->year*100L + ltime->month)*100L + ltime->day;
|
||||||
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
|
|
||||||
if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
|
if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
|
||||||
date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
|
date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
|
||||||
if (int2my_decimal(E_DEC_FATAL_ERROR, ltime->neg ? -date : date, FALSE, dec))
|
return seconds2my_decimal(ltime->neg, date, ltime->second_part, dec);
|
||||||
return dec;
|
|
||||||
if (ltime->second_part)
|
|
||||||
{
|
|
||||||
dec->buf[(dec->intg-1) / 9 + 1]= ltime->second_part * 1000;
|
|
||||||
dec->frac= 6;
|
|
||||||
}
|
|
||||||
return dec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -236,7 +289,7 @@ void my_decimal_trim(ulong *precision, uint *scale)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a decimal to an ulong with a descreptive error message
|
Convert a decimal to an ulong with a descriptive error message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag,
|
int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag,
|
||||||
@ -266,9 +319,6 @@ int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag,
|
|||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
/* routines for debugging print */
|
/* routines for debugging print */
|
||||||
|
|
||||||
#define DIG_PER_DEC1 9
|
|
||||||
#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
|
|
||||||
|
|
||||||
/* print decimal */
|
/* print decimal */
|
||||||
void
|
void
|
||||||
print_decimal(const my_decimal *dec)
|
print_decimal(const my_decimal *dec)
|
||||||
|
@ -270,6 +270,11 @@ int my_decimal2string(uint mask, const my_decimal *d, uint fixed_prec,
|
|||||||
uint fixed_dec, char filler, String *str);
|
uint fixed_dec, char filler, String *str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec);
|
||||||
|
|
||||||
|
my_decimal *seconds2my_decimal(bool sign, ulonglong sec, ulong microsec,
|
||||||
|
my_decimal *d);
|
||||||
|
|
||||||
int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag,
|
int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag,
|
||||||
longlong *l);
|
longlong *l);
|
||||||
|
|
||||||
|
@ -883,17 +883,14 @@ public:
|
|||||||
void copy_to(String *dst) const { dst->set(num, &my_charset_bin); }
|
void copy_to(String *dst) const { dst->set(num, &my_charset_bin); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Lazy_string_decimal : public Lazy_string
|
class Lazy_string_decimal: public Lazy_string
|
||||||
{
|
{
|
||||||
my_decimal num;
|
const my_decimal *d;
|
||||||
public:
|
public:
|
||||||
Lazy_string_decimal(my_decimal num_arg) : Lazy_string(), num(num_arg)
|
Lazy_string_decimal(const my_decimal *d_arg)
|
||||||
{
|
: Lazy_string(), d(d_arg) {}
|
||||||
num.fix_buffer_pointer();
|
void copy_to(String *dst) const {
|
||||||
}
|
my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, ' ', dst);
|
||||||
void copy_to(String *dst) const
|
|
||||||
{
|
|
||||||
my_decimal2string(E_DEC_FATAL_ERROR, &num, 0, 0, '0', dst);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2082,6 +2079,7 @@ void flush_thread_cache();
|
|||||||
/* item_func.cc */
|
/* item_func.cc */
|
||||||
extern bool check_reserved_words(LEX_STRING *name);
|
extern bool check_reserved_words(LEX_STRING *name);
|
||||||
extern enum_field_types agg_field_type(Item **items, uint nitems);
|
extern enum_field_types agg_field_type(Item **items, uint nitems);
|
||||||
|
Item *find_date_time_item(Item **args, uint nargs, uint col);
|
||||||
|
|
||||||
/* strfunc.cc */
|
/* strfunc.cc */
|
||||||
ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
|
ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
|
||||||
@ -2475,9 +2473,11 @@ void make_truncated_value_warning(THD *thd,
|
|||||||
timestamp_type time_type,
|
timestamp_type time_type,
|
||||||
const char *field_name);
|
const char *field_name);
|
||||||
bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
|
bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
|
||||||
ulong fuzzy_date);
|
ulong fuzzydate, const char *field_name);
|
||||||
bool decimal_to_datetime_with_warn(decimal_t *value, MYSQL_TIME *ltime,
|
bool decimal_to_datetime_with_warn(const my_decimal *value, MYSQL_TIME *ltime,
|
||||||
ulong fuzzy_date);
|
ulong fuzzydate, const char *field_name);
|
||||||
|
bool int_to_datetime_with_warn(longlong value, MYSQL_TIME *ltime,
|
||||||
|
ulong fuzzydate, const char *field_name);
|
||||||
|
|
||||||
static inline void make_truncated_value_warning(THD *thd,
|
static inline void make_truncated_value_warning(THD *thd,
|
||||||
MYSQL_ERROR::enum_warning_level level, const char *str_val,
|
MYSQL_ERROR::enum_warning_level level, const char *str_val,
|
||||||
|
@ -2900,14 +2900,20 @@ int set_var_collation_client::update(THD *thd)
|
|||||||
|
|
||||||
bool sys_var_timestamp::check(THD *thd, set_var *var)
|
bool sys_var_timestamp::check(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
double val= var->value->val_real();
|
ulonglong sec;
|
||||||
if (val < 0 || val > MY_TIME_T_MAX)
|
ulong sec_part;
|
||||||
|
char buf[64], *errval= 0;
|
||||||
|
if (var->value->get_seconds(&sec, &sec_part))
|
||||||
|
errval= llstr(sec, buf);
|
||||||
|
else if (sec > TIMESTAMP_MAX_VALUE)
|
||||||
|
errval= ullstr(sec, buf);
|
||||||
|
|
||||||
|
if (errval)
|
||||||
{
|
{
|
||||||
char buf[64];
|
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "timestamp", errval);
|
||||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "timestamp", llstr((longlong)val, buf));
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
var->save_result.ulonglong_value= hrtime_from_time(val);
|
var->save_result.ulonglong_value= hrtime_from_time(sec)+sec_part;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2281,11 +2281,7 @@ mysql_execute_command(THD *thd)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
it= new Item_func_unix_timestamp(it);
|
it= new Item_func_unix_timestamp(it);
|
||||||
/*
|
it->fix_fields(thd, &it);
|
||||||
it is OK only emulate fix_fieds, because we need only
|
|
||||||
value of constant
|
|
||||||
*/
|
|
||||||
it->quick_fix_field();
|
|
||||||
res = purge_master_logs_before_date(thd, (ulong)it->val_int());
|
res = purge_master_logs_before_date(thd, (ulong)it->val_int());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -16100,7 +16100,7 @@ bool test_if_ref(Item *root_cond, Item_field *left_item,Item *right_item)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We can remove binary fields and numerical fields except float,
|
We can remove binary fields and numerical fields except float,
|
||||||
as float comparison isn't 100 % secure
|
as float comparison isn't 100 % safe
|
||||||
We have to keep normal strings to be able to check for end spaces
|
We have to keep normal strings to be able to check for end spaces
|
||||||
*/
|
*/
|
||||||
if (field->binary() &&
|
if (field->binary() &&
|
||||||
|
@ -4224,21 +4224,21 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
|||||||
{
|
{
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
||||||
(my_time_t) file->stats.create_time);
|
(my_time_t) file->stats.create_time);
|
||||||
table->field[14]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[14]->store_time(&time);
|
||||||
table->field[14]->set_notnull();
|
table->field[14]->set_notnull();
|
||||||
}
|
}
|
||||||
if (file->stats.update_time)
|
if (file->stats.update_time)
|
||||||
{
|
{
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
||||||
(my_time_t) file->stats.update_time);
|
(my_time_t) file->stats.update_time);
|
||||||
table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[15]->store_time(&time);
|
||||||
table->field[15]->set_notnull();
|
table->field[15]->set_notnull();
|
||||||
}
|
}
|
||||||
if (file->stats.check_time)
|
if (file->stats.check_time)
|
||||||
{
|
{
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
||||||
(my_time_t) file->stats.check_time);
|
(my_time_t) file->stats.check_time);
|
||||||
table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[16]->store_time(&time);
|
||||||
table->field[16]->set_notnull();
|
table->field[16]->set_notnull();
|
||||||
}
|
}
|
||||||
if (file->ha_table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM))
|
if (file->ha_table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM))
|
||||||
@ -4732,10 +4732,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
|
|||||||
|
|
||||||
bzero((char *)&time, sizeof(time));
|
bzero((char *)&time, sizeof(time));
|
||||||
((Field_timestamp *) proc_table->field[12])->get_time(&time);
|
((Field_timestamp *) proc_table->field[12])->get_time(&time);
|
||||||
table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[15]->store_time(&time);
|
||||||
bzero((char *)&time, sizeof(time));
|
bzero((char *)&time, sizeof(time));
|
||||||
((Field_timestamp *) proc_table->field[13])->get_time(&time);
|
((Field_timestamp *) proc_table->field[13])->get_time(&time);
|
||||||
table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[16]->store_time(&time);
|
||||||
copy_field_as_string(table->field[17], proc_table->field[14]);
|
copy_field_as_string(table->field[17], proc_table->field[14]);
|
||||||
copy_field_as_string(table->field[18], proc_table->field[15]);
|
copy_field_as_string(table->field[18], proc_table->field[15]);
|
||||||
table->field[19]->store(definer.ptr(), definer.length(), cs);
|
table->field[19]->store(definer.ptr(), definer.length(), cs);
|
||||||
@ -5364,21 +5364,21 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
|
|||||||
{
|
{
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
||||||
(my_time_t)stat_info.create_time);
|
(my_time_t)stat_info.create_time);
|
||||||
table->field[18]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[18]->store_time(&time);
|
||||||
table->field[18]->set_notnull();
|
table->field[18]->set_notnull();
|
||||||
}
|
}
|
||||||
if (stat_info.update_time)
|
if (stat_info.update_time)
|
||||||
{
|
{
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
||||||
(my_time_t)stat_info.update_time);
|
(my_time_t)stat_info.update_time);
|
||||||
table->field[19]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[19]->store_time(&time);
|
||||||
table->field[19]->set_notnull();
|
table->field[19]->set_notnull();
|
||||||
}
|
}
|
||||||
if (stat_info.check_time)
|
if (stat_info.check_time)
|
||||||
{
|
{
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
thd->variables.time_zone->gmt_sec_to_TIME(&time,
|
||||||
(my_time_t)stat_info.check_time);
|
(my_time_t)stat_info.check_time);
|
||||||
table->field[20]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
table->field[20]->store_time(&time);
|
||||||
table->field[20]->set_notnull();
|
table->field[20]->set_notnull();
|
||||||
}
|
}
|
||||||
if (file->ha_table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM))
|
if (file->ha_table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM))
|
||||||
@ -5759,15 +5759,13 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
|
|||||||
/* starts & ends . STARTS is always set - see sql_yacc.yy */
|
/* starts & ends . STARTS is always set - see sql_yacc.yy */
|
||||||
et.time_zone->gmt_sec_to_TIME(&time, et.starts);
|
et.time_zone->gmt_sec_to_TIME(&time, et.starts);
|
||||||
sch_table->field[ISE_STARTS]->set_notnull();
|
sch_table->field[ISE_STARTS]->set_notnull();
|
||||||
sch_table->field[ISE_STARTS]->
|
sch_table->field[ISE_STARTS]->store_time(&time);
|
||||||
store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
|
|
||||||
if (!et.ends_null)
|
if (!et.ends_null)
|
||||||
{
|
{
|
||||||
et.time_zone->gmt_sec_to_TIME(&time, et.ends);
|
et.time_zone->gmt_sec_to_TIME(&time, et.ends);
|
||||||
sch_table->field[ISE_ENDS]->set_notnull();
|
sch_table->field[ISE_ENDS]->set_notnull();
|
||||||
sch_table->field[ISE_ENDS]->
|
sch_table->field[ISE_ENDS]->store_time(&time);
|
||||||
store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5777,8 +5775,7 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
|
|||||||
|
|
||||||
et.time_zone->gmt_sec_to_TIME(&time, et.execute_at);
|
et.time_zone->gmt_sec_to_TIME(&time, et.execute_at);
|
||||||
sch_table->field[ISE_EXECUTE_AT]->set_notnull();
|
sch_table->field[ISE_EXECUTE_AT]->set_notnull();
|
||||||
sch_table->field[ISE_EXECUTE_AT]->
|
sch_table->field[ISE_EXECUTE_AT]->store_time(&time);
|
||||||
store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* status */
|
/* status */
|
||||||
@ -5808,21 +5805,19 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
|
|||||||
sch_table->field[ISE_ON_COMPLETION]->
|
sch_table->field[ISE_ON_COMPLETION]->
|
||||||
store(STRING_WITH_LEN("PRESERVE"), scs);
|
store(STRING_WITH_LEN("PRESERVE"), scs);
|
||||||
|
|
||||||
number_to_datetime(et.created, &time, 0, ¬_used);
|
number_to_datetime(et.created, 0, &time, 0, ¬_used);
|
||||||
DBUG_ASSERT(not_used==0);
|
DBUG_ASSERT(not_used==0);
|
||||||
sch_table->field[ISE_CREATED]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
sch_table->field[ISE_CREATED]->store_time(&time);
|
||||||
|
|
||||||
number_to_datetime(et.modified, &time, 0, ¬_used);
|
number_to_datetime(et.modified, 0, &time, 0, ¬_used);
|
||||||
DBUG_ASSERT(not_used==0);
|
DBUG_ASSERT(not_used==0);
|
||||||
sch_table->field[ISE_LAST_ALTERED]->
|
sch_table->field[ISE_LAST_ALTERED]->store_time(&time);
|
||||||
store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
|
|
||||||
if (et.last_executed)
|
if (et.last_executed)
|
||||||
{
|
{
|
||||||
et.time_zone->gmt_sec_to_TIME(&time, et.last_executed);
|
et.time_zone->gmt_sec_to_TIME(&time, et.last_executed);
|
||||||
sch_table->field[ISE_LAST_EXECUTED]->set_notnull();
|
sch_table->field[ISE_LAST_EXECUTED]->set_notnull();
|
||||||
sch_table->field[ISE_LAST_EXECUTED]->
|
sch_table->field[ISE_LAST_EXECUTED]->store_time(&time);
|
||||||
store_time(&time, MYSQL_TIMESTAMP_DATETIME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sch_table->field[ISE_EVENT_COMMENT]->
|
sch_table->field[ISE_EVENT_COMMENT]->
|
||||||
|
149
sql/time.cc
149
sql/time.cc
@ -241,32 +241,92 @@ str_to_datetime_with_warn(const char *str, uint length, MYSQL_TIME *l_time,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
|
/**
|
||||||
ulong fuzzydate)
|
converts a pair of numbers (integer part, microseconds) to MYSQL_TIME
|
||||||
|
|
||||||
|
@param neg sign of the time value
|
||||||
|
@param nr integer part of the number to convert
|
||||||
|
@param sec_part microsecond part of the number
|
||||||
|
@param ltime converted value will be written here
|
||||||
|
@param fuzzydate conversion flags (TIME_FUZZY_DATE, etc)
|
||||||
|
@param str original number, as a Lazy_string. For the warning
|
||||||
|
@param field_name field name or NULL if not a field. For the warning
|
||||||
|
|
||||||
|
@returns 0 for success, 1 for a failure
|
||||||
|
*/
|
||||||
|
static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
|
||||||
|
MYSQL_TIME *ltime, ulong fuzzydate,
|
||||||
|
const Lazy_string *str,
|
||||||
|
const char *field_name)
|
||||||
{
|
{
|
||||||
if (double_to_datetime(value, ltime, fuzzydate))
|
int was_cut;
|
||||||
|
longlong res;
|
||||||
|
enum_field_types f_type;
|
||||||
|
|
||||||
|
if (fuzzydate & TIME_TIME_ONLY)
|
||||||
{
|
{
|
||||||
char buff[40];
|
f_type= MYSQL_TYPE_TIME;
|
||||||
uint length= my_sprintf(buff, (buff, "%-30.21g", value));
|
res= number_to_time(neg, nr, sec_part, ltime, &was_cut);
|
||||||
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
buff, length, MYSQL_TIMESTAMP_DATETIME,
|
|
||||||
NullS);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
else
|
||||||
|
{
|
||||||
|
f_type= MYSQL_TYPE_DATETIME;
|
||||||
|
res= number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((was_cut && !(fuzzydate & TIME_FUZZY_DATE)) || res < 0)
|
||||||
|
{
|
||||||
|
make_truncated_value_warning(current_thd,
|
||||||
|
MYSQL_ERROR::WARN_LEVEL_WARN, str,
|
||||||
|
res < 0 ? MYSQL_TIMESTAMP_ERROR
|
||||||
|
: mysql_type_to_time_type(f_type),
|
||||||
|
field_name);
|
||||||
|
}
|
||||||
|
return res < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool decimal_to_datetime_with_warn(decimal_t *value, MYSQL_TIME *ltime,
|
|
||||||
ulong fuzzydate)
|
bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
|
||||||
|
ulong fuzzydate, const char *field_name)
|
||||||
{
|
{
|
||||||
char buff[40];
|
const Lazy_string_double str(value);
|
||||||
int length= sizeof(buff);
|
ulonglong nr;
|
||||||
|
ulong sec_part;
|
||||||
|
bool neg= value < 0;
|
||||||
|
|
||||||
decimal2string(value, buff, &length, 0, 0, 0);
|
if (neg)
|
||||||
return (str_to_datetime_with_warn(buff, length, ltime, fuzzydate) <=
|
value= -value;
|
||||||
MYSQL_TIMESTAMP_ERROR);
|
|
||||||
|
nr = value > LONGLONG_MAX ? LONGLONG_MAX
|
||||||
|
: static_cast<ulonglong>(trunc(value));
|
||||||
|
sec_part= (ulong)((value - nr)*TIME_SECOND_PART_FACTOR);
|
||||||
|
return number_to_time_with_warn(neg, nr, sec_part, ltime, fuzzydate, &str,
|
||||||
|
field_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool decimal_to_datetime_with_warn(const my_decimal *value, MYSQL_TIME *ltime,
|
||||||
|
ulong fuzzydate, const char *field_name)
|
||||||
|
{
|
||||||
|
const Lazy_string_decimal str(value);
|
||||||
|
ulonglong nr;
|
||||||
|
ulong sec_part;
|
||||||
|
bool neg= my_decimal2seconds(value, &nr, &sec_part);
|
||||||
|
return number_to_time_with_warn(neg, nr, sec_part, ltime, fuzzydate, &str,
|
||||||
|
field_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool int_to_datetime_with_warn(longlong value, MYSQL_TIME *ltime,
|
||||||
|
ulong fuzzydate, const char *field_name)
|
||||||
|
{
|
||||||
|
const Lazy_string_num str(value);
|
||||||
|
bool neg= value < 0;
|
||||||
|
return number_to_time_with_warn(neg, neg ? -value : value, 0, ltime,
|
||||||
|
fuzzydate, &str, field_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a datetime from broken-down MYSQL_TIME representation to
|
Convert a datetime from broken-down MYSQL_TIME representation to
|
||||||
corresponding TIMESTAMP value.
|
corresponding TIMESTAMP value.
|
||||||
@ -288,25 +348,8 @@ bool decimal_to_datetime_with_warn(decimal_t *value, MYSQL_TIME *ltime,
|
|||||||
|
|
||||||
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code)
|
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code)
|
||||||
{
|
{
|
||||||
my_time_t timestamp;
|
|
||||||
my_bool in_dst_time_gap= 0;
|
|
||||||
|
|
||||||
*error_code= 0;
|
|
||||||
thd->time_zone_used= 1;
|
thd->time_zone_used= 1;
|
||||||
|
return thd->variables.time_zone->TIME_to_gmt_sec(t, error_code);
|
||||||
timestamp= thd->variables.time_zone->TIME_to_gmt_sec(t, &in_dst_time_gap);
|
|
||||||
|
|
||||||
/* In case of error, timestamp == 0 and in_dst_time_gap is != 0 */
|
|
||||||
if (timestamp || ! in_dst_time_gap)
|
|
||||||
{
|
|
||||||
if (in_dst_time_gap)
|
|
||||||
*error_code= ER_WARN_INVALID_TIMESTAMP;
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we are here we have range error. */
|
|
||||||
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -697,11 +740,6 @@ KNOWN_DATE_TIME_FORMAT known_date_time_formats[6]=
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return format string according format name.
|
|
||||||
If name is unknown, result is NULL
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
|
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
|
||||||
timestamp_type type)
|
timestamp_type type)
|
||||||
{
|
{
|
||||||
@ -812,6 +850,7 @@ void make_truncated_value_warning(THD *thd,
|
|||||||
(((((X)->day * 24LL + (X)->hour) * 60LL + \
|
(((((X)->day * 24LL + (X)->hour) * 60LL + \
|
||||||
(X)->minute) * 60LL + (X)->second)*1000000LL + \
|
(X)->minute) * 60LL + (X)->second)*1000000LL + \
|
||||||
(X)->second_part)
|
(X)->second_part)
|
||||||
|
#define GET_PART(X, N) X % N ## LL; X/= N ## LL
|
||||||
|
|
||||||
bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
|
bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
|
||||||
INTERVAL interval)
|
INTERVAL interval)
|
||||||
@ -838,7 +877,7 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
|
|||||||
case INTERVAL_DAY:
|
case INTERVAL_DAY:
|
||||||
{
|
{
|
||||||
longlong usec, daynr;
|
longlong usec, daynr;
|
||||||
my_bool neg= ltime->neg;
|
my_bool neg= 0;
|
||||||
enum enum_mysql_timestamp_type time_type= ltime->time_type;
|
enum enum_mysql_timestamp_type time_type= ltime->time_type;
|
||||||
|
|
||||||
if (time_type != MYSQL_TIMESTAMP_TIME)
|
if (time_type != MYSQL_TIMESTAMP_TIME)
|
||||||
@ -846,17 +885,31 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
|
|||||||
|
|
||||||
usec= COMBINE(ltime) + sign*COMBINE(&interval);
|
usec= COMBINE(ltime) + sign*COMBINE(&interval);
|
||||||
|
|
||||||
unpack_time(usec, ltime);
|
if (usec < 0)
|
||||||
ltime->time_type= time_type;
|
{
|
||||||
|
neg= 1;
|
||||||
|
usec= -usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
ltime->second_part= GET_PART(usec, 1000000);
|
||||||
|
ltime->second= GET_PART(usec, 60);
|
||||||
|
ltime->minute= GET_PART(usec, 60);
|
||||||
ltime->neg^= neg;
|
ltime->neg^= neg;
|
||||||
|
|
||||||
if (time_type == MYSQL_TIMESTAMP_TIME)
|
if (time_type == MYSQL_TIMESTAMP_TIME)
|
||||||
break;
|
{
|
||||||
|
if (usec > TIME_MAX_HOUR)
|
||||||
|
goto invalid_date;
|
||||||
|
ltime->hour= usec;
|
||||||
|
ltime->day= 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (int_type != INTERVAL_DAY)
|
if (int_type != INTERVAL_DAY)
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_DATETIME; // Return full date
|
ltime->time_type= MYSQL_TIMESTAMP_DATETIME; // Return full date
|
||||||
|
|
||||||
daynr= usec/1000000/24/60/60;
|
ltime->hour= GET_PART(usec, 24);
|
||||||
|
daynr= usec;
|
||||||
|
|
||||||
/* Day number from year 0 to 9999-12-31 */
|
/* Day number from year 0 to 9999-12-31 */
|
||||||
if ((ulonglong) daynr > MAX_DAY_NUMBER)
|
if ((ulonglong) daynr > MAX_DAY_NUMBER)
|
||||||
@ -902,13 +955,15 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
|
|||||||
goto null_date;
|
goto null_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; // Ok
|
if (ltime->time_type != MYSQL_TIMESTAMP_TIME)
|
||||||
|
return 0; // Ok
|
||||||
|
|
||||||
invalid_date:
|
invalid_date:
|
||||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_DATETIME_FUNCTION_OVERFLOW,
|
ER_DATETIME_FUNCTION_OVERFLOW,
|
||||||
ER(ER_DATETIME_FUNCTION_OVERFLOW),
|
ER(ER_DATETIME_FUNCTION_OVERFLOW),
|
||||||
"datetime");
|
ltime->time_type == MYSQL_TIMESTAMP_TIME ?
|
||||||
|
"time" : "datetime");
|
||||||
null_date:
|
null_date:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -815,9 +815,11 @@ sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
|
|||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to structure for broken down represenatation
|
t - pointer to structure for broken down represenatation
|
||||||
sp - pointer to struct with time zone description
|
sp - pointer to struct with time zone description
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
error_code - 0, if the conversion was successful;
|
||||||
value passed doesn't really exist (i.e. falls into
|
ER_WARN_DATA_OUT_OF_RANGE, if t contains datetime value
|
||||||
spring time-gap) and is not touched otherwise.
|
which is out of TIMESTAMP range;
|
||||||
|
ER_WARN_INVALID_TIMESTAMP, if t represents value which
|
||||||
|
doesn't exists (falls into the spring time-gap).
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This is mktime analog for MySQL. It is essentially different
|
This is mktime analog for MySQL. It is essentially different
|
||||||
@ -877,12 +879,11 @@ sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
|
|||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
Seconds in UTC since Epoch.
|
Seconds in UTC since Epoch.
|
||||||
0 in case of error. In this case *in_dst_time_gap is also set
|
0 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static my_time_t
|
static my_time_t
|
||||||
TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp, uint *error_code)
|
||||||
my_bool *in_dst_time_gap)
|
|
||||||
{
|
{
|
||||||
my_time_t local_t;
|
my_time_t local_t;
|
||||||
uint saved_seconds;
|
uint saved_seconds;
|
||||||
@ -890,13 +891,14 @@ TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
|||||||
int shift= 0;
|
int shift= 0;
|
||||||
DBUG_ENTER("TIME_to_gmt_sec");
|
DBUG_ENTER("TIME_to_gmt_sec");
|
||||||
|
|
||||||
*in_dst_time_gap= 0;
|
|
||||||
if (!validate_timestamp_range(t))
|
if (!validate_timestamp_range(t))
|
||||||
{
|
{
|
||||||
*in_dst_time_gap= 1; // Mark error
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*error_code= 0;
|
||||||
|
|
||||||
/* We need this for correct leap seconds handling */
|
/* We need this for correct leap seconds handling */
|
||||||
if (t->second < SECS_PER_MIN)
|
if (t->second < SECS_PER_MIN)
|
||||||
saved_seconds= 0;
|
saved_seconds= 0;
|
||||||
@ -939,7 +941,7 @@ TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
|||||||
This means that source time can't be represented as my_time_t due to
|
This means that source time can't be represented as my_time_t due to
|
||||||
limited my_time_t range.
|
limited my_time_t range.
|
||||||
*/
|
*/
|
||||||
*in_dst_time_gap= 1; // Mark error
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -956,7 +958,7 @@ TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
|||||||
if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift * SECS_PER_DAY +
|
if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift * SECS_PER_DAY +
|
||||||
sp->revtis[i].rt_offset - saved_seconds))
|
sp->revtis[i].rt_offset - saved_seconds))
|
||||||
{
|
{
|
||||||
*in_dst_time_gap= 1; // Mark error
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
DBUG_RETURN(0); /* my_time_t overflow */
|
DBUG_RETURN(0); /* my_time_t overflow */
|
||||||
}
|
}
|
||||||
local_t+= shift * SECS_PER_DAY;
|
local_t+= shift * SECS_PER_DAY;
|
||||||
@ -970,7 +972,7 @@ TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
|||||||
Now we are returning my_time_t value corresponding to the
|
Now we are returning my_time_t value corresponding to the
|
||||||
beginning of the gap.
|
beginning of the gap.
|
||||||
*/
|
*/
|
||||||
*in_dst_time_gap= 1;
|
*error_code= ER_WARN_INVALID_TIMESTAMP;
|
||||||
local_t= sp->revts[i] - sp->revtis[i].rt_offset + saved_seconds;
|
local_t= sp->revts[i] - sp->revtis[i].rt_offset + saved_seconds;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -980,7 +982,7 @@ TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
|||||||
if (local_t < TIMESTAMP_MIN_VALUE)
|
if (local_t < TIMESTAMP_MIN_VALUE)
|
||||||
{
|
{
|
||||||
local_t= 0;
|
local_t= 0;
|
||||||
*in_dst_time_gap= 1; // Mark error
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_RETURN(local_t);
|
DBUG_RETURN(local_t);
|
||||||
@ -1015,8 +1017,7 @@ class Time_zone_system : public Time_zone
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Time_zone_system() {} /* Remove gcc warning */
|
Time_zone_system() {} /* Remove gcc warning */
|
||||||
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const;
|
||||||
my_bool *in_dst_time_gap) const;
|
|
||||||
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
};
|
};
|
||||||
@ -1030,9 +1031,11 @@ public:
|
|||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to MYSQL_TIME structure with local time in
|
t - pointer to MYSQL_TIME structure with local time in
|
||||||
broken-down representation.
|
broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
error_code - 0, if the conversion was successful;
|
||||||
value passed doesn't really exist (i.e. falls into
|
ER_WARN_DATA_OUT_OF_RANGE, if t contains datetime value
|
||||||
spring time-gap) and is not touched otherwise.
|
which is out of TIMESTAMP range;
|
||||||
|
ER_WARN_INVALID_TIMESTAMP, if t represents value which
|
||||||
|
doesn't exists (falls into the spring time-gap).
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This method uses system function (localtime_r()) for conversion
|
This method uses system function (localtime_r()) for conversion
|
||||||
@ -1048,10 +1051,10 @@ public:
|
|||||||
Corresponding my_time_t value or 0 in case of error
|
Corresponding my_time_t value or 0 in case of error
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_system::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_system::TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const
|
||||||
{
|
{
|
||||||
long not_used;
|
long not_used;
|
||||||
return my_system_gmt_sec(t, ¬_used, in_dst_time_gap);
|
return my_system_gmt_sec(t, ¬_used, error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1111,7 +1114,7 @@ class Time_zone_utc : public Time_zone
|
|||||||
public:
|
public:
|
||||||
Time_zone_utc() {} /* Remove gcc warning */
|
Time_zone_utc() {} /* Remove gcc warning */
|
||||||
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_bool *in_dst_time_gap) const;
|
uint *error_code) const;
|
||||||
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
};
|
};
|
||||||
@ -1120,14 +1123,6 @@ public:
|
|||||||
/*
|
/*
|
||||||
Convert UTC time from MYSQL_TIME representation to its my_time_t representation.
|
Convert UTC time from MYSQL_TIME representation to its my_time_t representation.
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
TIME_to_gmt_sec()
|
|
||||||
t - pointer to MYSQL_TIME structure with local time
|
|
||||||
in broken-down representation.
|
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
|
||||||
value passed doesn't really exist (i.e. falls into
|
|
||||||
spring time-gap) and is not touched otherwise.
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Since Time_zone_utc is used only internally for my_time_t -> TIME
|
Since Time_zone_utc is used only internally for my_time_t -> TIME
|
||||||
conversions, this function of Time_zone interface is not implemented for
|
conversions, this function of Time_zone interface is not implemented for
|
||||||
@ -1137,10 +1132,11 @@ public:
|
|||||||
0
|
0
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_utc::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_utc::TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const
|
||||||
{
|
{
|
||||||
/* Should be never called */
|
/* Should be never called */
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1200,8 +1196,7 @@ class Time_zone_db : public Time_zone
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Time_zone_db(TIME_ZONE_INFO *tz_info_arg, const String * tz_name_arg);
|
Time_zone_db(TIME_ZONE_INFO *tz_info_arg, const String * tz_name_arg);
|
||||||
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const;
|
||||||
my_bool *in_dst_time_gap) const;
|
|
||||||
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
private:
|
private:
|
||||||
@ -1238,9 +1233,11 @@ Time_zone_db::Time_zone_db(TIME_ZONE_INFO *tz_info_arg,
|
|||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to MYSQL_TIME structure with local time
|
t - pointer to MYSQL_TIME structure with local time
|
||||||
in broken-down representation.
|
in broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
error_code - 0, if the conversion was successful;
|
||||||
value passed doesn't really exist (i.e. falls into
|
ER_WARN_DATA_OUT_OF_RANGE, if t contains datetime value
|
||||||
spring time-gap) and is not touched otherwise.
|
which is out of TIMESTAMP range;
|
||||||
|
ER_WARN_INVALID_TIMESTAMP, if t represents value which
|
||||||
|
doesn't exists (falls into the spring time-gap).
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Please see ::TIME_to_gmt_sec for function description and
|
Please see ::TIME_to_gmt_sec for function description and
|
||||||
@ -1250,9 +1247,9 @@ Time_zone_db::Time_zone_db(TIME_ZONE_INFO *tz_info_arg,
|
|||||||
Corresponding my_time_t value or 0 in case of error
|
Corresponding my_time_t value or 0 in case of error
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_db::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_db::TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const
|
||||||
{
|
{
|
||||||
return ::TIME_to_gmt_sec(t, tz_info, in_dst_time_gap);
|
return ::TIME_to_gmt_sec(t, tz_info, error_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1298,7 +1295,7 @@ class Time_zone_offset : public Time_zone
|
|||||||
public:
|
public:
|
||||||
Time_zone_offset(long tz_offset_arg);
|
Time_zone_offset(long tz_offset_arg);
|
||||||
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_bool *in_dst_time_gap) const;
|
uint *error_code) const;
|
||||||
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
/*
|
/*
|
||||||
@ -1340,12 +1337,11 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
|
|||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to MYSQL_TIME structure with local time
|
t - pointer to MYSQL_TIME structure with local time
|
||||||
in broken-down representation.
|
in broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which should be set to true if
|
error_code - 0, if the conversion was successful;
|
||||||
datetime value passed doesn't really exist
|
ER_WARN_DATA_OUT_OF_RANGE, if t contains datetime value
|
||||||
(i.e. falls into spring time-gap) and is not
|
which is out of TIMESTAMP range;
|
||||||
touched otherwise.
|
ER_WARN_INVALID_TIMESTAMP, if t represents value which
|
||||||
It is not really used in this class, except
|
doesn't exists (falls into the spring time-gap).
|
||||||
for indicating error
|
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
Corresponding my_time_t value or 0 in case of error. In case of error
|
Corresponding my_time_t value or 0 in case of error. In case of error
|
||||||
@ -1353,22 +1349,22 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_offset::TIME_to_gmt_sec(const MYSQL_TIME *t,
|
Time_zone_offset::TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const
|
||||||
my_bool *in_dst_time_gap) const
|
|
||||||
{
|
{
|
||||||
my_time_t local_t;
|
my_time_t local_t;
|
||||||
int shift= 0;
|
int shift= 0;
|
||||||
|
|
||||||
*in_dst_time_gap= 0; // Reset
|
|
||||||
/*
|
/*
|
||||||
Check timestamp range.we have to do this as calling function relies on
|
Check timestamp range.we have to do this as calling function relies on
|
||||||
us to make all validation checks here.
|
us to make all validation checks here.
|
||||||
*/
|
*/
|
||||||
if (!validate_timestamp_range(t))
|
if (!validate_timestamp_range(t))
|
||||||
{
|
{
|
||||||
*in_dst_time_gap= 1; // Mark error
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*error_code= 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Do a temporary shift of the boundary dates to avoid
|
Do a temporary shift of the boundary dates to avoid
|
||||||
overflow of my_time_t if the time value is near it's
|
overflow of my_time_t if the time value is near it's
|
||||||
@ -1391,7 +1387,7 @@ Time_zone_offset::TIME_to_gmt_sec(const MYSQL_TIME *t,
|
|||||||
return local_t;
|
return local_t;
|
||||||
|
|
||||||
/* range error*/
|
/* range error*/
|
||||||
*in_dst_time_gap= 1; // Mark error
|
*error_code= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2759,7 +2755,7 @@ main(int argc, char **argv)
|
|||||||
for (time_tmp.second=0; time_tmp.second<60; time_tmp.second+=25)
|
for (time_tmp.second=0; time_tmp.second<60; time_tmp.second+=25)
|
||||||
{
|
{
|
||||||
long not_used;
|
long not_used;
|
||||||
my_bool not_used_2;
|
uint not_used_2;
|
||||||
t= (time_t)my_system_gmt_sec(&time_tmp, ¬_used, ¬_used_2);
|
t= (time_t)my_system_gmt_sec(&time_tmp, ¬_used, ¬_used_2);
|
||||||
t1= (time_t)TIME_to_gmt_sec(&time_tmp, &tz_info, ¬_used_2);
|
t1= (time_t)TIME_to_gmt_sec(&time_tmp, &tz_info, ¬_used_2);
|
||||||
if (t != t1)
|
if (t != t1)
|
||||||
|
@ -33,11 +33,11 @@ public:
|
|||||||
/**
|
/**
|
||||||
Converts local time in broken down MYSQL_TIME representation to
|
Converts local time in broken down MYSQL_TIME representation to
|
||||||
my_time_t (UTC seconds since Epoch) represenation.
|
my_time_t (UTC seconds since Epoch) represenation.
|
||||||
Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
|
Returns 0 in case of error. May set error_code to ER_WARN_DATA_OUT_OF_RANGE
|
||||||
falls into spring time-gap (or lefts it untouched otherwise).
|
or ER_WARN_INVALID_TIMESTAMP, see TIME_to_timestamp())
|
||||||
*/
|
*/
|
||||||
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_bool *in_dst_time_gap) const = 0;
|
uint *error_code) const = 0;
|
||||||
/**
|
/**
|
||||||
Converts time in my_time_t representation to local time in
|
Converts time in my_time_t representation to local time in
|
||||||
broken down MYSQL_TIME representation.
|
broken down MYSQL_TIME representation.
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
#define MAX_BIT_FIELD_LENGTH 64 /* Max length in bits for bit fields */
|
#define MAX_BIT_FIELD_LENGTH 64 /* Max length in bits for bit fields */
|
||||||
|
|
||||||
#define MAX_DATE_WIDTH 10 /* YYYY-MM-DD */
|
#define MAX_DATE_WIDTH 10 /* YYYY-MM-DD */
|
||||||
#define MIN_TIME_WIDTH 9 /* HHH:MM:SS */
|
#define MIN_TIME_WIDTH 10 /* -HHH:MM:SS */
|
||||||
#define MAX_TIME_WIDTH 16 /* -DDDDDD HH:MM:SS */
|
#define MAX_TIME_WIDTH 16 /* -DDDDDD HH:MM:SS */
|
||||||
#define MAX_TIME_FULL_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */
|
#define MAX_TIME_FULL_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */
|
||||||
#define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */
|
#define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */
|
||||||
|
@ -3229,6 +3229,11 @@ get_innobase_type_from_mysql_type(
|
|||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
return(DATA_DOUBLE);
|
return(DATA_DOUBLE);
|
||||||
case HA_KEYTYPE_BINARY:
|
case HA_KEYTYPE_BINARY:
|
||||||
|
if (field->type() == MYSQL_TYPE_TINY)
|
||||||
|
{ // compatibility workaround
|
||||||
|
*unsigned_flag= DATA_UNSIGNED ;
|
||||||
|
return DATA_INT;
|
||||||
|
}
|
||||||
return(DATA_FIXBINARY);
|
return(DATA_FIXBINARY);
|
||||||
case HA_KEYTYPE_VARBINARY2:
|
case HA_KEYTYPE_VARBINARY2:
|
||||||
if (field->type() != MYSQL_TYPE_VARCHAR)
|
if (field->type() != MYSQL_TYPE_VARCHAR)
|
||||||
|
@ -3995,6 +3995,11 @@ get_innobase_type_from_mysql_type(
|
|||||||
case HA_KEYTYPE_DOUBLE:
|
case HA_KEYTYPE_DOUBLE:
|
||||||
return(DATA_DOUBLE);
|
return(DATA_DOUBLE);
|
||||||
case HA_KEYTYPE_BINARY:
|
case HA_KEYTYPE_BINARY:
|
||||||
|
if (field->type() == MYSQL_TYPE_TINY)
|
||||||
|
{ // compatibility workaround
|
||||||
|
*unsigned_flag= DATA_UNSIGNED;
|
||||||
|
return DATA_INT;
|
||||||
|
}
|
||||||
return(DATA_FIXBINARY);
|
return(DATA_FIXBINARY);
|
||||||
case HA_KEYTYPE_VARBINARY2:
|
case HA_KEYTYPE_VARBINARY2:
|
||||||
if (field->type() != MYSQL_TYPE_VARCHAR)
|
if (field->type() != MYSQL_TYPE_VARCHAR)
|
||||||
|
@ -161,7 +161,7 @@ field_store_time_t(
|
|||||||
my_time.time_type = MYSQL_TIMESTAMP_DATETIME;
|
my_time.time_type = MYSQL_TIMESTAMP_DATETIME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(field->store_time(&my_time, MYSQL_TIMESTAMP_DATETIME));
|
return(field->store_time(&my_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************//**
|
/*******************************************************************//**
|
||||||
|
@ -4492,10 +4492,7 @@ get_innobase_type_from_mysql_type(
|
|||||||
case MYSQL_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
return(DATA_BLOB);
|
return(DATA_BLOB);
|
||||||
case MYSQL_TYPE_NULL:
|
case MYSQL_TYPE_NULL:
|
||||||
/* MySQL currently accepts "NULL" datatype, but will
|
return(DATA_FIXBINARY);
|
||||||
reject such datatype in the next release. We will cope
|
|
||||||
with it and not trigger assertion failure in 5.1 */
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ field_store_time_t(
|
|||||||
my_time.time_type = MYSQL_TIMESTAMP_DATETIME;
|
my_time.time_type = MYSQL_TIMESTAMP_DATETIME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(field->store_time(&my_time, MYSQL_TIMESTAMP_DATETIME));
|
return(field->store_time(&my_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************//**
|
/*******************************************************************//**
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
integer that determines the number of significant digits in a
|
integer that determines the number of significant digits in a
|
||||||
particular radix R, where R is either 2 or 10. S is a non-negative
|
particular radix R, where R is either 2 or 10. S is a non-negative
|
||||||
integer. Every value of an exact numeric type of scale S is of the
|
integer. Every value of an exact numeric type of scale S is of the
|
||||||
form n*10^{-S}, where n is an integer such that <EFBFBD>-R^P <= n <= R^P.
|
form n*10^{-S}, where n is an integer such that -R^P <= n <= R^P.
|
||||||
|
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
|
@ -12542,7 +12542,7 @@ static void test_datetime_ranges()
|
|||||||
|
|
||||||
rc= mysql_stmt_execute(stmt);
|
rc= mysql_stmt_execute(stmt);
|
||||||
check_execute(stmt, rc);
|
check_execute(stmt, rc);
|
||||||
DIE_UNLESS(mysql_warning_count(mysql) != 6);
|
DIE_UNLESS(mysql_warning_count(mysql) == 6);
|
||||||
|
|
||||||
verify_col_data("t1", "year", "0000-00-00 00:00:00");
|
verify_col_data("t1", "year", "0000-00-00 00:00:00");
|
||||||
verify_col_data("t1", "month", "0000-00-00 00:00:00");
|
verify_col_data("t1", "month", "0000-00-00 00:00:00");
|
||||||
@ -12573,7 +12573,7 @@ static void test_datetime_ranges()
|
|||||||
|
|
||||||
rc= mysql_stmt_execute(stmt);
|
rc= mysql_stmt_execute(stmt);
|
||||||
check_execute(stmt, rc);
|
check_execute(stmt, rc);
|
||||||
DIE_UNLESS(mysql_warning_count(mysql) != 3);
|
DIE_UNLESS(mysql_warning_count(mysql) == 3);
|
||||||
|
|
||||||
verify_col_data("t1", "year", "0000-00-00 00:00:00");
|
verify_col_data("t1", "year", "0000-00-00 00:00:00");
|
||||||
verify_col_data("t1", "month", "0000-00-00 00:00:00");
|
verify_col_data("t1", "month", "0000-00-00 00:00:00");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user