From f6611aa0ab45aa5586101b34c444b8fab305fac9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Dec 2002 15:40:44 +0100 Subject: 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. --- sql/sp_head.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'sql/sp_head.h') diff --git a/sql/sp_head.h b/sql/sp_head.h index 87f2b78b9fd..097eb6718e6 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -24,6 +24,8 @@ #include +struct sp_label; + class sp_instr; class sp_head : public Sql_alloc @@ -72,11 +74,14 @@ public: void restore_lex(THD *thd); + // Put the instruction on the backpatch list, associated with the label. void - push_backpatch(sp_instr *i); + push_backpatch(sp_instr *, struct sp_label *); + // Update all instruction with this label in the backpatch list to + // the current position. void - backpatch(); + backpatch(struct sp_label *); private: @@ -85,7 +90,12 @@ private: LEX *m_mylex; // My own lex LEX m_lex; // Temp. store for the other lex DYNAMIC_ARRAY m_instr; // The "instructions" - List m_backpatch; // Instructions needing backpaching + typedef struct + { + struct sp_label *lab; + sp_instr *instr; + } bp_t; + List m_backpatch; // Instructions needing backpaching inline sp_instr * get_instr(uint i) -- cgit v1.2.1