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 | 53b3ebdfe0e589721803a5306b14455efcb7adda (patch) | |
tree | be5820a74d9f1d870c2d07eb5a1c3384745dead0 /sql/item_timefunc.h | |
parent | 23f9f229d422db7ee55ecb42c93e69da45dd9e51 (diff) | |
download | mariadb-git-53b3ebdfe0e589721803a5306b14455efcb7adda.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; } |