summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-01-16 17:38:38 +0200
committerGeorgi Kodinov <joro@sun.com>2009-01-16 17:38:38 +0200
commit4d8e73c8186e13d2136d15716cfeaedc55965e05 (patch)
treef0b8464ee2d3fcb57c8c4fe4de1ec5a91e090f3d /sql
parent47bd8d19fd9a6eb8d6a314452db4a916a84adae9 (diff)
parentbdec5458aebded82d52cb535810ad73be244b690 (diff)
downloadmariadb-git-4d8e73c8186e13d2136d15716cfeaedc55965e05.tar.gz
merged 5.0-bugteam -> 5.1-bugteam
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc19
-rw-r--r--sql/item.h3
-rw-r--r--sql/item_func.cc9
-rw-r--r--sql/item_func.h1
4 files changed, 31 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index d3f933dc13f..2ee6de97ad0 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2090,6 +2090,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();
@@ -5800,6 +5806,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)
@@ -5905,7 +5920,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 8c58f0cebe9..be9daf672f0 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -729,6 +729,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; }
@@ -1436,6 +1437,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 **);
@@ -2178,6 +2180,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 3cf1671bfa7..ff0c22ecfa9 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4307,6 +4307,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, enum_query_type query_type)
{
str->append(STRING_WITH_LEN("(@"));
diff --git a/sql/item_func.h b/sql/item_func.h
index 512da28589a..e2937a4daf8 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1335,6 +1335,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);