summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-02-17 16:16:58 -0800
committerunknown <jimw@mysql.com>2005-02-17 16:16:58 -0800
commit90cc9c6bb60c60dbf6e603a0cb5d9ae736a9a906 (patch)
tree76f459723b9f122eb50373fe7c42ffc72f277131 /tests
parent4c5a3914b8924ebc72c6c4233c18d2e3f1ad118b (diff)
parent2b69b4ae4f0b29a0eceb72a404b7f52a67748875 (diff)
downloadmariadb-git-90cc9c6bb60c60dbf6e603a0cb5d9ae736a9a906.tar.gz
Merge
BitKeeper/triggers/post-commit: Auto merged mysql-test/r/lowercase_table2.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/variables.test: Auto merged sql/mysql_priv.h: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/system_mysql_db.result: Update results scripts/mysql_create_system_tables.sh: Merge fix for Bug #7617, making enum fields in grant tables case-insensitive. scripts/mysql_fix_privilege_tables.sql: Merge fix for Bug #7617, and fix additional enum/set columns. sql/sql_acl.cc: Hand-merge due to whitespace change sql/sql_lex.cc: Hand-merge bug fix.
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 0581679a845..1eb0151767d 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -12585,6 +12585,54 @@ static void test_bug7990()
/*
+ Test mysql_real_escape_string() with gbk charset
+
+ The important part is that 0x27 (') is the second-byte in a invalid
+ two-byte GBK character here. But 0xbf5c is a valid GBK character, so
+ it needs to be escaped as 0x5cbf27
+*/
+#define TEST_BUG8378_IN "\xef\xbb\xbf\x27\xbf\x10"
+#define TEST_BUG8378_OUT "\xef\xbb\x5c\xbf\x5c\x27\x5c\xbf\x10"
+
+static void test_bug8378()
+{
+ MYSQL *lmysql;
+ char out[9]; /* strlen(TEST_BUG8378)*2+1 */
+ int len;
+
+ myheader("test_bug8378");
+
+ if (!opt_silent)
+ fprintf(stdout, "\n Establishing a test connection ...");
+ if (!(lmysql= mysql_init(NULL)))
+ {
+ myerror("mysql_init() failed");
+ exit(1);
+ }
+ if (mysql_options(lmysql, MYSQL_SET_CHARSET_NAME, "gbk"))
+ {
+ myerror("mysql_options() failed");
+ exit(1);
+ }
+ if (!(mysql_real_connect(lmysql, opt_host, opt_user,
+ opt_password, current_db, opt_port,
+ opt_unix_socket, 0)))
+ {
+ myerror("connection failed");
+ exit(1);
+ }
+ if (!opt_silent)
+ fprintf(stdout, " OK");
+
+ len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4);
+
+ /* No escaping should have actually happened. */
+ DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
+
+ mysql_close(lmysql);
+}
+
+/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -12804,6 +12852,7 @@ static struct my_tests_st my_tests[]= {
{ "test_truncation_option", test_truncation_option },
{ "test_bug8330", test_bug8330 },
{ "test_bug7990", test_bug7990 },
+ { "test_bug8378", test_bug8378 },
{ 0, 0 }
};