summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-03-22 12:24:56 +0400
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-03-22 12:24:56 +0400
commit50b5064ccd0af957080d9c9efd022e33c7c9c060 (patch)
tree720e78f3c3d56e2004397f0918b35c0dd5f084d8 /sql/item_timefunc.h
parent6ef0fee8e66cc7bf073affe0ecf2c007f8ff881f (diff)
downloadmariadb-git-50b5064ccd0af957080d9c9efd022e33c7c9c060.tar.gz
bug #16546 (DATETIME + 0 not always coerced in the same way)
fix for cast( AS DATETIME) + 0 operation. I just implemented Item_datetime_typecast::val() method as it is usually done in other classes. Should be fixed more radically in 5.0 mysql-test/r/type_datetime.result: result added mysql-test/t/type_datetime.test: testcase sql/item_timefunc.h: added double conversion to Item_datetime_typecast
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 45cad627c05..2383b4f86ac 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -751,12 +751,19 @@ public:
String *val_str(String *str);
const char *cast_type() const { return "datetime"; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
+ void fix_length_and_dec()
+ {
+ Item_typecast_maybe_null::fix_length_and_dec();
+ decimals= DATETIME_DEC;
+ }
+
Field *tmp_table_field(TABLE *t_arg)
{
return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin));
}
bool result_as_longlong() { return TRUE; }
longlong val_int();
+ double val() { return (double) val_int(); }
};
class Item_func_makedate :public Item_str_func