|P is for Practical|
DBI and some complicated quotesby Cody Fendant (Friar)
|on Sep 21, 2012 at 04:04 UTC||Need Help??|
Cody Fendant has asked for the
wisdom of the Perl Monks concerning the following question:
I want to replace some things in MySQL fields.
Unfortunately those things are quotes.
So I have a statement like this:UPDATE table_name SET `fieldname` = REPLACE(`fieldname`,'‘','''')
which replaces a "smart quote" type apostrophe with a regular one (MySQL's way of escaping a quote is to double it).
That statement you can see above works from the command line, but not if I use DBI's do() function.
Any suggestions? Any way in which I can pass in quotes without having problems with DBI quoting the quotes around the quotes?
Any other way to attack this problem?