Commit eeb6f578 authored by unknown's avatar unknown

Restoring old code to be used with 4.0 server if 4.1-compient query fails.

Restoring displaying database and user which was removed in a mistake
in the previous change.

parent a7ad88a4
...@@ -2841,6 +2841,18 @@ com_status(String *buffer __attribute__((unused)), ...@@ -2841,6 +2841,18 @@ com_status(String *buffer __attribute__((unused)),
usage(1); /* Print version */ usage(1); /* Print version */
if (connected) if (connected)
{ {
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
if (!mysql_query(&mysql,"select DATABASE(), USER() limit 1") &&
(result=mysql_use_result(&mysql)))
{
MYSQL_ROW cur=mysql_fetch_row(result);
if (cur)
{
tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");
tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]);
}
mysql_free_result(result);
}
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if (mysql.net.vio && mysql.net.vio->ssl_arg && if (mysql.net.vio && mysql.net.vio->ssl_arg &&
SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg)) SSL_get_cipher((SSL*) mysql.net.vio->ssl_arg))
...@@ -2887,6 +2899,12 @@ com_status(String *buffer __attribute__((unused)), ...@@ -2887,6 +2899,12 @@ com_status(String *buffer __attribute__((unused)),
} }
mysql_free_result(result); mysql_free_result(result);
} }
else
{
/* Probably pre-4.1 server */
tee_fprintf(stdout, "Client characterset:\t%s\n", charset_info->csname);
tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->csname);
}
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket) if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
......
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