diff options
author | pem@mysql.comhem.se <> | 2004-09-10 16:28:11 +0200 |
---|---|---|
committer | pem@mysql.comhem.se <> | 2004-09-10 16:28:11 +0200 |
commit | 728000b22514f97cca66126c6f9e86a5ce7a0d61 (patch) | |
tree | ff8b7de4aa2beb41f5797fa160bf00b13fd14840 /sql/sp_rcontext.cc | |
parent | 4cb65274213e4cc844c7c92936e41c0a33188c0d (diff) | |
download | mariadb-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.cc | 27 |
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()) |