1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Make status of NO_BACKSLASH_ESCAPES mode known to the client so

it can use it to switch to only quoting apostrophes by doubling
them when it is in effect. (Bug #10214)
This commit is contained in:
jimw@mysql.com
2005-06-23 18:29:56 -07:00
parent 539d63d09a
commit 3ccb90c085
7 changed files with 117 additions and 1 deletions

View File

@ -13332,6 +13332,35 @@ static void test_bug9992()
mysql_close(mysql1);
}
/*
Check that the server signals when NO_BACKSLASH_ESCAPES mode is in effect,
and mysql_real_escape_string() does the right thing as a result.
*/
static void test_bug10214()
{
MYSQL_RES* res ;
int len;
char out[8];
myheader("test_bug10214");
DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES));
len= mysql_real_escape_string(mysql, out, "a'b\\c", 5);
DIE_UNLESS(memcmp(out, "a\\'b\\\\c", len) == 0);
mysql_query(mysql, "set sql_mode='NO_BACKSLASH_ESCAPES'");
DIE_UNLESS(mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES);
len= mysql_real_escape_string(mysql, out, "a'b\\c", 5);
DIE_UNLESS(memcmp(out, "a''b\\c", len) == 0);
mysql_query(mysql, "set sql_mode=''");
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@ -13567,6 +13596,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug10729", test_bug10729 },
{ "test_bug11111", test_bug11111 },
{ "test_bug9992", test_bug9992 },
{ "test_bug10214", test_bug10214 },
{ 0, 0 }
};