summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordlenev@mysql.com <>2004-09-09 23:45:19 +0400
committerdlenev@mysql.com <>2004-09-09 23:45:19 +0400
commit9cc2dba2eab57eec847b5c537497b929efbe0c67 (patch)
treec7d8ff3b9faa0aa56711ec957c2d0101b35e70c1
parent0ae54976d37409258939e8445f4d3c938f6eee11 (diff)
parentdde44b8c8c884d50c4791f1b741792db7106c29c (diff)
downloadmariadb-git-9cc2dba2eab57eec847b5c537497b929efbe0c67.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-1218-a
-rw-r--r--mysql-test/r/sp.result13
-rw-r--r--mysql-test/t/sp.test12
-rw-r--r--sql/item_func.h10
3 files changed, 33 insertions, 2 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index f0f51945f36..6d743bf5c71 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -1820,6 +1820,19 @@ Ok
Ok
drop procedure bug5258|
drop procedure bug5258_aux|
+create function bug4487() returns char
+begin
+declare v char;
+return v;
+end|
+Warnings:
+Warning 1311 Referring to uninitialized variable v
+select bug4487()|
+bug4487()
+NULL
+Warnings:
+Warning 1311 Referring to uninitialized variable v
+drop function bug4487|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 05d38d25956..1d7efab3841 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -1987,6 +1987,18 @@ call bug5258_aux()|
drop procedure bug5258|
drop procedure bug5258_aux|
+#
+# BUG#4487: Stored procedure connection aborted if uninitialized char
+#
+create function bug4487() returns char
+begin
+ declare v char;
+ return v;
+end|
+
+select bug4487()|
+drop function bug4487|
+
#
# Some "real" examples
diff --git a/sql/item_func.h b/sql/item_func.h
index 9aff613fa02..48a33bad80d 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1131,25 +1131,31 @@ public:
double val()
{
Item *it;
+ double d;
if (execute(&it))
{
null_value= 1;
return 0.0;
}
- return it->val();
+ d= it->val();
+ null_value= it->null_value;
+ return d;
}
String *val_str(String *str)
{
Item *it;
+ String *s;
if (execute(&it))
{
null_value= 1;
return NULL;
}
- return it->val_str(str);
+ s= it->val_str(str);
+ null_value= it->null_value;
+ return s;
}
void fix_length_and_dec();