DBI quote() seems to replace double quotes with two single quotes



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.

.



Relevant Pages

  • Re: adding "addslahses" to already live project - best approach?
    ... > On each new script I create do the following. ... > from the database go in and add a stripslashes. ... > retrieves info from the database rather then on each script that collects ... This changes the special chars like quotes ' and " and so on... ...
    (comp.lang.php)
  • Re: Requery "Too Soon"?
    ... "The database has been placed in a state by user ... then the Requery will return the just ... MsgBox appears, I get an empty subform, i.e., I do ... I'll try inserting a DoEvents or two. ...
    (microsoft.public.access.formscoding)
  • Applescript and Autoformat (search and replace), Word 2004
    ... script that will take care of a recurring editing issue with nested ... quotes to double quotes, ... set oldauto2 to auto format as you type replace quotes ... set auto format as you type replace quotes to false ...
    (microsoft.public.mac.office.word)
  • Re: SQLCE performance from .NET CF v2.0
    ... Please remember when bulk inserting is being executed against SQL CE, ... > local database functionality. ... > database technology and I am considering switching to SQLCE at the same ... > execute the prepared statement again. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Transforming ascii file (pseduo database) into proper database
    ... contained therein so that it can be inserted into an existing database. ... So I iterate over the file maintaining a list of calls for the given phonenumber, and when the phonenumber changes, I deal with the previous cache of data, then re-initialize with the new phone's data. ... create a temp DB, skim through the file inserting all your data into a table in this DB, then use DB functionality on it ...
    (comp.lang.python)