MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:msvensson Date:August 28 2007 2:39pm
Subject:bk commit into 5.0 tree (msvensson:1.2513)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-28 16:39:23+02:00, msvensson@pilot.(none) +1 -0
  Streamline "do_close_connection" and "do_send_quit"
  Fix typo, "next_con" -> "con"

  client/mysqltest.c@stripped, 2007-08-28 16:39:22+02:00, msvensson@pilot.(none) +45 -52
    Reuse "find_connection_by_name" both from "do_close_connection" and "do_send_quit"
    Adjust alignment of comment
    Fix typo in "do_close_connection", it used the global variable "next_con" instead
    of local variable "con"

diff -Nrup a/client/mysqltest.c b/client/mysqltest.c
--- a/client/mysqltest.c	2007-08-28 15:32:12 +02:00
+++ b/client/mysqltest.c	2007-08-28 16:39:22 +02:00
@@ -2983,15 +2983,16 @@ void do_diff_files(struct st_command *co
   DBUG_VOID_RETURN;
 }
 
-  /*
-    SYNOPSIS
-    do_send_quit
-    command	called command
 
-    DESCRIPTION
-    Sends a simple quit command to the server for the named connection.
+/*
+  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)
 {
@@ -3002,7 +3003,7 @@ void do_send_quit(struct st_command *com
   DBUG_PRINT("enter",("name: '%s'",p));
 
   if (!*p)
-    die("Missing connection name in do_send_quit");
+    die("Missing connection name in send_quit");
   name= p;
   while (*p && !my_isspace(charset_info,*p))
     p++;
@@ -3011,17 +3012,12 @@ void do_send_quit(struct st_command *com
     *p++= 0;
   command->last_argument= p;
 
-  /* Loop through connection pool for connection to close */
-  for (con= connections; con < next_con; con++)
-  {
-    DBUG_PRINT("info", ("con->name: %s", con->name));
-    if (!strcmp(con->name, name))
-    {
-      simple_command(&con->mysql,COM_QUIT,NullS,0,1);
-      DBUG_VOID_RETURN;
-    }
-  }
-  die("connection '%s' not found in connection pool", name);
+  if (!(con= find_connection_by_name(name)))
+    die("connection '%s' not found in connection pool", name);
+
+  simple_command(&con->mysql,COM_QUIT,NullS,0,1);
+
+  DBUG_VOID_RETURN;
 }
 
 
@@ -3919,44 +3915,41 @@ void do_close_connection(struct st_comma
     *p++= 0;
   command->last_argument= p;
 
-  /* Loop through connection pool for connection to close */
-  for (con= connections; con < next_con; con++)
+  if (!(con= find_connection_by_name(name)))
+    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 (!strcmp(con->name, name))
+    if (con->mysql.net.vio)
     {
-      DBUG_PRINT("info", ("Closing connection %s", con->name));
-#ifndef EMBEDDED_LIBRARY
-      if (command->type == Q_DIRTY_CLOSE)
-      {
-	if (con->mysql.net.vio)
-	{
-	  vio_delete(con->mysql.net.vio);
-	  con->mysql.net.vio = 0;
-	}
-      }
+      vio_delete(con->mysql.net.vio);
+      con->mysql.net.vio = 0;
+    }
+  }
 #endif
-      if (next_con->stmt)
-        mysql_stmt_close(next_con->stmt);
-      next_con->stmt= 0;
-
-      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->stmt)
+    mysql_stmt_close(con->stmt);
+  con->stmt= 0;
+
+  mysql_close(&con->mysql);
+  con->mysql= 0:
+
+  if (con->util_mysql)
+    mysql_close(con->util_mysql);
+  con->util_mysql= 0;
 
-      /*
-        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");
+  my_free(con->name, MYF(0));
 
-      DBUG_VOID_RETURN;
-    }
-  }
-  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;
 }
 
 
Thread
bk commit into 5.0 tree (msvensson:1.2513)msvensson28 Aug