Commit 0d95f36a authored by pem@mysql.com's avatar pem@mysql.com

Post post merge fix. Made the broken ip test work again.

parent 6822eb5e
......@@ -484,6 +484,12 @@ set p = p+2;
end;
end while;
end;
call ip(200);
select * from primes where i=45 or i=100 or i=199;
i p
45 211
100 557
199 1229
drop table primes;
drop procedure opp;
drop procedure ip;
......
......@@ -564,11 +564,10 @@ end|
# This isn't the fastest way in the world to compute prime numbers, so
# don't be too ambition. ;-)
#QQ Something broke after the last merge. :-( /2003-03-19
#QQ call ip(200)|
call ip(200)|
# We don't want to select the entire table here, just pick a few
# examples.
#QQ select * from primes where i=45 or i=100 or i=199|
select * from primes where i=45 or i=100 or i=199|
drop table primes|
drop procedure opp|
drop procedure ip|
......
......@@ -50,10 +50,15 @@ sp_map_result_type(enum enum_field_types type)
static Item *
eval_func_item(THD *thd, Item *it, enum enum_field_types type)
{
DBUG_ENTER("eval_func_item");
it= it->this_item();
DBUG_PRINT("info", ("type: %d", type));
if (it->fix_fields(thd, 0, NULL))
return it; // Shouldn't happen?
{
DBUG_PRINT("info", ("fix_fields() failed"));
DBUG_RETURN(it); // Shouldn't happen?
}
/* QQ How do we do this? Is there some better way? */
if (type == MYSQL_TYPE_NULL)
......@@ -62,9 +67,11 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
{
switch (sp_map_result_type(type)) {
case INT_RESULT:
DBUG_PRINT("info", ("INT_RESULT: %d", it->val_int()));
it= new Item_int(it->val_int());
break;
case REAL_RESULT:
DBUG_PRINT("info", ("REAL_RESULT: %g", it->val()));
it= new Item_real(it->val());
break;
default:
......@@ -73,6 +80,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
String tmp(buffer, sizeof(buffer), it->charset());
String *s= it->val_str(&tmp);
DBUG_PRINT("info", ("default result: %*s", s->length(), s->c_ptr_quick()))
it= new Item_string(sql_strmake(s->c_ptr_quick(), s->length()),
s->length(), it->charset());
break;
......@@ -80,7 +88,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
}
}
return it;
DBUG_RETURN(it);
}
sp_head::sp_head(LEX_STRING *name, LEX *lex)
......@@ -209,7 +217,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
else
{
if (pvar->mode == sp_param_out)
nctx->push_item(it->this_item()); // OUT
nctx->push_item(NULL); // OUT
else
nctx->push_item(eval_func_item(thd, it, pvar->type)); // IN or INOUT
// Note: If it's OUT or INOUT, it must be a variable.
......
......@@ -65,10 +65,14 @@ sp_pcontext::find_pvar(LEX_STRING *name)
while (i-- > 0)
{
uint len= m_pvar[i].name->const_string()->length();
if (name->length > len)
len= name->length;
if (my_strncasecmp(system_charset_info,
name->str,
m_pvar[i].name->const_string()->ptr(),
name->length) == 0)
len) == 0)
{
return m_pvar + i;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment