Commit 05f25fea authored by pem@mysql.comhem.se's avatar pem@mysql.comhem.se

Handle null values correctly in SP local variables.

parent 96f12528
......@@ -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)
......
......@@ -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()|
......
......@@ -256,17 +256,34 @@ class Item_splocal : public Item
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment