#At file:///Users/thek/Development/51-bug37274/ based on revid:satya.bn@stripped
2990 Kristofer Pettersson 2009-07-02
Bug#37274 client 'status' command doesn't print all info after losing connection to server
If the server connection was lost during repeated status commands,
the client would fail to detect this and the client output would be inconsistent.
This patch fixes this issue by making sure that the server is online
before the client attempts to execute the status command.
The patch is a contribution originally suggested by Andrew Hutchings.
modified:
client/mysql.cc
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2009-06-29 14:00:47 +0000
+++ b/client/mysql.cc 2009-07-01 23:52:11 +0000
@@ -4261,9 +4261,24 @@ com_status(String *buffer __attribute__(
const char *status_str;
char buff[40];
ulonglong id;
+ int error;
MYSQL_RES *result;
LINT_INIT(result);
+ /* Test to see if connection is alive first */
+
+ if (mysql_ping(&mysql))
+ {
+ error= mysql_errno(&mysql);
+ if (error != CR_SERVER_GONE_ERROR)
+ return error;
+ if (!opt_reconnect || reconnect())
+ {
+ tee_fprintf(stdout, "The connection to the server was lost.\n");
+ return 0;
+ }
+ }
+
tee_puts("--------------", stdout);
usage(1); /* Print version */
if (connected)
Attachment: [text/bzr-bundle]
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (kristofer.pettersson:2990)Bug#37274 | Kristofer Pettersson | 2 Jul |