summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <bell@51.0.168.192.in-addr.arpa>2005-02-20 18:49:27 +0200
committerunknown <bell@51.0.168.192.in-addr.arpa>2005-02-20 18:49:27 +0200
commited7ad40523ad890c9229ce4dd32dc48bba196eac (patch)
treeef69852c850b3445152229f7707b70a1601e70c1 /tests
parent5f0064f927aeb897adfc34dd3e739dbaad887482 (diff)
parentda4604f9e8fa42c8e7c5627b692e0ac6d5409802 (diff)
downloadmariadb-git-ed7ad40523ad890c9229ce4dd32dc48bba196eac.tar.gz
Merge
sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/protocol.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/table.cc: Auto merged tests/mysql_client_test.c: Auto merged BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
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 1e117954e93..8f49b45de0c 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -12621,6 +12621,54 @@ from t2);");
/*
+ 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
*/
@@ -12841,6 +12889,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 }
};