Commit a8e1eef8 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Reset connection support in mysqltest (port from mysql)

parent bb825194
......@@ -384,6 +384,7 @@ enum enum_commands {
Q_RESULT_FORMAT_VERSION,
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
Q_ENABLE_PREPARE_WARNINGS, Q_DISABLE_PREPARE_WARNINGS,
Q_RESET_CONNECTION,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
Q_COMMENT_WITH_COMMAND,
......@@ -491,6 +492,7 @@ const char *command_names[]=
"send_eval",
"enable_prepare_warnings",
"disable_prepare_warnings",
"reset_connection",
0
};
......@@ -6503,6 +6505,29 @@ void do_delimiter(struct st_command* command)
}
/*
do_reset_connection
DESCRIPTION
Reset the current session.
*/
static void do_reset_connection()
{
MYSQL *mysql = cur_con->mysql;
DBUG_ENTER("do_reset_connection");
if (mysql_reset_connection(mysql))
die("reset connection failed: %s", mysql_error(mysql));
if (cur_con->stmt)
{
mysql_stmt_close(cur_con->stmt);
cur_con->stmt= NULL;
}
DBUG_VOID_RETURN;
}
my_bool match_delimiter(int c, const char *delim, uint length)
{
uint i;
......@@ -9543,6 +9568,9 @@ int main(int argc, char **argv)
case Q_PING:
handle_command_error(command, mysql_ping(cur_con->mysql), -1);
break;
case Q_RESET_CONNECTION:
do_reset_connection();
break;
case Q_SEND_SHUTDOWN:
handle_command_error(command,
mysql_shutdown(cur_con->mysql,
......
FLUSH STATUS;
SHOW local STATUS LIKE 'com_select';
Variable_name Value
Com_select 10
SHOW local STATUS LIKE 'com_select';
Variable_name Value
Com_select 0
FLUSH STATUS;
--disable_result_log
--disable_query_log
let $i = 10;
begin;
while ($i)
{
dec $i;
SELECT 1;
}
commit;
--enable_query_log
--enable_result_log
SHOW local STATUS LIKE 'com_select';
--reset_connection
SHOW local STATUS LIKE 'com_select';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment