diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index c133e4eb2cb..ba4e9daf7cb 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -114,4 +114,12 @@ a int(11) YES NULL b varchar(255) YES NULL c int(11) YES NULL drop table t1; +1 +1 +ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +ERROR at line 1: USE must be followed by a database name +\ +\\ +'; +'; End of 5.0 tests diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result deleted file mode 100644 index 01a8c731bc9..00000000000 --- a/mysql-test/r/mysql_client.result +++ /dev/null @@ -1,56 +0,0 @@ -1 -1 -ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -ERROR at line 1: USE must be followed by a database name -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. -warnings (\W) Show warnings after every statement. -nowarning (\w) Don't show warnings after every statement. -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. -warnings (\W) Show warnings after every statement. -nowarning (\w) Don't show warnings after every statement. -\ -\\ -'; -'; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index cf6f72570ff..385c59d1503 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -94,6 +94,50 @@ drop table t1; --exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1 --enable_parsing + +# +# Bug #20432: mysql client interprets commands in comments +# + +# if the client sees the 'use' within the comment, we haven't fixed +--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# SQL can have embedded comments => workie +--exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# client commands on the other hand must be at BOL => error +--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--error 1 +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# client comment recognized, but parameter missing => error +--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# +# Bug #20328: mysql client interprets commands in comments +# +--exec $MYSQL -e 'help' > $MYSQLTEST_VARDIR/tmp/bug20328_1.result +--exec $MYSQL -e 'help ' > $MYSQLTEST_VARDIR/tmp/bug20328_2.result +--exec diff $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result + +# +# Bug #20103: Escaping with backslash does not work +# +--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 + +--exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 + --echo End of 5.0 tests - - diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test deleted file mode 100644 index 7953e0b6550..00000000000 --- a/mysql-test/t/mysql_client.test +++ /dev/null @@ -1,46 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc - -# -# Bug #20432: mysql client interprets commands in comments -# - -# if the client sees the 'use' within the comment, we haven't fixed ---exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# SQL can have embedded comments => workie ---exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# client commands on the other hand must be at BOL => error ---exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---error 1 ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# client comment recognized, but parameter missing => error ---exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# -# Bug #20328: mysql client interprets commands in comments -# ---exec echo 'help' | $MYSQL ---exec echo 'help ' | $MYSQL - -# -# Bug #20103: Escaping with backslash does not work -# ---exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 - ---exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1