88
88
sp_cond_type_t *val;
92
The scope of a label in Stored Procedures,
93
for name resolution of labels in a parsing context.
98
The labels declared in a parent context are in scope.
102
The labels declared in a parent context are not in scope.
93
The parse-time context, used to keep track on declared variables/parameters,
108
The parse-time context, used to keep track of declared variables/parameters,
94
109
conditions, handlers, cursors and labels, during parsing.
95
110
sp_contexts are organized as a tree, with one object for each begin-end
96
block, plus a root-context for the parameters.
111
block, one object for each exception handler,
112
plus a root-context for the parameters.
97
113
This is used during parsing for looking up defined names (e.g. declared
98
114
variables and visible labels), for error checking, and to calculate offsets
99
115
to be used at runtime. (During execution variable values, active handlers
100
116
and cursors, etc, are referred to by an index in a stack.)
117
Parsing contexts for exception handlers limit the visibility of labels.
101
118
The pcontext tree is also kept during execution and is used for error
102
119
checking (e.g. correct number of parameters), and in the future, used by
106
123
class sp_pcontext : public Sql_alloc
108
sp_pcontext(const sp_pcontext &); /* Prevent use of these */
109
void operator=(sp_pcontext &);
113
sp_pcontext(sp_pcontext *prev);
129
Builds a parsing context root node.
138
Create and push a new context in the tree.
139
@param label_scope label scope for the new parsing context
140
@return the node created
143
push_context(label_scope_type label_scope);
122
// Returns the previous context, not the one we pop
146
Pop a node from the parsing context tree.
147
@return the parent node
393
Constructor for a tree node.
394
@param prev the parent parsing context
395
@param label_scope label_scope for this parsing context
397
sp_pcontext(sp_pcontext *prev, label_scope_type label_scope);
367
400
m_max_var_index -- number of variables (including all types of arguments)
368
401
in this context including all children contexts.
417
450
List<sp_pcontext> m_children; // Children contexts, used for destruction
453
Scope of labels for this parsing context.
455
label_scope_type m_label_scope;
458
sp_pcontext(const sp_pcontext &); /* Prevent use of these */
459
void operator=(sp_pcontext &);
419
460
}; // class sp_pcontext : public Sql_alloc