summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2006-08-01 11:05:54 +0300
committerunknown <gkodinov/kgeorge@macbook.gmz>2006-08-01 11:05:54 +0300
commitec95bf782f0fd304756d974667893e0f696dbb64 (patch)
tree6008fcbe3359261e23fa6ad62bbbc98934f6d3c6
parent667c73be65bc1c1a6f77d6e2bb140cdddae9ec73 (diff)
downloadmariadb-git-ec95bf782f0fd304756d974667893e0f696dbb64.tar.gz
Bug #20103: Escaping with backslash does not work
- make the client to respect the server-side no_backslash_escapes option and disable the special meaning of backslash also at client side. mysql-test/r/mysql_client.result: Bug #20103: Escaping with backslash does not work - test case mysql-test/t/mysql_client.test: Bug #20103: Escaping with backslash does not work - test case
-rw-r--r--client/mysql.cc3
-rw-r--r--mysql-test/r/mysql_client.result4
-rw-r--r--mysql-test/t/mysql_client.test11
3 files changed, 17 insertions, 1 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 94b43d030e8..0b7284426c5 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1221,7 +1221,8 @@ static bool add_line(String &buffer,char *line,char *in_string,
continue;
}
#endif
- if (!*ml_comment && inchar == '\\')
+ if (!*ml_comment && inchar == '\\' &&
+ !(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))
{
// Found possbile one character command like \c
diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result
index 87d09428ff6..a20bd60aaf3 100644
--- a/mysql-test/r/mysql_client.result
+++ b/mysql-test/r/mysql_client.result
@@ -2,3 +2,7 @@
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
+\
+\\
+';
+';
diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test
index e4b6658b631..003a086212e 100644
--- a/mysql-test/t/mysql_client.test
+++ b/mysql-test/t/mysql_client.test
@@ -27,3 +27,14 @@
# 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 #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