MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:msvensson Date:September 1 2005 8:53am
Subject:bk commit into 4.1 tree (msvensson:1.2332) BUG#3131
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson 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.2332 05/09/01 10:53:33 msvensson@neptunus.(none) +3 -0
  Bug #3131  	mysqltest fails on $2=$1 assignment in test

  mysql-test/t/mysqltest.test
    1.9 05/09/01 10:53:30 msvensson@neptunus.(none) +20 -0
    Add test cases for variable to variable assignment

  mysql-test/r/mysqltest.result
    1.9 05/09/01 10:53:30 msvensson@neptunus.(none) +7 -0
    Update test result

  client/mysqltest.c
    1.175 05/09/01 10:53:30 msvensson@neptunus.(none) +15 -7
    Fix function var_copy to make it possible to assign one variable to another. 
    ex: let $1=$2 

# 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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug11316/my41-bug11316

--- 1.8/mysql-test/r/mysqltest.result	2005-09-01 09:34:36 +02:00
+++ 1.9/mysql-test/r/mysqltest.result	2005-09-01 10:53:30 +02:00
@@ -206,6 +206,13 @@
 hej
 hej 
 hej
+1
+
+
+a long variable content
+a long variable content
+a long $where variable content
+
 mysqltest: At line 1: Missing arguments to let
 mysqltest: At line 1: Missing variable name in let
 mysqltest: At line 1: Variable name in hi=hi does not start with '$'

--- 1.8/mysql-test/t/mysqltest.test	2005-09-01 09:34:36 +02:00
+++ 1.9/mysql-test/t/mysqltest.test	2005-09-01 10:53:30 +02:00
@@ -473,6 +473,26 @@
 let $1 = hej;
 echo $1;
 
+let $1=1;
+let $2=$1;
+echo $2;
+let $5=$6;
+echo $5;
+echo $6;
+
+let $where=a long variable content;
+echo $where;
+
+let $where2= $where;
+echo $where2;
+
+let $where3=a long $where variable content;
+echo $where3;
+
+let $novar1= $novar2;
+echo $novar1;
+
+
 
 # Test illegal uses of let
 

--- 1.174/client/mysqltest.c	2005-09-01 09:34:36 +02:00
+++ 1.175/client/mysqltest.c	2005-09-01 10:53:30 +02:00
@@ -1147,16 +1147,24 @@
   return 0;
 }
 
-void var_copy(VAR* dest, VAR* src)
+void var_copy(VAR *dest, VAR *src)
 {
-  dest->int_val=src->int_val;
-  dest->int_dirty=src->int_dirty;
+  dest->int_val= src->int_val;
+  dest->int_dirty= src->int_dirty;
+
+  /* Alloc/realloc data for str_val in dest */
   if (dest->alloced_len < src->alloced_len &&
-      !(dest->str_val=my_realloc(dest->str_val,src->alloced_len+1,
-				 MYF(MY_WME))))
+      !(dest->str_val= dest->str_val
+        ? my_realloc(dest->str_val, src->alloced_len, MYF(MY_WME))
+        : my_malloc(src->alloced_len, MYF(MY_WME))))
     die("Out of memory");
-  dest->str_val_len=src->str_val_len;
-  memcpy(dest->str_val,src->str_val,src->str_val_len+1);
+  else
+    dest->alloced_len= src->alloced_len;
+
+  /* Copy str_val data to dest */
+  dest->str_val_len= src->str_val_len;
+  if (src->str_val_len)
+    memcpy(dest->str_val, src->str_val, src->str_val_len);
 }
 
 int eval_expr(VAR* v, const char *p, const char** p_end)
Thread
bk commit into 4.1 tree (msvensson:1.2332) BUG#3131msvensson1 Sep