diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-02-15 12:20:43 +0700 |
---|---|---|
committer | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-02-16 21:53:12 +0700 |
commit | e5693d31e2bbb5be23f0f57e309e280a6de2ac4b (patch) | |
tree | 536d0833b4735d46a777d4ac25e9285cd1716a27 /sql/sql_class.h | |
parent | e12d841ea7c5f4851e3bb8189668ff9de9135e3b (diff) | |
download | mariadb-git-bb-10.8-MDEV-5816.tar.gz |
MDEV-5816: Stored programs: validation of stored program statementsbb-10.8-MDEV-5816
Added storing of sql expression for instruction being parsed inside
the classes derived from the class sp_lex_instr.
Stored sql expression is returned by the abstract method
sp_lex_instr::get_expr_query
redefined in the derived classes.
The virtual method sp_lex_instr::get_query() has beens added to return
a parseable string for a statement that corresponds to the given
instruction.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 0d02f74686f..3a5cf5c12a4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5868,19 +5868,17 @@ private: public: sp_cursor() :result(NULL, false), - m_lex_keeper(NULL), server_side_cursor(NULL) { } - sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper, bool view_structure_only) + sp_cursor(THD *thd_arg, bool view_structure_only) :result(thd_arg, view_structure_only), - m_lex_keeper(lex_keeper), server_side_cursor(NULL) {} virtual ~sp_cursor() { destroy(); } - sp_lex_keeper *get_lex_keeper() { return m_lex_keeper; } + virtual sp_lex_keeper *get_lex_keeper() { return nullptr; } int open(THD *thd); @@ -5893,17 +5891,15 @@ public: bool export_structure(THD *thd, Row_definition_list *list); - void reset(THD *thd_arg, sp_lex_keeper *lex_keeper) + void reset(THD *thd_arg) { sp_cursor_statistics::reset(); result.reset(thd_arg); - m_lex_keeper= lex_keeper; server_side_cursor= NULL; } private: Select_fetch_into_spvars result; - sp_lex_keeper *m_lex_keeper; Server_side_cursor *server_side_cursor; void destroy(); }; @@ -7776,5 +7772,21 @@ extern THD_list server_threads; void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps, uint field_count); + +/** + Make a new string allocated on THD's mem-root. + + @param thd thread handler. + @param start_ptr start of the new string. + @param end_ptr end of the new string. + + @return LEX_CSTRING object, containing a pointer to a newly + constructed/allocated string, and its length. The data member + LEX_CSTRING::str has the value nullptr in case of out-of-memory error. +*/ + +LEX_CSTRING make_string(THD *thd, const char *start_ptr, + const char *end_ptr); + #endif /* MYSQL_SERVER */ #endif /* SQL_CLASS_INCLUDED */ |