Hello list,

I am currently trying to fix a bug in a search function with a request like this one :
select * from forum where topic like '%[...]%' ;

where [...] is a string escaped by mysql_real_escape_string (C API) and topic is a varchar field (not null).

It works, but there is a bug if someone is searching the character backslash only ('\'), so the request become :
select * from forum where topic like '%\\%' ;

and it returns only topics who have a '%' in them, not a '\'. It is the same result as if I were doing :
select * from forum where topic like '%\%' ;

To get the topics with a '\' (but it returns only the topics that ends with a '\'), I must do :
select * from forum where topic like '%\\' ;

So it seems to me that the ending % is escaped even with '\\'. Is this a normal behaviour ? Or am I missing something ?

Here are some infos about the server version, might be useful :
version = 4.0.20-standard
version_comment = Official MySQL-standard binary
version_compile_os = linux

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to