List:Commits« Previous MessageNext Message »
From:msvensson Date:April 4 2007 1:09pm
Subject:bk commit into 4.1 tree (msvensson:1.2633)
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@stripped, 2007-04-04 15:09:12+02:00, msvensson@stripped +3 -0
  Add expansion of $variables in "let from query",
  "if with query" and "while with query"

  client/mysqltest.c@stripped, 2007-04-04 15:09:08+02:00, msvensson@stripped +8 -3
    Add expansion of $variables in "let from query",
    "if with query" and "while with query"

  mysql-test/r/mysqltest.result@stripped, 2007-04-04 15:09:09+02:00, msvensson@stripped +3 -0
    Add expansion of $variables in "let from query",
    "if with query" and "while with query"

  mysql-test/t/mysqltest.test@stripped, 2007-04-04 15:09:09+02:00, msvensson@stripped +15 -0
    Add expansion of $variables in "let from query",
    "if with query" and "while with query"

# 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:	pilot.blaudden
# Root:	/home/msvensson/mysql/mysql-4.1-maint

--- 1.22/mysql-test/r/mysqltest.result	2007-02-19 18:23:58 +01:00
+++ 1.23/mysql-test/r/mysqltest.result	2007-04-04 15:09:09 +02:00
@@ -268,6 +268,9 @@ mysqltest: At line 1: Missing assignment
 1
 # Execute: echo $success ;
 1 
+var2: content of variable 1
+var3: content of variable 1 content of variable 1
+length of var3 is longer than 0
 mysqltest: At line 1: Missing required argument 'filename' to command 'source'
 mysqltest: At line 1: Could not open file ./non_existingFile
 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep

--- 1.28/mysql-test/t/mysqltest.test	2007-02-20 18:20:57 +01:00
+++ 1.29/mysql-test/t/mysqltest.test	2007-04-04 15:09:09 +02:00
@@ -686,6 +686,21 @@ echo # <whatever> success: $success ;
 echo $success ;
 
 # ----------------------------------------------------------------------------
+# Test let from query with $variable
+# let $<var_name>=`<query with $variable>`;
+# ----------------------------------------------------------------------------
+
+let $var1=content of variable 1;
+let $var2= `select "$var1"`;
+let $var3= `select concat("$var1", " ", "$var2")`;
+echo var2: $var2;
+echo var3: $var3;
+if (`select length("$var3") > 0`)
+{
+  echo length of var3 is longer than 0;
+}
+
+# ----------------------------------------------------------------------------
 # Test to assign let from query
 # let $<var_name>=`<query>`;
 # ----------------------------------------------------------------------------

--- 1.247/client/mysqltest.c	2007-03-20 19:43:35 +01:00
+++ 1.248/client/mysqltest.c	2007-04-04 15:09:08 +02:00
@@ -1328,6 +1328,7 @@ void var_query_set(VAR *var, const char 
   MYSQL_RES *res;
   MYSQL_ROW row;
   MYSQL* mysql = &cur_con->mysql;
+  DYNAMIC_STRING ds_query;
   DBUG_ENTER("var_query_set");
   LINT_INIT(res);
 
@@ -1337,13 +1338,17 @@ void var_query_set(VAR *var, const char 
     die("Syntax error in query, missing '`'");
   ++query;
 
-  if (mysql_real_query(mysql, query, (int)(end - query)) ||
+  /* Eval the query, thus replacing all environment variables */
+  init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
+  do_eval(&ds_query, query, end, FALSE);
+
+  if (mysql_real_query(mysql, ds_query.str, ds_query.length) ||
       !(res = mysql_store_result(mysql)))
   {
-    *end = 0;
-    die("Error running query '%s': %d %s", query,
+    die("Error running query '%s': %d %s", ds_query.str,
 	mysql_errno(mysql), mysql_error(mysql));
   }
+  dynstr_free(&ds_query);
 
   if ((row = mysql_fetch_row(res)) && row[0])
   {
Thread
bk commit into 4.1 tree (msvensson:1.2633)msvensson4 Apr