Below is the list of changes that have just been committed into a local
5.0 repository of mysqldev. When mysqldev 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, 2006-10-17 19:12:34+02:00, tsmith@stripped +2 -0
mysql.cc, log.cc:
WL #3516: MySQL Enterprise: implement Version Display Specification
client/mysql.cc@stripped, 2006-10-17 19:11:16+02:00, tsmith@stripped +44 -10
WL #3516: MySQL Enterprise: implement Version Display Specification
sql/log.cc@stripped, 2006-10-17 19:11:16+02:00, tsmith@stripped +7 -4
WL #3516: MySQL Enterprise: implement Version Display Specification
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tsmith
# Host: production.mysql.com
# Root: /data0/mysqldev/my/mysql-5.0-enterprise
--- 1.218/client/mysql.cc 2006-10-17 19:12:41 +02:00
+++ 1.219/client/mysql.cc 2006-10-17 19:12:41 +02:00
@@ -49,6 +49,9 @@
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
+/* Buffer to hold 'version' and 'version_comment' */
+#define MAX_SERVER_VERSION_LENGTH 128
+
gptr sql_alloc(unsigned size); // Don't use mysqld alloc for these
void sql_element_free(void *ptr);
#include "sql_string.h"
@@ -208,6 +211,7 @@
static int read_and_execute(bool interactive);
static int sql_connect(char *host,char *database,char *user,char *password,
uint silent);
+static const char *server_version_string(MYSQL *mysql);
static int put_info(const char *str,INFO_TYPE info,uint error=0,
const char *sql_state=0);
static int put_error(MYSQL *mysql);
@@ -432,8 +436,8 @@
put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
INFO_INFO);
sprintf((char*) glob_buffer.ptr(),
- "Your MySQL connection id is %lu to server version: %s\n",
- mysql_thread_id(&mysql),mysql_get_server_info(&mysql));
+ "Your MySQL connection id is %lu\nServer version: %s\n",
+ mysql_thread_id(&mysql), server_version_string(&mysql));
put_info((char*) glob_buffer.ptr(),INFO_INFO);
#ifdef HAVE_READLINE
@@ -3335,16 +3339,13 @@
tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : "");
#endif
tee_fprintf(stdout, "Using delimiter:\t%s\n", delimiter);
- tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql));
+ tee_fprintf(stdout, "Server version:\t\t%s\n", server_version_string(&mysql));
tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql));
if ((id= mysql_insert_id(&mysql)))
tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff));
- /*
- Don't remove "limit 1",
- it is protection againts SQL_SELECT_LIMIT=0
- */
+ /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
if (!mysql_query(&mysql,"select @@character_set_client, @@character_set_connection, @@character_set_server, @@character_set_database limit 1") &&
(result=mysql_use_result(&mysql)))
{
@@ -3409,6 +3410,39 @@
return 0;
}
+static const char *
+server_version_string(MYSQL *mysql)
+{
+ static char buf[MAX_SERVER_VERSION_LENGTH] = "";
+
+ /* Only one thread calls this, so no synchronization is needed */
+ if (buf[0] == '\0')
+ {
+ char *bufp = buf;
+ MYSQL_RES *result;
+ MYSQL_ROW cur;
+
+ bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf);
+
+ /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
+ if (!mysql_query(mysql, "select @@version_comment limit 1") &&
+ (result = mysql_use_result(mysql)))
+ {
+ MYSQL_ROW cur = mysql_fetch_row(result);
+ if (cur && cur[0])
+ {
+ bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS);
+ }
+ mysql_free_result(result);
+ }
+
+ /* str*nmov doesn't guarantee NUL-termination */
+ if (bufp == buf + sizeof buf)
+ buf[sizeof buf - 1] = '\0';
+ }
+
+ return buf;
+}
static int
put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
@@ -3536,14 +3570,14 @@
{
NETWARE_YIELD;
fputs(s, file);
- fputs("\n", file);
+ fputc('\n', file);
#ifdef OS2
- fflush( file);
+ fflush(file);
#endif
if (opt_outfile)
{
fputs(s, OUTFILE);
- fputs("\n", OUTFILE);
+ fputc('\n', OUTFILE);
}
}
--- 1.195/sql/log.cc 2006-10-17 19:12:41 +02:00
+++ 1.196/sql/log.cc 2006-10-17 19:12:41 +02:00
@@ -566,15 +566,18 @@
case LOG_NORMAL:
{
char *end;
- int len=my_snprintf(buff, sizeof(buff), "%s, Version: %s. "
+ int len=my_snprintf(buff, sizeof(buff), "%s, Version: %s (%s). "
#ifdef EMBEDDED_LIBRARY
- "embedded library\n", my_progname, server_version
+ "embedded library\n",
+ my_progname, server_version, MYSQL_COMPILATION_COMMENT
#elif __NT__
"started with:\nTCP Port: %d, Named Pipe: %s\n",
- my_progname, server_version, mysqld_port, mysqld_unix_port
+ my_progname, server_version, MYSQL_COMPILATION_COMMENT,
+ mysqld_port, mysqld_unix_port
#else
"started with:\nTcp port: %d Unix socket: %s\n",
- my_progname,server_version,mysqld_port,mysqld_unix_port
+ my_progname, server_version, MYSQL_COMPILATION_COMMENT,
+ mysqld_port, mysqld_unix_port
#endif
);
end=strnmov(buff+len,"Time Id Command Argument\n",
| Thread |
|---|
| • bk commit into 5.0 tree (tsmith:1.2292) | tsmith | 17 Oct |