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

Fixed BUG#2227: Server crash with stored procedure call.

(Meaning "... with SELECT v", where v is a local variable.)
parent ee411648
......@@ -968,6 +968,16 @@ drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
create procedure bug2227(x int)
begin
declare y float default 2.6;
declare z char(16) default "zzz";
select 1.3, x, y, 42, z;
end|
call bug2227(9)|
1.3 x y 42 z
1.3 9 2.6 42 zzz
drop procedure bug2227|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
......
......@@ -502,7 +502,6 @@ drop procedure sel2|
delete from t1|
delete from t2|
# SELECT INTO local variables
create procedure into_test(x char(16), y int)
begin
......@@ -1107,6 +1106,20 @@ drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
#
# BUG#2227
#
create procedure bug2227(x int)
begin
declare y float default 2.6;
declare z char(16) default "zzz";
select 1.3, x, y, 42, z;
end|
call bug2227(9)|
drop procedure bug2227|
#
# Some "real" examples
......
......@@ -296,7 +296,10 @@ public:
inline void make_field(Send_field *field)
{
this_item()->make_field(field);
Item *it= this_item();
it->set_name(m_name.str, m_name.length, system_charset_info);
it->make_field(field);
}
inline Item_result result_type() const
......@@ -318,6 +321,11 @@ public:
{
str->append(m_name.str, m_name.length);
}
inline bool send(Protocol *protocol, String *str)
{
return this_item()->send(protocol, str);
}
};
......
......@@ -94,8 +94,14 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type)
}
else
{
/* There's some difference between Item::new_item() and the
* constructor; the former crashes, the latter works... weird. */
uint8 decimals= it->decimals;
uint32 max_length= it->max_length;
DBUG_PRINT("info", ("REAL_RESULT: %g", d));
it= new Item_real(it->val());
it->decimals= decimals;
it->max_length= max_length;
}
break;
}
......
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