summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2006-04-18 11:07:34 +0200
committerunknown <pem@mysql.com>2006-04-18 11:07:34 +0200
commit661165ee1002751c9f58fe71aa629dac7f5f7d90 (patch)
tree2a15be5d9efaec8002a29111e29209f9a5111925 /sql
parentaadfa648b3e568667198d349e93f44d82873cc01 (diff)
downloadmariadb-git-661165ee1002751c9f58fe71aa629dac7f5f7d90.tar.gz
Fixed BUG#18949: Test case sp-goto is disabled
Removed sp-goto.test, sp-goto.result and all (disabled) GOTO code. Also removed some related code that's not needed any more (no possible unresolved label references any more, so no need to check for them). NB: Keeping the ER_SP_GOTO_IN_HNDLR in errmsg.txt; it might become useful in the future, and removing it (and thus re-enumerating error codes) might upset things. (Anything referring to explicit error codes.) BitKeeper/deleted/.del-sp-goto.result~f343103c63f64b7a: Delete: mysql-test/r/sp-goto.result BitKeeper/deleted/.del-sp-goto.test~5054d3f729692d3d: Delete: mysql-test/t/sp-goto.test mysql-test/t/disabled.def: sp-goto.test no longer exists. sql/lex.h: Removed (disabled) GOTO definitions. sql/sp_head.cc: Removed sp_head::check_backpatch() and simplified sp_head::backpatch(). Without GOTO, unresolved label references are not possible, so no need to check for them. sql/sp_head.h: Removed sp_head::check_backpatch(). (Not needed with no GOTO) sql/sp_pcontext.cc: SP_LAB_GOTO was renamed to SP_LAB_IMPL sql/sp_pcontext.h: Removed SP_LAB_REF (no longer needed) and renamed SP_LAB_GOTO to SP_LAB_IMPL, since it's only used for implicit labels now. sql/sql_yacc.yy: Removed GOTO symbols and (disabled) code, and the no longer needed sp_head::check_backpatch() calls.
Diffstat (limited to 'sql')
-rw-r--r--sql/lex.h7
-rw-r--r--sql/sp_head.cc37
-rw-r--r--sql/sp_head.h7
-rw-r--r--sql/sp_pcontext.cc2
-rw-r--r--sql/sp_pcontext.h7
-rw-r--r--sql/sql_yacc.yy90
6 files changed, 6 insertions, 144 deletions
diff --git a/sql/lex.h b/sql/lex.h
index 1acfbaac211..68f34d8de93 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -215,9 +215,6 @@ static SYMBOL symbols[] = {
{ "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION)},
{ "GET_FORMAT", SYM(GET_FORMAT)},
{ "GLOBAL", SYM(GLOBAL_SYM)},
-#ifdef SP_GOTO
- { "GOTO", SYM(GOTO_SYM)},
-#endif
{ "GRANT", SYM(GRANT)},
{ "GRANTS", SYM(GRANTS)},
{ "GROUP", SYM(GROUP)},
@@ -265,10 +262,6 @@ static SYMBOL symbols[] = {
{ "KEY", SYM(KEY_SYM)},
{ "KEYS", SYM(KEYS)},
{ "KILL", SYM(KILL_SYM)},
-#ifdef SP_GOTO
- /* QQ This will go away when the GOTO label syntax is fixed */
- { "LABEL", SYM(LABEL_SYM)},
-#endif
{ "LANGUAGE", SYM(LANGUAGE_SYM)},
{ "LAST", SYM(LAST_SYM)},
{ "LEADING", SYM(LEADING)},
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 15d621b1d6d..6b7cdb1ea98 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1670,44 +1670,11 @@ sp_head::backpatch(sp_label_t *lab)
while ((bp= li++))
{
- if (bp->lab == lab ||
- (bp->lab->type == SP_LAB_REF &&
- my_strcasecmp(system_charset_info, bp->lab->name, lab->name) == 0))
- {
- if (bp->lab->type != SP_LAB_REF)
- bp->instr->backpatch(dest, lab->ctx);
- else
- {
- sp_label_t *dstlab= bp->lab->ctx->find_label(lab->name);
-
- if (dstlab)
- {
- bp->lab= lab;
- bp->instr->backpatch(dest, dstlab->ctx);
- }
- }
- }
- }
-}
-
-int
-sp_head::check_backpatch(THD *thd)
-{
- bp_t *bp;
- List_iterator_fast<bp_t> li(m_backpatch);
-
- while ((bp= li++))
- {
- if (bp->lab->type == SP_LAB_REF)
- {
- my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "GOTO", bp->lab->name);
- return -1;
- }
+ if (bp->lab == lab)
+ bp->instr->backpatch(dest, lab->ctx);
}
- return 0;
}
-
/*
Prepare an instance of create_field for field creation (fill all necessary
attributes).
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 17a5d1ae528..3ad81542ce7 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -263,13 +263,6 @@ public:
void
backpatch(struct sp_label *);
- // Check that no unresolved references exist.
- // If none found, 0 is returned, otherwise errors have been issued
- // and -1 is returned.
- // This is called by the parser at the end of a create procedure/function.
- int
- check_backpatch(THD *thd);
-
// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
void
new_cont_backpatch(sp_instr_opt_meta *i);
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 448df908a32..b0b65d5313b 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -241,7 +241,7 @@ sp_pcontext::push_label(char *name, uint ip)
{
lab->name= name;
lab->ip= ip;
- lab->type= SP_LAB_GOTO;
+ lab->type= SP_LAB_IMPL;
lab->ctx= this;
m_label.push_front(lab);
}
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index e61057537da..2ee77696efb 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -48,10 +48,9 @@ typedef struct sp_variable
} sp_variable_t;
-#define SP_LAB_REF 0 // Unresolved reference (for goto)
-#define SP_LAB_GOTO 1 // Free goto label
-#define SP_LAB_BEGIN 2 // Label at BEGIN
-#define SP_LAB_ITER 3 // Label at iteration control
+#define SP_LAB_IMPL 0 // Implicit label generated by parser
+#define SP_LAB_BEGIN 1 // Label at BEGIN
+#define SP_LAB_ITER 2 // Label at iteration control
/*
An SQL/PSM label. Can refer to the identifier used with the
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 37f72c351e5..0681ac31923 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -301,7 +301,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token GEOMFROMWKB
%token GET_FORMAT
%token GLOBAL_SYM
-%token GOTO_SYM
%token GRANT
%token GRANTS
%token GREATEST_SYM
@@ -1332,8 +1331,6 @@ create_function_tail:
if (sp->is_not_allowed_in_function("function"))
YYABORT;
- if (sp->check_backpatch(YYTHD))
- YYABORT;
lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->init_strings(YYTHD, lex, lex->spname);
if (!(sp->m_flags & sp_head::HAS_RETURN))
@@ -2054,91 +2051,6 @@ sp_proc_stmt:
sp->add_instr(i);
}
}
- | LABEL_SYM IDENT
- {
-#ifdef SP_GOTO
- LEX *lex= Lex;
- sp_head *sp= lex->sphead;
- sp_pcontext *ctx= lex->spcont;
- sp_label_t *lab= ctx->find_label($2.str);
-
- if (lab)
- {
- my_error(ER_SP_LABEL_REDEFINE, MYF(0), $2.str);
- YYABORT;
- }
- else
- {
- lab= ctx->push_label($2.str, sp->instructions());
- lab->type= SP_LAB_GOTO;
- lab->ctx= ctx;
- sp->backpatch(lab);
- }
-#else
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
-#endif
- }
- | GOTO_SYM IDENT
- {
-#ifdef SP_GOTO
- LEX *lex= Lex;
- sp_head *sp= lex->sphead;
- sp_pcontext *ctx= lex->spcont;
- uint ip= lex->sphead->instructions();
- sp_label_t *lab;
- sp_instr_jump *i;
- sp_instr_hpop *ih;
- sp_instr_cpop *ic;
-
- if (sp->m_in_handler)
- {
- my_message(ER_SP_GOTO_IN_HNDLR, ER(ER_SP_GOTO_IN_HNDLR), MYF(0));
- YYABORT;
- }
- lab= ctx->find_label($2.str);
- if (! lab)
- {
- lab= (sp_label_t *)YYTHD->alloc(sizeof(sp_label_t));
- lab->name= $2.str;
- lab->ip= 0;
- lab->type= SP_LAB_REF;
- lab->ctx= ctx;
-
- ih= new sp_instr_hpop(ip++, ctx, 0);
- sp->push_backpatch(ih, lab);
- sp->add_instr(ih);
- ic= new sp_instr_cpop(ip++, ctx, 0);
- sp->add_instr(ic);
- sp->push_backpatch(ic, lab);
- i= new sp_instr_jump(ip, ctx);
- sp->push_backpatch(i, lab); /* Jumping forward */
- sp->add_instr(i);
- }
- else
- {
- uint n;
-
- n= ctx->diff_handlers(lab->ctx);
- if (n)
- {
- ih= new sp_instr_hpop(ip++, ctx, n);
- sp->add_instr(ih);
- }
- n= ctx->diff_cursors(lab->ctx);
- if (n)
- {
- ic= new sp_instr_cpop(ip++, ctx, n);
- sp->add_instr(ic);
- }
- i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
- sp->add_instr(i);
- }
-#else
- yyerror(ER(ER_SYNTAX_ERROR));
- YYABORT;
-#endif
- }
| OPEN_SYM ident
{
LEX *lex= Lex;
@@ -9228,8 +9140,6 @@ sp_tail:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
- if (sp->check_backpatch(YYTHD))
- YYABORT;
sp->init_strings(YYTHD, lex, $3);
lex->sql_command= SQLCOM_CREATE_PROCEDURE;
/* Restore flag if it was cleared above */