On Fri, 23 Nov 2012 17:43:50 -0500, "Scott R. Godin" <scot...@mhg2.com>
wrote:

> I've run into an issue where I need both col_names set and
> skip_first_line still set to TRUE, because of malformed colnames in the
> original dumpfiles that conflict with SQL Reserved Words (such as 'key')
> that I am unable to find any other acceptable workaround short of

Why not automate the hacking using Text::CSV_XS and rewrite the header
before using DBD::CSV?

> hacking the dumpfiles prior to import for unit-testing and validation
> prior to splitting the dumpfiles out into a normalized sql database.
> (I'll eed to hand this off to someone else for future dump-and-import
> work, so it's just got to WORK with these ACCESS database dump files
> as-is, plus HIPAA rules about not changing data complicates matters)
> 
> Is there any way to ensure that despite col_names being set, I can still
> force skip_first_line => 1 ? or should I report this as a possible
> edge-case bug

There should be, and it is likely that this case is already fixed in
the current development state of DBD::CSV by the valuable work of Jens
Rehsack, but that state is not (yet) releasable as it depends on
changes in SQL::Statement and DBI (DBD::File).

> to sum up,
> 
> col names present in csv but bad (sql reserved words)
> can use col_names => [ @ary ], but this sets skip_first_line to FALSE as
> it *assumes* that colnames are NOT present in original dump
> 
> what do ? :)

Rewrite the headers with Text::CSV_XS before using DBD::CSV

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.17   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Reply via email to