DBI quote() seems to replace double quotes with two single quotes
- From: "Northstardomus" <nielseno@xxxxxxxxxxx>
- Date: 30 Nov 2006 20:47:32 -0800
I'm running a script where I'm inserting some values into a MySQL
database. I'm using quote to escape values before inserting them into
the database and the problem it's causing me is that it seems to
replace double quotes with two single quotes.
That is, it replaces this character: " with two of these: ' like this:
''
In my script I do a select on all of the important fields in the table
I'm inserting into to see if I've already added this data and this
behavior is tripping up my logic to believe that I haven't already
inserted this data.
So:
1.) Is anybody familiar with this behavior?
2.) Do you think I diagnosed the issue (see below) correctly. And if I
did:
3.) Any suggestions to fix what I'm doing? The goal is to be able to
avoid duplicate records and keep running the script if a duplicate is
found.
Thanks in advance!
An example of what I'm doing:
I have a data base with a table of users, let's say:
+--------------------------------------------+
| userID | last_update | favorite_saying |
+--------------------------------------------+
| 1 | 06-05-2005 | Cool |
+--------------------------------------------+
| 2 | 09-17-2005 | Sweet |
+--------------------------------------------+
| 3 | 06-05-2005 | 12'' of snow |
+--------------------------------------------+
| 3 | 10-05-2005 | Wa wa wi wa |
+--------------------------------------------+
In this example I would compare the userID and favorite_saying values
to see if both values match, allowing users to update their favorite
saying as user #3 did after seeing the movie Borat. The problem comes
when the user decides to go back to his old saying because I would then
be comparing 12" of snow to 12'' of snow; no match and then I get a
duplicate entry.
.
- Follow-Ups:
- Re: DBI quote() seems to replace double quotes with two single quotes
- From: markrat
- Re: DBI quote() seems to replace double quotes with two single quotes
- From: Northstardomus
- Re: DBI quote() seems to replace double quotes with two single quotes
- Prev by Date: Re: Help with WWW::Mechanize
- Next by Date: Re: Perl Query - Conversion of EXE file
- Previous by thread: How to avoid rehashing?
- Next by thread: Re: DBI quote() seems to replace double quotes with two single quotes
- Index(es):
Relevant Pages
|
|