diff options
author | monty@mysql.com <> | 2005-02-19 19:00:41 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2005-02-19 19:00:41 +0200 |
commit | 88d2e2973d399690c69ceae7f3cb7dba689e72e6 (patch) | |
tree | 5a44a1612b30cc4765614c35e5172d824e16bb09 /sql/sp_head.cc | |
parent | e29191e5c5255683efa7f91bf8bd79b33eb094e6 (diff) | |
parent | 218e00ac681c300ddfb59889d8b6dd7faa0e71f6 (diff) | |
download | mariadb-git-88d2e2973d399690c69ceae7f3cb7dba689e72e6.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 72 |
1 files changed, 8 insertions, 64 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 4c03e88f33a..cd301106907 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -158,69 +158,12 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type) } case DECIMAL_RESULT: { - switch (it->result_type()) - { - case DECIMAL_RESULT: - { - my_decimal value, *val= it->val_decimal(&value); - if (it->null_value) - it= new Item_null(); - else - it= new Item_decimal(val); - break; - } - case INT_RESULT: - { - longlong val= it->val_int(); - if (it->null_value) - it= new Item_null(); - else - it= new Item_decimal(val, (int)it->max_length, - (bool)it->unsigned_flag); - break; - } - case REAL_RESULT: - { - double val= it->val_real(); - if (it->null_value) - it= new Item_null(); - else - it= new Item_decimal(val, (int)it->max_length, - (int)it->decimals); - break; - } - case STRING_RESULT: - { - char buffer[MAX_FIELD_WIDTH]; - String tmp(buffer, sizeof(buffer), it->collation.collation); - String *val= it->val_str(&tmp); - if (it->null_value) - it= new Item_null(); - else - it= new Item_decimal(val->ptr(), val->length(), val->charset()); - break; - } - case ROW_RESULT: - default: - DBUG_ASSERT(0); - } -#ifndef DBUG_OFF + my_decimal value, *val= it->val_decimal(&value); if (it->null_value) - { - DBUG_PRINT("info", ("DECIMAL_RESULT: null")); - } + it= new Item_null(); else - { - my_decimal value, *val= it->val_decimal(&value); - int len; - char *buff= - (char *)my_alloca(len= my_decimal_string_length(val) + 3); - String str(buff, len, &my_charset_bin); - my_decimal2string(0, val, 0, 0, 0, &str); - DBUG_PRINT("info", ("DECIMAL_RESULT: %s", str.ptr())); - my_afree(buff); - } -#endif + it= new Item_decimal(val); + dbug_print_decimal("info", "DECIMAL_RESULT: %s", val); break; } case STRING_RESULT: @@ -236,8 +179,9 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type) } else { - DBUG_PRINT("info",("default result: %*s",s->length(),s->c_ptr_quick())); - it= new Item_string(thd->strmake(s->c_ptr_quick(), s->length()), + DBUG_PRINT("info",("default result: %*s", + s->length(), s->c_ptr_quick())); + it= new Item_string(thd->strmake(s->ptr(), s->length()), s->length(), it->collation.collation); } break; @@ -811,7 +755,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) suv= new Item_func_set_user_var(guv->get_name(), item); /* - we do not check suv->fixed, bacause it can't be fixed after + we do not check suv->fixed, because it can't be fixed after creation */ suv->fix_fields(thd, NULL, &item); |