diff options
author | unknown <pem@mysql.com> | 2002-12-11 14:24:29 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2002-12-11 14:24:29 +0100 |
commit | 37ce17e2cd6e796ca19674fb42f91bd153aaedf2 (patch) | |
tree | c0a89d8aee02a69b9c85212ad22f3f7a5e31ca64 /sql/sp_pcontext.cc | |
parent | 27de9ece815b04651db03ed3d413374f42c9d894 (diff) | |
download | mariadb-git-37ce17e2cd6e796ca19674fb42f91bd153aaedf2.tar.gz |
Fixed bugs in the parameter evaluation and modified the execution engine
for better jump support. Some flow control support added too (but not
complete).
sql/lex.h:
Added more keywords for embedded SQL.
sql/sp_head.cc:
Fixed bugs in the parameter evaluation.
Modified execute() for better jump support.
Added jump instruction and backpatch support.
sql/sp_head.h:
Fixed bugs in the parameter evaluation.
Modified execute() for better jump support.
Added jump instruction and backpatch support.
sql/sp_pcontext.cc:
Added label support.
sql/sp_pcontext.h:
Added label support.
sql/sql_yacc.yy:
Outlined flow control constructs (parses, but nothing generated yet).
Diffstat (limited to 'sql/sp_pcontext.cc')
-rw-r--r-- | sql/sp_pcontext.cc | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index d2ab8cb93ac..9dc995f582f 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -24,14 +24,16 @@ #include "mysql_priv.h" #include "sp_pcontext.h" +#include "sp_head.h" sp_pcontext::sp_pcontext() - : m_params(0), m_framesize(0), m_i(0) + : m_params(0), m_framesize(0), m_i(0), m_genlab(0) { m_pvar_size = 16; m_pvar = (sp_pvar_t *)my_malloc(m_pvar_size * sizeof(sp_pvar_t), MYF(MY_WME)); if (m_pvar) memset(m_pvar, 0, m_pvar_size * sizeof(sp_pvar_t)); + m_label.empty(); } void @@ -89,3 +91,41 @@ sp_pcontext::push(LEX_STRING *name, enum enum_field_types type, m_i += 1; } } + +void +sp_pcontext::push_label(char *name, uint ip) +{ + sp_label_t *lab = (sp_label_t *)my_malloc(sizeof(sp_label_t), MYF(MY_WME)); + + if (lab) + { + lab->name= name; + lab->ip= ip; + m_label.push_front(lab); + } +} + +void +sp_pcontext::push_gen_label(uint ip) +{ + char *s= my_malloc(10, MYF(MY_WME)); // 10=... + + if (s) + { + sprintf(s, ".%08x", m_genlab++); // ...9+1 + push_label(s, ip); + } +} + +sp_label_t * +sp_pcontext::find_label(char *name) +{ + List_iterator_fast<sp_label_t> li(m_label); + sp_label_t *lab; + + while ((lab= li++)) + if (strcasecmp(name, lab->name) == 0) + return lab; + + return NULL; +} |