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".
This is a one time "fix". I writing a web-based client directory for a lawyer. He currently keeps all his client contact information in a 137 page Word document with a table. I'm using Word and Excel to get the data in a tab delimeted form to pull apart with Perl and insert into the DB. The data is in horrible shape and I'm just doing whatever I can to get it into the DB.
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>