diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index ced05a25c60..de21cc39444 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -85,11 +85,23 @@ declare lf double; declare ls varchar(32); set ld = null, li = null, lf = null, ls = null; insert into t3 values (ld, li, lf, ls); +insert into t3 (i, f, s) values ((ld is null), 1, "ld is null"), +((li is null), 1, "li is null"), +((li = 0), null, "li = 0"), +((lf is null), 1, "lf is null"), +((lf = 0), null, "lf = 0"), +((ls is null), 1, "ls is null"); end; call nullset(); select * from t3; d i f s NULL NULL NULL NULL +NULL 1 1 ld is null +NULL 1 1 li is null +NULL NULL NULL li = 0 +NULL 1 1 lf is null +NULL NULL NULL lf = 0 +NULL 1 1 ls is null drop table t3; drop procedure nullset; create procedure mixset(x char(16), y int) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 588a6c32892..201104f36f8 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -124,6 +124,13 @@ begin set ld = null, li = null, lf = null, ls = null; insert into t3 values (ld, li, lf, ls); + + insert into t3 (i, f, s) values ((ld is null), 1, "ld is null"), + ((li is null), 1, "li is null"), + ((li = 0), null, "li = 0"), + ((lf is null), 1, "lf is null"), + ((lf = 0), null, "lf = 0"), + ((ls is null), 1, "ls is null"); end| call nullset()| diff --git a/sql/item.h b/sql/item.h index 0a0db619e1a..413fcb1ca26 100644 --- a/sql/item.h +++ b/sql/item.h @@ -256,17 +256,34 @@ public: inline double val() { - return this_item()->val(); + Item *it= this_item(); + double ret= it->val(); + Item::null_value= it->null_value; + return ret; } inline longlong val_int() { - return this_item()->val_int(); + Item *it= this_item(); + longlong ret= it->val_int(); + Item::null_value= it->null_value; + return ret; } inline String *val_str(String *sp) { - return this_item()->val_str(sp); + Item *it= this_item(); + String *ret= it->val_str(sp); + Item::null_value= it->null_value; + return ret; + } + + inline bool is_null() + { + Item *it= this_item(); + bool ret= it->is_null(); + Item::null_value= it->null_value; + return ret; } inline void make_field(Send_field *field)