Re: Backslash NOT being stored

Andreas Pardeike <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
On 2004-04-09, at 13.16, Paul McNeil wrote:

> INSERT INTO myTable (data) VALUES('Here is a backslash \ ');
>
> I escape it prior to sending so the value that gets sent to the DB 
> is....
> INSERT INTO myTable (data) VALUES('Here is a backslash \\ ');
>
> BUT when I check the DB the data field reads
> [Here is a backslash ]
>
> It eats the single backslash.
>
> How can I prevent this?

Is it possible that you're using a string to send the sql command?
If so, your \\ construct only ensembles a single backslash (in most
programming languages I know, you must escape the backslash within
a string using a backslash.

So assuming the above, you might want to use "....  \\\\ ...." even
if it looks weird. It's basically two '\' escaped by '\' so that
mysql gets a '\\' which then is inserted as a '\'. Clear?

Andreas Pardeike


-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.