Commit 0ee9467b authored by unknown's avatar unknown

Merge pilot.(none):/data/msvensson/mysql/mysql-5.0-maint

into  pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint


client/mysqltest.c:
  Merge 5.0->5.1
parents f386e295 2bb6a44a
...@@ -2976,15 +2976,30 @@ void do_diff_files(struct st_command *command) ...@@ -2976,15 +2976,30 @@ void do_diff_files(struct st_command *command)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/*
SYNOPSIS
do_send_quit
command called command
DESCRIPTION struct st_connection * find_connection_by_name(const char *name)
Sends a simple quit command to the server for the named connection. {
struct st_connection *con;
for (con= connections; con < next_con; con++)
{
if (!strcmp(con->name, name))
{
return con;
}
}
return 0; /* Connection not found */
}
*/ /*
SYNOPSIS
do_send_quit
command called command
DESCRIPTION
Sends a simple quit command to the server for the named connection.
*/
void do_send_quit(struct st_command *command) void do_send_quit(struct st_command *command)
{ {
...@@ -2995,7 +3010,7 @@ void do_send_quit(struct st_command *command) ...@@ -2995,7 +3010,7 @@ void do_send_quit(struct st_command *command)
DBUG_PRINT("enter",("name: '%s'",p)); DBUG_PRINT("enter",("name: '%s'",p));
if (!*p) if (!*p)
die("Missing connection name in do_send_quit"); die("Missing connection name in send_quit");
name= p; name= p;
while (*p && !my_isspace(charset_info,*p)) while (*p && !my_isspace(charset_info,*p))
p++; p++;
...@@ -3004,17 +3019,12 @@ void do_send_quit(struct st_command *command) ...@@ -3004,17 +3019,12 @@ void do_send_quit(struct st_command *command)
*p++= 0; *p++= 0;
command->last_argument= p; command->last_argument= p;
/* Loop through connection pool for connection to close */ if (!(con= find_connection_by_name(name)))
for (con= connections; con < next_con; con++) die("connection '%s' not found in connection pool", name);
{
DBUG_PRINT("info", ("con->name: %s", con->name)); simple_command(&con->mysql,COM_QUIT,0,0,1);
if (!strcmp(con->name, name))
{ DBUG_VOID_RETURN;
simple_command(&con->mysql,COM_QUIT,0,0,1);
DBUG_VOID_RETURN;
}
}
die("connection '%s' not found in connection pool", name);
} }
...@@ -3855,20 +3865,6 @@ void set_reconnect(MYSQL* mysql, int val) ...@@ -3855,20 +3865,6 @@ void set_reconnect(MYSQL* mysql, int val)
} }
struct st_connection * find_connection_by_name(const char *name)
{
struct st_connection *con;
for (con= connections; con < next_con; con++)
{
if (!strcmp(con->name, name))
{
return con;
}
}
return 0; /* Connection not found */
}
int select_connection_name(const char *name) int select_connection_name(const char *name)
{ {
DBUG_ENTER("select_connection_name"); DBUG_ENTER("select_connection_name");
...@@ -3916,44 +3912,40 @@ void do_close_connection(struct st_command *command) ...@@ -3916,44 +3912,40 @@ void do_close_connection(struct st_command *command)
*p++= 0; *p++= 0;
command->last_argument= p; command->last_argument= p;
/* Loop through connection pool for connection to close */ if (!(con= find_connection_by_name(name)))
for (con= connections; con < next_con; con++) die("connection '%s' not found in connection pool", name);
DBUG_PRINT("info", ("Closing connection %s", con->name));
#ifndef EMBEDDED_LIBRARY
if (command->type == Q_DIRTY_CLOSE)
{ {
DBUG_PRINT("info", ("con->name: %s", con->name)); if (con->mysql.net.vio)
if (!strcmp(con->name, name))
{ {
DBUG_PRINT("info", ("Closing connection %s", con->name)); vio_delete(con->mysql.net.vio);
#ifndef EMBEDDED_LIBRARY con->mysql.net.vio = 0;
if (command->type == Q_DIRTY_CLOSE) }
{ }
if (con->mysql.net.vio)
{
vio_delete(con->mysql.net.vio);
con->mysql.net.vio = 0;
}
}
#endif #endif
if (next_con->stmt) if (con->stmt)
mysql_stmt_close(next_con->stmt); mysql_stmt_close(con->stmt);
next_con->stmt= 0; con->stmt= 0;
mysql_close(&con->mysql); mysql_close(&con->mysql);
if (con->util_mysql)
mysql_close(con->util_mysql);
con->util_mysql= 0;
my_free(con->name, MYF(0));
/* if (con->util_mysql)
When the connection is closed set name to "-closed_connection-" mysql_close(con->util_mysql);
to make it possible to reuse the connection name. con->util_mysql= 0;
*/
if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
die("Out of memory");
DBUG_VOID_RETURN; my_free(con->name, MYF(0));
}
} /*
die("connection '%s' not found in connection pool", name); When the connection is closed set name to "-closed_connection-"
to make it possible to reuse the connection name.
*/
if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
die("Out of memory");
DBUG_VOID_RETURN;
} }
......
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