summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-03-09 14:26:10 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2018-06-25 18:49:14 +0200
commita8e1eef89940892f7ae87a512c2ace60372d450a (patch)
tree2bf7c48063ae824909df0f5c94a37ace73407421 /client
parentbb825194b87da63126960656e86a18692b381b12 (diff)
downloadmariadb-git-a8e1eef89940892f7ae87a512c2ace60372d450a.tar.gz
Reset connection support in mysqltest (port from mysql)
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index aadb46da0c1..ebfa9ec0bb8 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -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,