diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-08-18 21:36:11 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-10 22:27:39 +0200 |
commit | d7c1e0ebbd272d6198733e8a71f1c16548733262 (patch) | |
tree | 3dcc2742c491e01b9eed59aac53b713b1a122985 /sql/sql_prepare.cc | |
parent | a99af484cd9360c2cea92798bcde594adcf23b7e (diff) | |
download | mariadb-git-d7c1e0ebbd272d6198733e8a71f1c16548733262.tar.gz |
MDEV-5317 Compound statement / anonymous blocks
originally based on the patch by Antony T Curtis
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 9f195b93e23..7c51bbf6426 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2252,6 +2252,7 @@ static bool check_prepared_statement(Prepared_statement *stmt) case SQLCOM_GRANT: case SQLCOM_REVOKE: case SQLCOM_KILL: + case SQLCOM_COMPOUND: case SQLCOM_SHUTDOWN: break; @@ -3287,6 +3288,7 @@ Prepared_statement::~Prepared_statement() free_items(); if (lex) { + delete lex->sphead; delete lex->result; delete (st_lex_local *) lex; } @@ -3465,12 +3467,15 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) if (error == 0) error= check_prepared_statement(this); - /* - Currently CREATE PROCEDURE/TRIGGER/EVENT are prohibited in prepared - statements: ensure we have no memory leak here if by someone tries - to PREPARE stmt FROM "CREATE PROCEDURE ..." - */ - DBUG_ASSERT(lex->sphead == NULL || error != 0); + if (error) + { + /* + let the following code know we're not in PS anymore, + the won't be any EXECUTE, so we need a full cleanup + */ + lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_PREPARE; + } + /* The order is important */ lex->unit.cleanup(); |