diff options
author | monty@mysql.com <> | 2005-02-19 18:58:27 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2005-02-19 18:58:27 +0200 |
commit | 218e00ac681c300ddfb59889d8b6dd7faa0e71f6 (patch) | |
tree | 45069dd14961944b02845ab6e42f1993666f63e8 /sql/sp_rcontext.cc | |
parent | 7bc48798fce1b4010adbd074aa18784fcf0eb07e (diff) | |
download | mariadb-git-218e00ac681c300ddfb59889d8b6dd7faa0e71f6.tar.gz |
Fixed BUILD script to use --with-berkeley-db instead of --with-bdb
Lots of small fixes to multi-precision-math path
Give Note for '123.4e'
Added helper functions type 'val_string_from_real()
Don't give warnings for end space for string2decimal()
Changed storage of values for SP so that we can detect length of argument without strlen()
Changed interface for str2dec() so that we must supple the pointer to the last character in the buffer
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r-- | sql/sp_rcontext.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 0c6c8c5aa70..5b177650726 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -243,27 +243,36 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars) if (!s) it= new Item_null(); else - switch (sp_map_result_type(pv->type)) - { + { + /* + Length of data can be calculated as: + pointer_to_next_not_null_object - s -1 + where the last -1 is to remove the end \0 + */ + uint len; + MYSQL_ROW next= row+fldcount+1; + while (!*next) // Skip nulls + next++; + len= (*next -s)-1; + switch (sp_map_result_type(pv->type)) { case INT_RESULT: it= new Item_int(s); break; case REAL_RESULT: - it= new Item_float(s, strlen(s)); + it= new Item_float(s, len); break; case DECIMAL_RESULT: - it= new Item_decimal(s, strlen(s), thd->db_charset); + it= new Item_decimal(s, len, thd->db_charset); break; case STRING_RESULT: - { - uint len= strlen(s); - it= new Item_string(thd->strmake(s, len), len, thd->db_charset); - break; - } + /* TODO: Document why we do an extra copy of the string 's' here */ + it= new Item_string(thd->strmake(s, len), len, thd->db_charset); + break; case ROW_RESULT: default: DBUG_ASSERT(0); } + } thd->spcont->set_item(pv->offset, it); } if (fldcount < m_prot->get_field_count()) |