diff options
author | unknown <tnurnberg@mysql.com/salvation.intern.azundris.com> | 2006-07-13 09:04:06 +0200 |
---|---|---|
committer | unknown <tnurnberg@mysql.com/salvation.intern.azundris.com> | 2006-07-13 09:04:06 +0200 |
commit | d74dbf4f0dd01cab737ac95c9f6fab91287435ba (patch) | |
tree | 0fe657933204978a8b402736cbc05c4cb54d2136 /mysql-test/t/mysql_client.test | |
parent | 6fbf96a0d7ad79fe64b728e708354d3614d9a11c (diff) | |
download | mariadb-git-d74dbf4f0dd01cab737ac95c9f6fab91287435ba.tar.gz |
Bug#20432: mysql client interprets commands in comments
do not look for client-specific commands while inside a multi-line comment.
we will allow multi-comments pretty much anywhere within SQL-statements,
but client-specific commands (help, use, print, ...) must be the first token
in the input.
client/mysql.cc:
Bug#20432: mysql client interprets commands in comments
mysql-test/r/mysql_client.result:
Bug#20432: mysql client interprets commands in comments
test client-side parsing of comments and client-specific commands
mysql-test/t/mysql_client.test:
Bug#20432: mysql client interprets commands in comments
test client-side parsing of comments and client-specific commands
Diffstat (limited to 'mysql-test/t/mysql_client.test')
-rw-r--r-- | mysql-test/t/mysql_client.test | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test new file mode 100644 index 00000000000..e4b6658b631 --- /dev/null +++ b/mysql-test/t/mysql_client.test @@ -0,0 +1,29 @@ +# 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 |