Commit 3080055a authored by unknown's avatar unknown

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


sql/sp_head.cc:
  Added some more DBUG output.
sql/sp_pcontext.cc:
  Post post merge fix.
parent 74dd52e7
...@@ -484,6 +484,12 @@ set p = p+2; ...@@ -484,6 +484,12 @@ set p = p+2;
end; end;
end while; end while;
end; 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 table primes;
drop procedure opp; drop procedure opp;
drop procedure ip; drop procedure ip;
......
...@@ -564,11 +564,10 @@ end| ...@@ -564,11 +564,10 @@ end|
# This isn't the fastest way in the world to compute prime numbers, so # This isn't the fastest way in the world to compute prime numbers, so
# don't be too ambition. ;-) # don't be too ambition. ;-)
#QQ Something broke after the last merge. :-( /2003-03-19 call ip(200)|
#QQ call ip(200)|
# We don't want to select the entire table here, just pick a few # We don't want to select the entire table here, just pick a few
# examples. # 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 table primes|
drop procedure opp| drop procedure opp|
drop procedure ip| drop procedure ip|
......
...@@ -50,10 +50,15 @@ sp_map_result_type(enum enum_field_types type) ...@@ -50,10 +50,15 @@ sp_map_result_type(enum enum_field_types type)
static Item * static Item *
eval_func_item(THD *thd, Item *it, enum enum_field_types type) eval_func_item(THD *thd, Item *it, enum enum_field_types type)
{ {
DBUG_ENTER("eval_func_item");
it= it->this_item(); it= it->this_item();
DBUG_PRINT("info", ("type: %d", type));
if (it->fix_fields(thd, 0, NULL)) 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? */ /* QQ How do we do this? Is there some better way? */
if (type == MYSQL_TYPE_NULL) if (type == MYSQL_TYPE_NULL)
...@@ -62,9 +67,11 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type) ...@@ -62,9 +67,11 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
{ {
switch (sp_map_result_type(type)) { switch (sp_map_result_type(type)) {
case INT_RESULT: case INT_RESULT:
DBUG_PRINT("info", ("INT_RESULT: %d", it->val_int()));
it= new Item_int(it->val_int()); it= new Item_int(it->val_int());
break; break;
case REAL_RESULT: case REAL_RESULT:
DBUG_PRINT("info", ("REAL_RESULT: %g", it->val()));
it= new Item_real(it->val()); it= new Item_real(it->val());
break; break;
default: default:
...@@ -73,6 +80,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type) ...@@ -73,6 +80,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
String tmp(buffer, sizeof(buffer), it->charset()); String tmp(buffer, sizeof(buffer), it->charset());
String *s= it->val_str(&tmp); 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()), it= new Item_string(sql_strmake(s->c_ptr_quick(), s->length()),
s->length(), it->charset()); s->length(), it->charset());
break; break;
...@@ -80,7 +88,7 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type) ...@@ -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) sp_head::sp_head(LEX_STRING *name, LEX *lex)
...@@ -209,7 +217,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) ...@@ -209,7 +217,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
else else
{ {
if (pvar->mode == sp_param_out) if (pvar->mode == sp_param_out)
nctx->push_item(it->this_item()); // OUT nctx->push_item(NULL); // OUT
else else
nctx->push_item(eval_func_item(thd, it, pvar->type)); // IN or INOUT 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. // Note: If it's OUT or INOUT, it must be a variable.
......
...@@ -65,10 +65,14 @@ sp_pcontext::find_pvar(LEX_STRING *name) ...@@ -65,10 +65,14 @@ sp_pcontext::find_pvar(LEX_STRING *name)
while (i-- > 0) 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, if (my_strncasecmp(system_charset_info,
name->str, name->str,
m_pvar[i].name->const_string()->ptr(), m_pvar[i].name->const_string()->ptr(),
name->length) == 0) len) == 0)
{ {
return m_pvar + i; 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