diff options
author | unknown <jani@ua72d24.elisa.omakaista.fi> | 2004-03-09 22:03:01 +0200 |
---|---|---|
committer | unknown <jani@ua72d24.elisa.omakaista.fi> | 2004-03-09 22:03:01 +0200 |
commit | b71a52eaecffa784b437d7829bd84628b538c19b (patch) | |
tree | be5820a74d9f1d870c2d07eb5a1c3384745dead0 /sql/item_timefunc.h | |
parent | 53d4a5661b0ee2c4184f8d74cc0477bdb9ff4d2d (diff) | |
download | mariadb-git-b71a52eaecffa784b437d7829bd84628b538c19b.tar.gz |
Fixed Bug#3115. CAST AS DATE with malformed string returns NULL but IS NULL
is false.
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r-- | sql/item_timefunc.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index a81b9f28d92..854a54bbe80 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -610,6 +610,19 @@ public: }; +class Item_typecast_maybe_null :public Item_typecast +{ +public: + Item_typecast_maybe_null(Item *a) :Item_typecast(a) {} + void fix_length_and_dec() + { + collation.set(&my_charset_bin); + max_length=args[0]->max_length; + maybe_null= 1; + } +}; + + class Item_char_typecast :public Item_typecast { int cast_length; @@ -626,10 +639,10 @@ public: }; -class Item_date_typecast :public Item_typecast +class Item_date_typecast :public Item_typecast_maybe_null { public: - Item_date_typecast(Item *a) :Item_typecast(a) {} + Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {} String *val_str(String *str); bool get_date(TIME *ltime, uint fuzzy_date); const char *cast_type() const { return "date"; } @@ -641,10 +654,10 @@ public: }; -class Item_time_typecast :public Item_typecast +class Item_time_typecast :public Item_typecast_maybe_null { public: - Item_time_typecast(Item *a) :Item_typecast(a) {} + Item_time_typecast(Item *a) :Item_typecast_maybe_null(a) {} String *val_str(String *str); bool get_time(TIME *ltime); const char *cast_type() const { return "time"; } @@ -656,10 +669,10 @@ public: }; -class Item_datetime_typecast :public Item_typecast +class Item_datetime_typecast :public Item_typecast_maybe_null { public: - Item_datetime_typecast(Item *a) :Item_typecast(a) {} + Item_datetime_typecast(Item *a) :Item_typecast_maybe_null(a) {} String *val_str(String *str); const char *cast_type() const { return "datetime"; } enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } |