summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-11-21 12:04:27 +0300
committerunknown <konstantin@mysql.com>2004-11-21 12:04:27 +0300
commit3507a52e60a20b01dd1d200f5a4f8b601cb0f55b (patch)
tree79a6ff7b87ea3006cc728bd45e98b1e058f0935a /sql/item.h
parent99d2d10097da69f33637ec43fce22b1a70c6ad85 (diff)
downloadmariadb-git-3507a52e60a20b01dd1d200f5a4f8b601cb0f55b.tar.gz
A fix and test case for Bug#6297 "prepared statement, wrong handling
of <parameter> IS NULL": we must not only set Item::null_value in Item_param, but implement Item_param::is_null() to work well with IS NULL/IS NOT NULL clauses. mysql-test/r/ps.result: Test case for Bug#6297: test results fixed. mysql-test/t/ps.test: A test case for Bug#6297 "prepared statement, wrong handling of <parameter> IS NULL" sql/item.h: A fix for Bug#6297: we must not only set null_value in Item_param, but also implement Item_param::is_null() to work well with IS NULL/ IS NOT NULL. Item::is_null() commented.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 547577a7ee0..ccb0fda1c49 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -266,6 +266,14 @@ public:
virtual bool get_time(TIME *ltime);
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
{ return get_date(ltime,fuzzydate); }
+ /*
+ This function is used only in Item_func_isnull/Item_func_isnotnull
+ (implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null
+ calls this method instead of one of val/result*() methods, which
+ normally will set null_value. This allows to determine nullness of
+ a complex expression without fully evaluating it.
+ Any new item which can be NULL must implement this call.
+ */
virtual bool is_null() { return 0; }
/*
it is "top level" item of WHERE clause and we do not need correct NULL
@@ -573,6 +581,8 @@ public:
void print(String *str) { str->append('?'); }
/* parameter never equal to other parameter of other item */
bool eq(const Item *item, bool binary_cmp) const { return 0; }
+ bool is_null()
+ { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; }
};
class Item_int :public Item_num