1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-5816: Stored programs: validation of stored program statements

For those SP instructions that need to get access to ia LEX object
on execution, added storing of their original sql expressions inside
classes derived from the class sp_lex_instr.

A stored sql expression is returned by the abstract method
  sp_lex_instr::get_expr_query
redefined in derived classes.

Since an expression constituting a SP instruction can be invalid
SQL statement in general case (not parseable statement), the virtual
method sp_lex_instr::get_query() is introduced to return a valid string
for a statement that corresponds to the given instruction.

Additionally, introduced the rule remember_start_opt in the grammar.
The new rule intended to get correct position of a current
token taking into attention the fact whether lookahead was done or not.
This commit is contained in:
Dmitry Shulga
2023-07-19 17:53:55 +07:00
parent 6840af6e01
commit 5a8b9a16d1
11 changed files with 606 additions and 193 deletions

View File

@ -8035,5 +8035,21 @@ public:
}
};
/**
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 */