* Darren Duncan <[EMAIL PROTECTED]> [2004 Jan 06 14:13 -0600]:
> 
> As long as you think each file is consistently formatted, I would do something like 
> this:

Yes, they're consistent and big!

> $insert_sql_str = read_from_cd_file();
> $insert_sql_str =~ s/'/''/g; # escape existing single quotes
> $insert_sql_str =~ s/"/'/g; # convert doubles to singles
> execute_sql_against_db( $insert_sql_str );
> 
> That does your mangling concisely, then.

While rare there are nasties like this:
"81565","Why Not Reform the ""Squeek-Box?""","Editorials","Young","Sumner 
B.","1CO",1917,9
just how does a person handle this case?

If I insert the above into sqlite manually, the squlite .dump command
shows that sqlite translates the quotes as (I'm leaving out the SQL
commands):
(81565,'Why Not Reform the "Squeek-Box?"','Editorials','Young','Sumner 
B.','1CO',1917,9)

I looked at the DBI placeholder and it seems to require splitting each
line into a list for each value of the INSERT command.  Unfortunately, 
while splitting on the commas seems logical, I will get a mess when
confronted with the following:
"81648","Navy, on restrictions","The Operating Department","Smith","J.O.","",1919,9

A simple "split /,/, $line;" will cause the last record, in this case
the month of the magazine article, to be lost.

What I am fighting is probably a DBI or DBD::SQLite issue in which case
it is off-topic for this list.

Thanks for your kind help.

- Nate >>

-- 
 Wireless | Amateur Radio Station N0NB          |  Successfully Microsoft
 Internet | [EMAIL PROTECTED]               | free since January 1998.
 Location | Bremen, Kansas USA EM19ov           |  "Debian, the choice of
  Amateur radio exams; ham radio; Linux info @  |     a GNU generation!"
             http://www.qsl.net/n0nb/           |   http://www.debian.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to