Commit db9c46de authored by Sergei Golubchik's avatar Sergei Golubchik

number to time comparison

parent 5ff5c4b8
......@@ -1358,6 +1358,21 @@ Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
DROP TABLE t1;
End of 5.1 tests
select time('10:10:10') > 10;
time('10:10:10') > 10
1
select time('10:10:10') > 1010;
time('10:10:10') > 1010
1
select time('10:10:09') > 101010;
time('10:10:09') > 101010
0
select time('10:10:10') > 101010;
time('10:10:10') > 101010
0
select time('10:10:11') > 101010;
time('10:10:11') > 101010
1
select time(' 1 02:03:04') + interval 9 microsecond;
time(' 1 02:03:04') + interval 9 microsecond
26:03:04.000009
......
......@@ -861,6 +861,12 @@ DROP TABLE t1;
--echo End of 5.1 tests
select time('10:10:10') > 10;
select time('10:10:10') > 1010;
select time('10:10:09') > 101010;
select time('10:10:10') > 101010;
select time('10:10:11') > 101010;
select time(' 1 02:03:04') + interval 9 microsecond;
select time(' 1 02:03:04') - interval 9 microsecond;
select time('-1 02:03:04') + interval 9 microsecond;
......
......@@ -870,9 +870,14 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
{
MYSQL_TIME buf;
int was_cut;
longlong res;
if (number_to_datetime(value, &buf, TIME_INVALID_DATES|TIME_FUZZY_DATE,
&was_cut) == -1)
if (t_type == MYSQL_TIMESTAMP_TIME)
res= number_to_time(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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment