MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:February 2 2006 10:49pm
Subject:bk commit into 5.1 tree (anozdrin:1.2130) BUG#16621
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of alik. When alik 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
  1.2130 06/02/03 01:49:33 anozdrin@stripped +2 -0
  Copied patch for BUG#15588 (BUG#16621) from 5.0 into 5.1-release.

  sql/sp_head.cc
    1.213 06/02/03 01:49:29 anozdrin@stripped +25 -12
    Work correctly with String:
    - String length has to be be reset before use;
    - qs_append() does not allocate memory, so the memory should
      be reserved beforehand.

  sql/field.cc
    1.298 06/02/03 01:49:29 anozdrin@stripped +2 -2
    Use memmove() instead of memcpy() -- after implementation of WL#2984
    (Make stored routine variables work according to the standard) it is
    possible to store in the field the value from this field. For instance,
    this can happen for the following statement:
      SET sp_var = SUBSTR(sp_var, 1, 3);

# 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:	anozdrin
# Host:	booka.home
# Root:	/mnt/hda4/home/alik/MySQL/devel/5.1.6-release-15588

--- 1.297/sql/field.cc	2006-01-16 16:26:26 +03:00
+++ 1.298/sql/field.cc	2006-02-03 01:49:29 +03:00
@@ -5880,7 +5880,7 @@
                                                     field_length/
                                                     field_charset->mbmaxlen,
                                                     &well_formed_error);
-  memcpy(ptr,from,copy_length);
+  memmove(ptr,from,copy_length);
 
   /* Append spaces if the string was shorter than the field. */
   if (copy_length < field_length)
@@ -6296,7 +6296,7 @@
 						    field_length/
 						    field_charset->mbmaxlen,
                                                     &well_formed_error);
-  memcpy(ptr + length_bytes, from, copy_length);
+  memmove(ptr + length_bytes, from, copy_length);
   if (length_bytes == 1)
     *ptr= (uchar) copy_length;
   else

--- 1.212/sql/sp_head.cc	2006-01-16 16:26:27 +03:00
+++ 1.213/sql/sp_head.cc	2006-02-03 01:49:29 +03:00
@@ -105,21 +105,27 @@
 
   case STRING_RESULT:
     {
-      char buf_holder[STRING_BUFFER_USUAL_SIZE];
-      String buf(buf_holder, sizeof(buf_holder), &my_charset_latin1);
       String *result= item->val_str(str);
       
       if (!result)
         return NULL;
       
-      buf.append('_');
-      buf.append(result->charset()->csname);
-      buf.append('\'');
-      buf.append(*result);
-      buf.append('\'');
-      str->copy(buf);
-
-      return str;
+      {
+        char buf_holder[STRING_BUFFER_USUAL_SIZE];
+        String buf(buf_holder, sizeof (buf_holder), result->charset());
+      
+        /* We must reset length of the buffer, because of String specificity. */
+        buf.length(0);
+      
+        buf.append('_');
+        buf.append(result->charset()->csname);
+        buf.append('\'');
+        buf.append(*result);
+        buf.append('\'');
+        str->copy(buf);
+      
+        return str;
+      }
     }
 
   case ROW_RESULT:
@@ -3076,9 +3082,16 @@
 void
 sp_instr_set_case_expr::print(String *str)
 {
-  str->append(STRING_WITH_LEN("set_case_expr "));
+  const char CASE_EXPR_TAG[]= "set_case_expr ";
+  const int CASE_EXPR_TAG_LEN= sizeof(CASE_EXPR_TAG) - 1;
+  const int INT_STRING_MAX_LEN= 10;
+
+  /* We must call reserve(), because qs_append() doesn't care about memory. */
+  str->reserve(CASE_EXPR_TAG_LEN + INT_STRING_MAX_LEN + 2);
+
+  str->qs_append(CASE_EXPR_TAG, CASE_EXPR_TAG_LEN);
   str->qs_append(m_case_expr_id);
-  str->append(' ');
+  str->qs_append(' ');
   m_case_expr->print(str);
 }
 
Thread
bk commit into 5.1 tree (anozdrin:1.2130) BUG#16621Alexander Nozdrin2 Feb