summaryrefslogtreecommitdiff
path: root/sql/sp_rcontext.cc
diff options
context:
space:
mode:
authorpem@mysql.comhem.se <>2004-09-10 16:28:11 +0200
committerpem@mysql.comhem.se <>2004-09-10 16:28:11 +0200
commit728000b22514f97cca66126c6f9e86a5ce7a0d61 (patch)
treeff8b7de4aa2beb41f5797fa160bf00b13fd14840 /sql/sp_rcontext.cc
parent4cb65274213e4cc844c7c92936e41c0a33188c0d (diff)
downloadmariadb-git-728000b22514f97cca66126c6f9e86a5ce7a0d61.tar.gz
Fixed BUG#4941: Stored procedure crash fetching null value into variable.
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r--sql/sp_rcontext.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 1bdd022470b..2f7bdbffa2b 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -230,21 +230,24 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
return -1;
}
s= row[fldcount];
- switch (sp_map_result_type(pv->type))
- {
- case INT_RESULT:
- it= new Item_int(s);
- break;
- case REAL_RESULT:
- it= new Item_real(s, strlen(s));
- break;
- default:
+ if (!s)
+ it= new Item_null();
+ else
+ switch (sp_map_result_type(pv->type))
{
- uint len= strlen(s);
- it= new Item_string(thd->strmake(s, len), len, thd->db_charset);
+ case INT_RESULT:
+ it= new Item_int(s);
break;
+ case REAL_RESULT:
+ it= new Item_real(s, strlen(s));
+ break;
+ default:
+ {
+ uint len= strlen(s);
+ it= new Item_string(thd->strmake(s, len), len, thd->db_charset);
+ break;
+ }
}
- }
thd->spcont->set_item(pv->offset, it);
}
if (fldcount < m_prot->get_field_count())