summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-06-21 14:22:22 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-06-21 14:22:22 +0300
commita42c80bd480c2060eca30101dab20ea6f6418bc8 (patch)
treea0a7ab27e52c867637c51ac7126abea15cc4c049 /client
parentbcedb4200f26468d33f7064c1e6e126d81b21162 (diff)
parentbaf0ef9a18fa69e97deb750d9fa545dd4f162596 (diff)
downloadmariadb-git-a42c80bd480c2060eca30101dab20ea6f6418bc8.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 4c4e747e69d..3a15972acaf 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2020, MariaDB
+ Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -91,6 +91,8 @@ static my_bool non_blocking_api_enabled= 0;
#define QUERY_PRINT_ORIGINAL_FLAG 4
+#define CLOSED_CONNECTION "-closed_connection-"
+
#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
@@ -5583,11 +5585,13 @@ void do_close_connection(struct st_command *command)
my_free(con->name);
/*
- When the connection is closed set name to "-closed_connection-"
+ When the connection is closed set name to CLOSED_CONNECTION
to make it possible to reuse the connection name.
*/
- if (!(con->name = my_strdup(PSI_NOT_INSTRUMENTED, "-closed_connection-", MYF(MY_WME))))
+ if (!(con->name = my_strdup(PSI_NOT_INSTRUMENTED, CLOSED_CONNECTION,
+ MYF(MY_WME))))
die("Out of memory");
+ con->name_len= sizeof(CLOSED_CONNECTION)-1;
if (con == cur_con)
{
@@ -5990,7 +5994,7 @@ void do_connect(struct st_command *command)
con_slot= next_con;
else
{
- if (!(con_slot= find_connection_by_name("-closed_connection-")))
+ if (!(con_slot= find_connection_by_name(CLOSED_CONNECTION)))
die("Connection limit exhausted, you can have max %d connections",
opt_max_connections);
my_free(con_slot->name);
@@ -8603,7 +8607,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
log_file.flush();
dynstr_set(&ds_res, 0);
- if (view_protocol_enabled &&
+ if (view_protocol_enabled && mysql &&
complete_query &&
match_re(&view_re, query))
{
@@ -8649,7 +8653,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
dynstr_free(&query_str);
}
- if (sp_protocol_enabled &&
+ if (sp_protocol_enabled && mysql &&
complete_query &&
match_re(&sp_re, query))
{
@@ -9012,7 +9016,7 @@ static void dump_backtrace(void)
struct st_connection *conn= cur_con;
fprintf(stderr, "read_command_buf (%p): ", read_command_buf);
- my_safe_print_str(read_command_buf, sizeof(read_command_buf));
+ fprintf(stderr, "%.*s\n", (int)read_command_buflen, read_command_buf);
fputc('\n', stderr);
if (conn)