List:Commits« Previous MessageNext Message »
From:timour Date:July 21 2006 10:04am
Subject:bk commit into 5.0 tree (timour:1.2208)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tkatchaounov. When tkatchaounov 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-21 13:04:40+03:00, timour@stripped +8 -0
  Merge tkatchaounov@stripped:/home/bk/mysql-5.0-opt
  into  lamia.home:/home/tkatchaounov/autopush/5.0-bug-21007
  MERGE: 1.2196.1.31

  client/mysql.cc@stripped, 2006-07-21 13:04:36+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.205.1.2

  mysql-test/r/date_formats.result@stripped, 2006-07-21 13:04:36+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.22.1.1

  mysql-test/r/func_str.result@stripped, 2006-07-21 13:04:37+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.115.1.1

  mysql-test/t/date_formats.test@stripped, 2006-07-21 13:04:37+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.19.1.1

  mysql-test/t/func_str.test@stripped, 2006-07-21 13:04:37+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.89.1.1

  sql/item_strfunc.cc@stripped, 2006-07-21 13:04:37+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.273.1.3

  sql/sql_class.cc@stripped, 2006-07-21 13:04:37+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.239.1.1

  sql/time.cc@stripped, 2006-07-21 13:04:37+03:00, timour@stripped +0 -0
    Auto merged
    MERGE: 1.57.1.1

# 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:	timour
# Host:	lamia.home
# Root:	/home/tkatchaounov/autopush/5.0-bug-21007/RESYNC

--- 1.275/sql/item_strfunc.cc	2006-07-21 13:04:44 +03:00
+++ 1.276/sql/item_strfunc.cc	2006-07-21 13:04:44 +03:00
@@ -752,44 +752,47 @@ String *Item_func_reverse::val_str(Strin
 {
   DBUG_ASSERT(fixed == 1);
   String *res = args[0]->val_str(str);
-  char *ptr,*end;
+  char *ptr, *end, *tmp;
 
   if ((null_value=args[0]->null_value))
     return 0;
   /* An empty string is a special case as the string pointer may be null */
   if (!res->length())
     return &my_empty_string;
-  res=copy_if_not_alloced(str,res,res->length());
-  ptr = (char *) res->ptr();
-  end=ptr+res->length();
+  if (tmp_value.alloced_length() < res->length() &&
+      tmp_value.realloc(res->length()))
+  {
+    null_value= 1;
+    return 0;
+  }
+  tmp_value.length(res->length());
+  tmp_value.set_charset(res->charset());
+  ptr= (char *) res->ptr();
+  end= ptr + res->length();
+  tmp= (char *) tmp_value.ptr() + tmp_value.length();
 #ifdef USE_MB
   if (use_mb(res->charset()))
   {
-    String tmpstr;
-    tmpstr.copy(*res);
-    char *tmp = (char *) tmpstr.ptr() + tmpstr.length();
     register uint32 l;
     while (ptr < end)
     {
-      if ((l=my_ismbchar(res->charset(), ptr,end)))
-        tmp-=l, memcpy(tmp,ptr,l), ptr+=l;
+      if ((l= my_ismbchar(res->charset(),ptr,end)))
+      {
+        tmp-= l;
+        memcpy(tmp,ptr,l);
+        ptr+= l;
+      }
       else
-        *--tmp=*ptr++;
+        *--tmp= *ptr++;
     }
-    memcpy((char *) res->ptr(),(char *) tmpstr.ptr(), res->length());
   }
   else
 #endif /* USE_MB */
   {
-    char tmp;
     while (ptr < end)
-    {
-      tmp=*ptr;
-      *ptr++=*--end;
-      *end=tmp;
-    }
+      *--tmp= *ptr++;
   }
-  return res;
+  return &tmp_value;
 }
 
 
@@ -1498,6 +1501,23 @@ void Item_func_trim::fix_length_and_dec(
     if (agg_arg_charsets(collation, &args[1], 2, MY_COLL_CMP_CONV, -1))
       return;
   }
+}
+
+void Item_func_trim::print(String *str)
+{
+  if (arg_count == 1)
+  {
+    Item_func::print(str);
+    return;
+  }
+  str->append(Item_func_trim::func_name());
+  str->append('(');
+  str->append(mode_name());
+  str->append(' ');
+  args[1]->print(str);
+  str->append(STRING_WITH_LEN(" from "));
+  args[0]->print(str);
+  str->append(')');
 }
 
 

--- 1.118/mysql-test/r/func_str.result	2006-07-21 13:04:44 +03:00
+++ 1.119/mysql-test/r/func_str.result	2006-07-21 13:04:44 +03:00
@@ -33,6 +33,9 @@ instr('hello','HE')	instr('hello',binary
 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

--- 1.91/mysql-test/t/func_str.test	2006-07-21 13:04:44 +03:00
+++ 1.92/mysql-test/t/func_str.test	2006-07-21 13:04:44 +03:00
@@ -19,6 +19,11 @@ select hex(char(256));
 select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
 select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE'); 
 select position(binary 'll' in 'hello'),position('a' in binary 'hello');
+#
+# Bug#11728 string function LEFT,
+# strange undocumented behaviour, strict mode
+#
+select left('hello',null), right('hello',null);
 select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
 select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
 select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
Thread
bk commit into 5.0 tree (timour:1.2208)timour21 Jul