summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-05-21 13:26:16 +0400
committerAlexander Barkov <bar@mariadb.com>2018-05-21 13:26:16 +0400
commit44d00fba431eb933ea6d4cca7643282f957104b1 (patch)
treec394cbb363f68798c4f69968372537ab9b1af0ff /sql/item.h
parentcc231c9f1edcc6e87881ba2f0df5c2524b7ea356 (diff)
downloadmariadb-git-44d00fba431eb933ea6d4cca7643282f957104b1.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;
};