From: Kristofer Pettersson Date: July 1 2009 11:52pm Subject: bzr commit into mysql-5.1-bugteam branch (kristofer.pettersson:2990) Bug#37274 List-Archive: http://lists.mysql.com/commits/77715 X-Bug: 37274 Message-Id: <0KM400A1KNNA71B0@fe-emea-09.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_govv2OpCrOyPSJDw9f35Vg)" --Boundary_(ID_govv2OpCrOyPSJDw9f35Vg) MIME-version: 1.0 Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Content-disposition: inline #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) --Boundary_(ID_govv2OpCrOyPSJDw9f35Vg) MIME-version: 1.0 Content-type: text/bzr-bundle; CHARSET=US-ASCII; name*0="bzr/kristofer.pettersson@stripped"; name*1=1235211-4wu5gqeqms7yr2ox.bundle Content-transfer-encoding: 7BIT Content-disposition: inline; filename*0="bzr/kristofer.pettersson@stripped"; filename*1=1235211-4wu5gqeqms7yr2ox.bundle # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: kristofer.pettersson@stripped\ # 4wu5gqeqms7yr2ox # target_branch: file:///Users/thek/Development/51-bug37274/ # testament_sha1: a865f31f851decd7ce110e77c88fa91acd14cc6f # timestamp: 2009-07-02 01:52:21 +0200 # base_revision_id: satya.bn@stripped # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWWlLt10AAenfgFAQeff//3rp 3QS////+UAUuumbq9e7j0cl7ic9z3CUTSKeTI9TVP0NNCnp6R6AiPU0DQ9TQ2kGT0gSSiU/GRNPT JE0aaQegARgCMIMmADRMKNCniRoyMQ00BoGgGQAA9RoEkRMpip7EnqZT1B6P1NTSGg0B6jI0AGgA lEJkTaaJJ+U8mibVM0majAm1MmhoAANL7wP9RX4UmOwzz9/kfiXzjKlFdnkzPhMjCo9dET2enBUF DJ3wyrpqAUkLTD69fwLmefEe/usMxM+alHMN2H4WL6wjj5dXKjZ5WLeVeJXBU2xHoxeEU3Ga5MSM 0OY/P7rMiue4ivGiozE1s3RtB1WZf6titVhwKp3cKFeWRYRcg5p0ncQVTfr7NlXTNope/a9dN6oR tGRoKIY/FqDA6VYqsDJj2d61XMJX6pLtzALAQW0S0W9nrcWelMkUlck7aEoWtI40qcmKjSO9FM8k mZsGbAvxgIiQIoOsvHUCIy0iKjKIjwFZKxyRzcKiuZlxzFZXbalrvFKTUBgWuYlwVW8zxo0gtKVZ NZS6wwSQWVAysgV2QiFoThzCt6tCyGCMgurMBPl0E4XEDFEVkIJ78bRMtNowYKkxEsuNxdegTC8I lgDLPeuUsUgSogiLiErip5MUemMWnTmIcurIWG1NCRkgZj1Fn+20RJ9gwxlixmwXXcytJbsxjpfP aUoD00Kd7R544YSSBMUHYSvElWxRLadc0rIlWoZSl2AgWCJrH1j4qspKT5DH0KjdE9Zq0uo4aYuy A/Ub413FPaSqJ0qcJOvXflHPVqMYhgbGQYr6NAOkETGZAYaVIwfnWq57P37Rmos+czJCcvxPNCcf jBh112JgwRrG+T2XOIs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