diff options
author | Georgi Kodinov <joro@sun.com> | 2009-01-16 16:48:41 +0200 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-01-16 16:48:41 +0200 |
commit | bdec5458aebded82d52cb535810ad73be244b690 (patch) | |
tree | 39092b6ac4495ec75b00266ad34eafa5a91c6c2e /sql | |
parent | b6468e4a1af984b2c994d3f8d3ce57775ac3f41e (diff) | |
parent | e7a6e86f78998e35e1912f377006a35db3705246 (diff) | |
download | mariadb-git-bdec5458aebded82d52cb535810ad73be244b690.tar.gz |
auto merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 19 | ||||
-rw-r--r-- | sql/item.h | 3 | ||||
-rw-r--r-- | sql/item_func.cc | 9 | ||||
-rw-r--r-- | sql/item_func.h | 1 |
4 files changed, 31 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index 2a89c86cd88..b67639d70b2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2041,6 +2041,12 @@ bool Item_field::val_bool_result() } +bool Item_field::is_null_result() +{ + return (null_value=result_field->is_null()); +} + + bool Item_field::eq(const Item *item, bool binary_cmp) const { Item *real_item= ((Item *) item)->real_item(); @@ -5629,6 +5635,15 @@ double Item_ref::val_result() } +bool Item_ref::is_null_result() +{ + if (result_field) + return (null_value=result_field->is_null()); + + return is_null(); +} + + longlong Item_ref::val_int_result() { if (result_field) @@ -5734,7 +5749,9 @@ String *Item_ref::val_str(String* tmp) bool Item_ref::is_null() { DBUG_ASSERT(fixed); - return (*ref)->is_null(); + bool tmp=(*ref)->is_null_result(); + null_value=(*ref)->null_value; + return tmp; } diff --git a/sql/item.h b/sql/item.h index 250bb3f67ef..1058cc5dbb8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -652,6 +652,7 @@ public: virtual my_decimal *val_decimal_result(my_decimal *val) { return val_decimal(val); } virtual bool val_bool_result() { return val_bool(); } + virtual bool is_null_result() { return is_null(); } /* bit map of tables used by item */ virtual table_map used_tables() const { return (table_map) 0L; } @@ -1301,6 +1302,7 @@ public: String *str_result(String* tmp); my_decimal *val_decimal_result(my_decimal *); bool val_bool_result(); + bool is_null_result(); bool send(Protocol *protocol, String *str_arg); void reset_field(Field *f); bool fix_fields(THD *, Item **); @@ -1942,6 +1944,7 @@ public: String *str_result(String* tmp); my_decimal *val_decimal_result(my_decimal *); bool val_bool_result(); + bool is_null_result(); bool send(Protocol *prot, String *tmp); void make_field(Send_field *field); bool fix_fields(THD *, Item **); diff --git a/sql/item_func.cc b/sql/item_func.cc index c0d08d9b213..913b32ccb88 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4285,6 +4285,15 @@ my_decimal *Item_func_set_user_var::val_decimal_result(my_decimal *val) } +bool Item_func_set_user_var::is_null_result() +{ + DBUG_ASSERT(fixed == 1); + check(TRUE); + update(); // Store expression + return is_null(); +} + + void Item_func_set_user_var::print(String *str) { str->append(STRING_WITH_LEN("(@")); diff --git a/sql/item_func.h b/sql/item_func.h index 89c841abb75..7e15a536cf2 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1302,6 +1302,7 @@ public: longlong val_int_result(); String *str_result(String *str); my_decimal *val_decimal_result(my_decimal *); + bool is_null_result(); bool update_hash(void *ptr, uint length, enum Item_result type, CHARSET_INFO *cs, Derivation dv, bool unsigned_arg); bool send(Protocol *protocol, String *str_arg); |