Reset connection support in mysqltest (port from mysql)
This commit is contained in:
parent
bb825194b8
commit
a8e1eef899
@ -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,
|
||||
|
7
mysql-test/r/reset_connection.result
Normal file
7
mysql-test/r/reset_connection.result
Normal file
@ -0,0 +1,7 @@
|
||||
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
|
23
mysql-test/t/reset_connection.test
Normal file
23
mysql-test/t/reset_connection.test
Normal file
@ -0,0 +1,23 @@
|
||||
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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user