List:Commits« Previous MessageNext Message »
From:kent Date:July 28 2006 8:10pm
Subject:bk commit into 5.1 tree (kent:1.2244)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kent. When kent 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-07-28 22:10:34+02:00, kent@stripped +4 -0
  Merge mysql.com:/Users/kent/mysql/bk/autopush/tmp_merge
  into  mysql.com:/Users/kent/mysql/bk/autopush/mysql-5.1
  MERGE: 1.1810.1694.98

  client/mysql.cc@stripped, 2006-07-28 22:10:21+02:00, kent@stripped +0 -0
    Auto merged
    MERGE: 1.199.1.8

  mysql-test/r/func_str.result@stripped, 2006-07-28 22:10:22+02:00, kent@stripped +0 -0
    Auto merged
    MERGE: 1.110.1.6

  sql-common/client.c@stripped, 2006-07-28 22:10:22+02:00, kent@stripped +0 -0
    Auto merged
    MERGE: 1.83.1.11

  sql/item_strfunc.cc@stripped, 2006-07-28 22:10:22+02:00, kent@stripped +0 -0
    Auto merged
    MERGE: 1.261.1.13

# 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:	kent
# Host:	c-4b4072d5.010-2112-6f72651.cust.bredbandsbolaget.se
# Root:	/Users/kent/mysql/bk/autopush/mysql-5.1/RESYNC

--- 1.214/client/mysql.cc	2006-07-28 22:10:50 +02:00
+++ 1.215/client/mysql.cc	2006-07-28 22:10:50 +02:00
@@ -2995,6 +2995,7 @@
 com_use(String *buffer __attribute__((unused)), char *line)
 {
   char *tmp, buff[FN_REFLEN + 1];
+  int select_db;
 
   bzero(buff, sizeof(buff));
   strmov(buff, line);
@@ -3014,34 +3015,52 @@
   if (!current_db || cmp_database(charset_info, current_db,tmp))
   {
     if (one_database)
+    {
       skip_updates= 1;
+      select_db= 0;    // don't do mysql_select_db()
+    }
     else
-    {
-      /*
-	reconnect once if connection is down or if connection was found to
-	be down during query
-      */
-      if (!connected && reconnect())
+      select_db= 2;    // do mysql_select_db() and build_completion_hash()
+  }
+  else
+  {
+    /*
+      USE to the current db specified.
+      We do need to send mysql_select_db() to make server
+      update database level privileges, which might
+      change since last USE (see bug#10979).
+      For performance purposes, we'll skip rebuilding of completion hash.
+    */
+    skip_updates= 0;
+    select_db= 1;      // do only mysql_select_db(), without completion
+  }
+
+  if (select_db)
+  {
+    /*
+      reconnect once if connection is down or if connection was found to
+      be down during query
+    */
+    if (!connected && reconnect())
       return opt_reconnect ? -1 : 1;                        // Fatal error
-      if (mysql_select_db(&mysql,tmp))
-      {
-	if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
-	  return put_error(&mysql);
+    if (mysql_select_db(&mysql,tmp))
+    {
+      if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
+        return put_error(&mysql);
 
-	if (reconnect())
+      if (reconnect())
         return opt_reconnect ? -1 : 1;                      // Fatal error
-	if (mysql_select_db(&mysql,tmp))
-	  return put_error(&mysql);
-      }
-      my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
-      current_db=my_strdup(tmp,MYF(MY_WME));
+      if (mysql_select_db(&mysql,tmp))
+        return put_error(&mysql);
+    }
+    my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
+    current_db=my_strdup(tmp,MYF(MY_WME));
 #ifdef HAVE_READLINE
+    if (select_db > 1)
       build_completion_hash(rehash, 1);
 #endif
-    }
   }
-  else
-    skip_updates= 0;
+
   put_info("Database changed",INFO_INFO);
   return 0;
 }

--- 1.279/sql/item_strfunc.cc	2006-07-28 22:10:50 +02:00
+++ 1.280/sql/item_strfunc.cc	2006-07-28 22:10:50 +02:00
@@ -1038,7 +1038,7 @@
   long length  =(long) args[1]->val_int();
   uint char_pos;
 
-  if ((null_value=args[0]->null_value))
+  if ((null_value=(args[0]->null_value || args[1]->null_value)))
     return 0;
   if (length <= 0)
     return &my_empty_string;
@@ -1078,7 +1078,7 @@
   String *res  =args[0]->val_str(str);
   long length  =(long) args[1]->val_int();
 
-  if ((null_value=args[0]->null_value))
+  if ((null_value=(args[0]->null_value || args[1]->null_value)))
     return 0; /* purecov: inspected */
   if (length <= 0)
     return &my_empty_string; /* purecov: inspected */

--- 1.101/sql-common/client.c	2006-07-28 22:10:50 +02:00
+++ 1.102/sql-common/client.c	2006-07-28 22:10:50 +02:00
@@ -1668,11 +1668,18 @@
 int mysql_init_character_set(MYSQL *mysql)
 {
   NET		*net= &mysql->net;
+  const char *default_collation_name;
+  
   /* Set character set */
-  if (!mysql->options.charset_name &&
-      !(mysql->options.charset_name= 
+  if (!mysql->options.charset_name)
+  {
+    default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
+    if (!(mysql->options.charset_name= 
        my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
     return 1;
+  }
+  else
+    default_collation_name= NULL;
   
   {
     const char *save= charsets_dir;
@@ -1680,6 +1687,28 @@
       charsets_dir=mysql->options.charset_dir;
     mysql->charset=get_charset_by_csname(mysql->options.charset_name,
                                          MY_CS_PRIMARY, MYF(MY_WME));
+    if (mysql->charset && default_collation_name)
+    {
+      CHARSET_INFO *collation;
+      if ((collation= 
+           get_charset_by_name(default_collation_name, MYF(MY_WME))))
+      {
+        if (!my_charset_same(mysql->charset, collation))
+        {
+          my_printf_error(ER_UNKNOWN_ERROR, 
+                         "COLLATION %s is not valid for CHARACTER SET %s",
+                         MYF(0),
+                         default_collation_name, mysql->options.charset_name);
+          mysql->charset= NULL;
+        }
+        else
+        {
+          mysql->charset= collation;
+        }
+      }
+      else
+        mysql->charset= NULL;
+    }
     charsets_dir= save;
   }
   

--- 1.119/mysql-test/r/func_str.result	2006-07-28 22:10:50 +02:00
+++ 1.120/mysql-test/r/func_str.result	2006-07-28 22:10:50 +02:00
@@ -33,6 +33,9 @@
 select position(binary 'll' in 'hello'),position('a' in binary 'hello');
 position(binary 'll' in 'hello')	position('a' in binary 'hello')
 3	0
+select left('hello',null), right('hello',null);
+left('hello',null)	right('hello',null)
+NULL	NULL
 select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
 left('hello',2)	right('hello',2)	substring('hello',2,2)	mid('hello',1,5)
 he	lo	el	hello
Thread
bk commit into 5.1 tree (kent:1.2244)kent28 Jul