Andrew Gaffney wrote:
WC -Sx- Jones wrote:

Andrew Gaffney wrote:

INSERT INTO people VALUES(NULL, "Firstname", "Lastname", ""123 Anywhere Address"", ...");
INSERT INTO people VALUES(NULL, "Firstname", "Lastname", '123 O'Walley Street', ...");


See the problem? I can't use either quoting consistently due to the nature of the data I'm working with.



Clean the data before saving it?


s,^["'],,; # Kill Starting Quotes
s,["']$,,; # Kill Ending Quotes

Or convert them to a storable
character: | for " and ~ for '


I ended up stripping double quotes (s/\"//g) and escaping single quotes (s/\'/\\'/g). This seems to work for me.


This is a lazy hack and a bad habit to get into, IMO. DBI provides various useful ways to allow your data to not be corrupted (aka changed) while allowing your code to be cross platform and cross DB compatible.


Do what you will, but this is one of the first things I would clean up when arriving on a project that uses this "fix".

http://danconia.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to