Commit 79f6e6f6 authored by Sergei Golubchik's avatar Sergei Golubchik

lp:737458 Casting dates and times into integers works differently in 5.1-micro

better default for Field::cast_to_int_type()
parent ffdf98f2
...@@ -452,3 +452,9 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1 ...@@ -452,3 +452,9 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
1 1
DROP TABLE t1; DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
create table t1 (f1 time, f2 date, f3 datetime);
insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33');
select cast(f1 as unsigned), cast(f2 as unsigned), cast(f3 as unsigned) from t1;
cast(f1 as unsigned) cast(f2 as unsigned) cast(f3 as unsigned)
112233 20111213 20111213112233
drop table t1;
...@@ -284,3 +284,12 @@ DROP TABLE t1; ...@@ -284,3 +284,12 @@ DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
#
# lp:737458 Casting dates and times into integers works differently in 5.1-micro
#
create table t1 (f1 time, f2 date, f3 datetime);
insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33');
select cast(f1 as unsigned), cast(f2 as unsigned), cast(f3 as unsigned) from t1;
drop table t1;
...@@ -149,7 +149,7 @@ class Field ...@@ -149,7 +149,7 @@ class Field
virtual bool str_needs_quotes() { return FALSE; } virtual bool str_needs_quotes() { return FALSE; }
virtual Item_result result_type () const=0; virtual Item_result result_type () const=0;
virtual Item_result cmp_type () const { return result_type(); } virtual Item_result cmp_type () const { return result_type(); }
virtual Item_result cast_to_int_type () const { return result_type(); } virtual Item_result cast_to_int_type () const { return cmp_type(); }
static bool type_can_have_key_part(enum_field_types); static bool type_can_have_key_part(enum_field_types);
static enum_field_types field_type_merge(enum_field_types, enum_field_types); static enum_field_types field_type_merge(enum_field_types, enum_field_types);
static Item_result result_merge_type(enum_field_types); static Item_result result_merge_type(enum_field_types);
......
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