MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:July 18 2006 7:45pm
Subject:bk commit into 5.0 tree (evgen:1.2206)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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-18 23:45:17+04:00, evgen@stripped +8 -0
  Merge epotemkin@stripped:/home/bk/mysql-5.0
  into  moonbone.local:/work/tmp_merge-5.0-opt-mysql
  MERGE: 1.2196.1.32

  client/mysql.cc@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.205.1.2

  mysql-test/r/date_formats.result@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.22.1.1

  mysql-test/r/func_str.result@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.115.1.1

  mysql-test/t/date_formats.test@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.19.1.1

  mysql-test/t/func_str.test@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.89.1.1

  sql/item_strfunc.cc@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.273.1.1

  sql/sql_class.cc@stripped, 2006-07-18 23:45:14+04:00, evgen@stripped +0 -0
    Auto merged
    MERGE: 1.239.1.1

  sql/time.cc@stripped, 2006-07-18 23:45:14+04:00, evgen@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:	evgen
# Host:	moonbone.local
# Root:	/work/tmp_merge-5.0-opt-mysql/RESYNC

--- 1.275/sql/item_strfunc.cc	2006-07-18 23:45:24 +04:00
+++ 1.276/sql/item_strfunc.cc	2006-07-18 23:45:24 +04:00
@@ -752,44 +752,47 @@
 {
   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;
 }
 
 

--- 1.116/mysql-test/r/func_str.result	2006-07-18 23:45:24 +04:00
+++ 1.117/mysql-test/r/func_str.result	2006-07-18 23:45:24 +04: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

--- 1.90/mysql-test/t/func_str.test	2006-07-18 23:45:24 +04:00
+++ 1.91/mysql-test/t/func_str.test	2006-07-18 23:45:24 +04:00
@@ -19,6 +19,11 @@
 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 (evgen:1.2206)eugene18 Jul