MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:January 20 2010 11:51am
Subject:bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2878) Bug#49837
View as plain text  
#At file:///home/bm136801/my/execmul-51/ based on revid:bjorn.munch@stripped

 2878 Bjorn Munch	2010-01-20
      Bug #49837 mysqltest exec cannot handle multi-line command correctly
      Since the exec command line is passed on externally, it cannot take newlines
      Simply replace \n with space
      Now also added test case

    modified:
      client/mysqltest.cc
      mysql-test/r/mysqltest.result
      mysql-test/t/mysqltest.test
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-01-07 10:22:45 +0000
+++ b/client/mysqltest.cc	2010-01-20 11:51:18 +0000
@@ -2661,6 +2661,10 @@ void do_exec(struct st_command *command)
 #endif
 #endif
 
+  /* exec command is interpreted externally and will not take newlines */
+  while(replace(&ds_cmd, "\n", 1, " ", 1) == 0)
+    ;
+  
   DBUG_PRINT("info", ("Executing '%s' as '%s'",
                       command->first_argument, ds_cmd.str));
 

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2010-01-07 10:22:45 +0000
+++ b/mysql-test/r/mysqltest.result	2010-01-20 11:51:18 +0000
@@ -216,6 +216,12 @@ source database
 echo message echo message
 
 mysqltest: At line 1: Missing argument in exec
+1
+1
+2
+2
+X
+3
 MySQL
 "MySQL"
 MySQL: The

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2010-01-07 10:22:45 +0000
+++ b/mysql-test/t/mysqltest.test	2010-01-20 11:51:18 +0000
@@ -605,6 +605,15 @@ echo ;
 --error 1
 --exec echo "--exec " | $MYSQL_TEST 2>&1
 
+# Multi-line exec
+exec $MYSQL
+    test -e "select 1";
+exec $MYSQL test -e "select
+    2";
+let $query = select 3
+    as X;
+exec $MYSQL test -e "$query";
+
 # ----------------------------------------------------------------------------
 # Test let command
 # ----------------------------------------------------------------------------


Attachment: [text/bzr-bundle] bzr/bjorn.munch@sun.com-20100120115118-trp9qbjsksty5qax.bundle
Thread
bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2878) Bug#49837Bjorn Munch20 Jan