Commit cce88f7a authored by serg@serg.mylan's avatar serg@serg.mylan

don't let bugfix for bug#8303 break the bugfix for bug#8378

revert the fix for bug#8303
correct the test for bug#8378
parent e7504b34
...@@ -172,6 +172,6 @@ c2h ...@@ -172,6 +172,6 @@ c2h
ab_def ab_def
drop table t1; drop table t1;
SET NAMES sjis; SET NAMES sjis;
SELECT HEX('佐淘 \圭') FROM DUAL; SELECT HEX('@\') FROM DUAL;
HEX('佐淘 圭') HEX('@\')
8DB2939181408C5C 8DB2939181408C5C
...@@ -78,6 +78,6 @@ SET collation_connection='sjis_bin'; ...@@ -78,6 +78,6 @@ SET collation_connection='sjis_bin';
--character_set sjis --character_set sjis
SET NAMES sjis; SET NAMES sjis;
SELECT HEX('@\\') FROM DUAL; SELECT HEX('@\') FROM DUAL;
# End of 4.1 tests # End of 4.1 tests
...@@ -295,18 +295,7 @@ static char *get_text(LEX *lex) ...@@ -295,18 +295,7 @@ static char *get_text(LEX *lex)
found_escape=1; found_escape=1;
if (lex->ptr == lex->end_of_query) if (lex->ptr == lex->end_of_query)
return 0; return 0;
#ifdef USE_MB yySkip();
int l;
if (use_mb(cs) &&
(l = my_ismbchar(cs,
(const char *)lex->ptr,
(const char *)lex->end_of_query))) {
lex->ptr += l;
continue;
}
else
#endif
yySkip();
} }
else if (c == sep) else if (c == sep)
{ {
...@@ -335,9 +324,6 @@ static char *get_text(LEX *lex) ...@@ -335,9 +324,6 @@ static char *get_text(LEX *lex)
{ {
uchar *to; uchar *to;
/* Re-use found_escape for tracking state of escapes */
found_escape= 0;
for (to=start ; str != end ; str++) for (to=start ; str != end ; str++)
{ {
#ifdef USE_MB #ifdef USE_MB
...@@ -351,7 +337,7 @@ static char *get_text(LEX *lex) ...@@ -351,7 +337,7 @@ static char *get_text(LEX *lex)
continue; continue;
} }
#endif #endif
if (!found_escape && *str == '\\' && str+1 != end) if (*str == '\\' && str+1 != end)
{ {
switch(*++str) { switch(*++str) {
case 'n': case 'n':
...@@ -377,20 +363,14 @@ static char *get_text(LEX *lex) ...@@ -377,20 +363,14 @@ static char *get_text(LEX *lex)
*to++= '\\'; // remember prefix for wildcard *to++= '\\'; // remember prefix for wildcard
/* Fall through */ /* Fall through */
default: default:
found_escape= 1; *to++= *str;
str--;
break; break;
} }
} }
else if (!found_escape && *str == sep) else if (*str == sep)
{ *to++= *str++; // Two ' or "
found_escape= 1;
}
else else
{
*to++ = *str; *to++ = *str;
found_escape= 0;
}
} }
*to=0; *to=0;
lex->yytoklen=(uint) (to-start); lex->yytoklen=(uint) (to-start);
......
...@@ -11554,25 +11554,26 @@ static void test_bug7990() ...@@ -11554,25 +11554,26 @@ static void test_bug7990()
static void test_bug8378() static void test_bug8378()
{ {
#if defined(HAVE_CHARSET_gbk) && !defined(EMBEDDED_LIBRARY) #if defined(HAVE_CHARSET_gbk) && !defined(EMBEDDED_LIBRARY)
MYSQL *lmysql; MYSQL *old_mysql=mysql;
char out[9]; /* strlen(TEST_BUG8378)*2+1 */ char out[9]; /* strlen(TEST_BUG8378)*2+1 */
int len; char buf[256];
int len, rc;
myheader("test_bug8378"); myheader("test_bug8378");
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "\n Establishing a test connection ..."); fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL))) if (!(mysql= mysql_init(NULL)))
{ {
myerror("mysql_init() failed"); myerror("mysql_init() failed");
exit(1); exit(1);
} }
if (mysql_options(lmysql, MYSQL_SET_CHARSET_NAME, "gbk")) if (mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "gbk"))
{ {
myerror("mysql_options() failed"); myerror("mysql_options() failed");
exit(1); exit(1);
} }
if (!(mysql_real_connect(lmysql, opt_host, opt_user, if (!(mysql_real_connect(mysql, opt_host, opt_user,
opt_password, current_db, opt_port, opt_password, current_db, opt_port,
opt_unix_socket, 0))) opt_unix_socket, 0)))
{ {
...@@ -11582,12 +11583,18 @@ static void test_bug8378() ...@@ -11582,12 +11583,18 @@ static void test_bug8378()
if (!opt_silent) if (!opt_silent)
fprintf(stdout, " OK"); fprintf(stdout, " OK");
len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4); len= mysql_real_escape_string(mysql, out, TEST_BUG8378_IN, 4);
/* No escaping should have actually happened. */ /* No escaping should have actually happened. */
DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0); DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
mysql_close(lmysql); sprintf(buf, "SELECT '%s'", out);
rc=mysql_real_query(mysql, buf, strlen(buf));
myquery(rc);
mysql_close(mysql);
mysql=old_mysql;
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment