List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:February 15 2002 3:54pm
Subject:Re: Problem in MySql while inserting '\'
View as plain text  
How would you do:
set field='Jim said, "that's crazy."'

you would have to escape the quote somehow.  The  '\' is the escaper 
set field='Jim said, "that\'s crazy."'

That means hat the escape character must also be escaped.

Check the manual for the section on special characters.

Most languages that support MySQL also have a function that can [ 
should] be used
to escape all strings before they are inserted or matched in a query.

jroy@stripped wrote:

>Hi everybody,
>     This seems to be a definite defect in MySql. While inserting a String into
>a MySql attribute defined as VARCHAR or VARCHAR BINARY, etc., if a '\' is
>present in the String, it is simply disregarded, and the remaining part of the
>String gets inserted. For inserting a '\', we have to use '\\'. However, the
>question remains that why should I give a special treatment to a String
>containing '\' ? Normally I am not bothered by the values I insert, as long as
>it is a String. I think I should be able to insert any String, irrespective of
>its value, into an attribute specified as VARCHAR, without any special
>     What do you say about this, and is there any justification for this kind of
>behaviour ?
>          Thanks and regards,
>                              Jit Roy Chowdhury
>                              Hughes Software Systems
>                              Gurgaon,
>                               India
>"DISCLAIMER: This message is proprietary to Hughes Software Systems Limited
>(HSS) and is intended solely for the use of the individual  to whom it is
>addressed. It may contain  privileged or confidential information  and should
>not be circulated or used for any purpose other than for what it is intended. If
>you have received this message in error, please notify the originator
>immediately. If you are not the intended recipient, you are notified that you
>are strictly prohibited from using, copying, altering, or disclosing the
>contents of this message. HSS accepts no responsibility for loss or damage
>arising from the use of the information transmitted by this email including
>damage from virus."
>Before posting, please check:
>   (the manual)
>           (the list archive)
>To request this thread, e-mail <mysql-thread100098@stripped>
>To unsubscribe, e-mail
> <>
>Trouble unsubscribing? Try:

Problem in MySql while inserting '\'jroy15 Feb
  • Re: Problem in MySql while inserting '\'Gerald Clark15 Feb