summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-05-21 13:26:16 +0400
committerVladislav Vaintroub <wlad@mariadb.com>2018-05-21 16:34:11 +0000
commit1e69d3f19616d2ac52608db4422a018930b32b0d (patch)
tree9cadb4bb0459e6d723ca284f15ec98b1d4a25b50 /sql/item.h
parent7d91d98ac12a849eebc553989b706bb820b94d79 (diff)
downloadmariadb-git-1e69d3f19616d2ac52608db4422a018930b32b0d.tar.gz
Addressing Monty's review suggestions for MDEV-11952 Oracle-style packages (partial)
- Using array_elements() instead of a constant to iterate through an array - Adding some comments - Adding new-line function comments - Using STRING_WITH_LEN instead of C_STRING_WITH_LEN
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index df6c922f300..dcbe41de97f 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -368,11 +368,37 @@ typedef enum monotonicity_info
class sp_rcontext;
+/**
+ A helper class to collect different behavior of various kinds of SP variables:
+ - local SP variables and SP parameters
+ - PACKAGE BODY routine variables
+ - (there will be more kinds in the future)
+*/
+
class Sp_rcontext_handler
{
public:
virtual ~Sp_rcontext_handler() {}
+ /**
+ A prefix used for SP variable names in queries:
+ - EXPLAIN EXTENDED
+ - SHOW PROCEDURE CODE
+ Local variables and SP parameters have empty prefixes.
+ Package body variables are marked with a special prefix.
+ This improves readability of the output of these queries,
+ especially when a local variable or a parameter has the same
+ name with a package body variable.
+ */
virtual const LEX_CSTRING *get_name_prefix() const= 0;
+ /**
+ At execution time THD->spcont points to the run-time context (sp_rcontext)
+ of the currently executed routine.
+ Local variables store their data in the sp_rcontext pointed by thd->spcont.
+ Package body variables store data in separate sp_rcontext that belongs
+ to the package.
+ This method provides access to the proper sp_rcontext structure,
+ depending on the SP variable kind.
+ */
virtual sp_rcontext *get_rcontext(sp_rcontext *ctx) const= 0;
};