http://www.issociate.de/board/post/26258/Backslash_NOT_being_stored.html
Backslash NOT being stored
Good day. If I do the following...
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?
Thank you.
Paul C. McNeil
Developer in Java, MS-SQL, MySQL, and web technologies.
GOD BLESS AMERICA!
To God Be The Glory!
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
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?
Thank you.
Paul C. McNeil
Developer in Java, MS-SQL, MySQL, and web technologies.
GOD BLESS AMERICA!
To God Be The Glory!
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
Re: Backslash NOT being stored
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/bugs?unsub=gcdmb-bugs [at] m.gmane.org
> 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/bugs?unsub=gcdmb-bugs [at] m.gmane.org
Re: Backslash NOT being stored
Hi!
On Apr 09, Paul McNeil wrote:
> Good day. If I do the following...
> 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?
According to
http://dev.mysql.com/doc/mysql/en/String_syntax.html
backslash is an escape character and must be escaped.
Regards,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg [at] mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
On Apr 09, Paul McNeil wrote:
> Good day. If I do the following...
> 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?
According to
http://dev.mysql.com/doc/mysql/en/String_syntax.html
backslash is an escape character and must be escaped.
Regards,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg [at] mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
Re: Backslash NOT being stored
I tested here with your syntax on MySQL 4.0.12 using the mysql command line
interface. Using SELECT to display the info, shows the backslash. What
version of MySQL are you using? What interface are you using to display the
data in MySQL? If it is something like MySQL Front, it could be that the
display program is the one with the problem.
John
----- Original Message -----
From: "Paul McNeil" <paulie [at] microneil.com>
To: <bugs [at] lists.mysql.com>
Sent: Friday, April 09, 2004 4:16 AM
Subject: Backslash NOT being stored
> Good day. If I do the following...
> 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?
>
> Thank you.
> Paul C. McNeil
> Developer in Java, MS-SQL, MySQL, and web technologies.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> GOD BLESS AMERICA!
> To God Be The Glory!
>
> --
> MySQL Bugs Mailing List
> For list archives: http://lists.mysql.com/bugs
> To unsubscribe:
http://lists.mysql.com/bugs?unsub=jwythe [at] silksystems.com
>
>
interface. Using SELECT to display the info, shows the backslash. What
version of MySQL are you using? What interface are you using to display the
data in MySQL? If it is something like MySQL Front, it could be that the
display program is the one with the problem.
John
----- Original Message -----
From: "Paul McNeil" <paulie [at] microneil.com>
To: <bugs [at] lists.mysql.com>
Sent: Friday, April 09, 2004 4:16 AM
Subject: Backslash NOT being stored
> Good day. If I do the following...
> 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?
>
> Thank you.
> Paul C. McNeil
> Developer in Java, MS-SQL, MySQL, and web technologies.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> GOD BLESS AMERICA!
> To God Be The Glory!
>
> --
> MySQL Bugs Mailing List
> For list archives: http://lists.mysql.com/bugs
> To unsubscribe:
http://lists.mysql.com/bugs?unsub=jwythe [at] silksystems.com
>
>