Fixed the broken backpatching implementation.

Implemented IF-THEN-ELSE.


sql/sp_head.cc:
  Reimplemented the broken backpatching, so it works for nested constructions and
  IF-THEN-ELSE too.
sql/sp_head.h:
  Reimplemented the broken backpatching, so it works for nested constructions and
  IF-THEN-ELSE too.
sql/sp_pcontext.cc:
  Return the value from push-methods, for convenience.
sql/sp_pcontext.h:
  Return the value from push-methods, for convenience.
sql/sql_yacc.yy:
  Implemented IF-THEN-ELSE.
  Corrected for the new backpatch method.
This commit is contained in:
unknown 2002-12-16 15:40:44 +01:00
commit f6611aa0ab
5 changed files with 96 additions and 34 deletions

View file

@ -92,7 +92,7 @@ sp_pcontext::push(LEX_STRING *name, enum enum_field_types type,
}
}
void
sp_label_t *
sp_pcontext::push_label(char *name, uint ip)
{
sp_label_t *lab = (sp_label_t *)my_malloc(sizeof(sp_label_t), MYF(MY_WME));
@ -103,18 +103,21 @@ sp_pcontext::push_label(char *name, uint ip)
lab->ip= ip;
m_label.push_front(lab);
}
return lab;
}
void
sp_label_t *
sp_pcontext::push_gen_label(uint ip)
{
sp_label_t *lab= NULL;
char *s= my_malloc(10, MYF(MY_WME)); // 10=...
if (s)
{
sprintf(s, ".%08x", m_genlab++); // ...9+1
push_label(s, ip);
lab= push_label(s, ip);
}
return lab;
}
sp_label_t *