mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-16708: Unsupported commands for prepared statements
Write a log event to the general log before executing a statemment in PS mode This change fixes failure of the test main.log_tables when it is run in PS mode Updated the test main.events_logs_tests to query mysql.general_log for the command_type 'Query' and 'Execute' in order to have consistent test result both in case the test is run with --ps-protocol and without it
This commit is contained in:
committed by
Sergei Golubchik
parent
7586eead5d
commit
aeca826c5f
@@ -5123,6 +5123,25 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
|
||||
|
||||
/* Go! */
|
||||
|
||||
/*
|
||||
Log COM_EXECUTE to the general log. Note, that in case of SQL
|
||||
prepared statements this causes two records to be output:
|
||||
|
||||
Query EXECUTE <statement name>
|
||||
Execute <statement SQL text>
|
||||
|
||||
This is considered user-friendly, since in the
|
||||
second log entry we output values of parameter markers.
|
||||
|
||||
Do not print anything if this is an SQL prepared statement and
|
||||
we're inside a stored procedure (also called Dynamic SQL) --
|
||||
sub-statements inside stored procedures are not logged into
|
||||
the general log.
|
||||
*/
|
||||
|
||||
if (thd->spcont == nullptr)
|
||||
general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
|
||||
|
||||
if (open_cursor)
|
||||
error= mysql_open_cursor(thd, &result, &cursor);
|
||||
else
|
||||
@@ -5208,24 +5227,6 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
|
||||
thd->protocol->send_out_parameters(&this->lex->param_list);
|
||||
}
|
||||
|
||||
/*
|
||||
Log COM_EXECUTE to the general log. Note, that in case of SQL
|
||||
prepared statements this causes two records to be output:
|
||||
|
||||
Query EXECUTE <statement name>
|
||||
Execute <statement SQL text>
|
||||
|
||||
This is considered user-friendly, since in the
|
||||
second log entry we output values of parameter markers.
|
||||
|
||||
Do not print anything if this is an SQL prepared statement and
|
||||
we're inside a stored procedure (also called Dynamic SQL) --
|
||||
sub-statements inside stored procedures are not logged into
|
||||
the general log.
|
||||
*/
|
||||
if (likely(error == 0 && thd->spcont == NULL))
|
||||
general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
|
||||
|
||||
error:
|
||||
thd->lex->restore_set_statement_var();
|
||||
flags&= ~ (uint) IS_IN_USE;
|
||||
|
Reference in New Issue
Block a user