summaryrefslogtreecommitdiff
path: root/sql/sp_head.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2002-12-16 15:40:44 +0100
committerunknown <pem@mysql.com>2002-12-16 15:40:44 +0100
commitf6611aa0ab45aa5586101b34c444b8fab305fac9 (patch)
tree6a965cec0f444a67ed29877855da3a7309f6dce5 /sql/sp_head.h
parent390b3e745c05a39704c01365958710189e216f79 (diff)
downloadmariadb-git-f6611aa0ab45aa5586101b34c444b8fab305fac9.tar.gz
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.
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r--sql/sp_head.h16
1 files changed, 13 insertions, 3 deletions
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 <stddef.h>
+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<sp_instr> m_backpatch; // Instructions needing backpaching
+ typedef struct
+ {
+ struct sp_label *lab;
+ sp_instr *instr;
+ } bp_t;
+ List<bp_t> m_backpatch; // Instructions needing backpaching
inline sp_instr *
get_instr(uint i)