diff --git a/client/mysqltest.cc b/client/mysqltest.cc index bafc5f6781de2e8c5b4531b07c409458f286098a..12aff05eff5e3d4f00c8785e66328ef59c644dbf 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2662,6 +2662,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)); diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index ae860e2a72cfb9b9eab62e2c832e7a0447ed81d2..7d2100c627a06b17fba93d1a6ac3e27f087a69d8 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -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 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 3212c82bffd76870d078b0d3e03d6282ef072f98..748f31bb5a37093149abca1b3a95a9b9a8c22c65 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -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 # ----------------------------------------------------------------------------