#!/usr/bin/perl
use strict;
no warnings;
use DBD::CSV;
my $file = shift;
my $dbh = DBI->connect('DBI:CSV:f_dir=.')
or die "Cannot connect $!";
$dbh->{'csv_tables'}{'current_table'}
= { file => $file, quote_char => '~', eol=> "\r\n" };
my $sth = $dbh->prepare(q{SELECT * FROM current_table});
$sth->execute();
while ( defined ( my @row = $sth->fetchrow_array ) ) {
if ( $sth->errstr() ) { print $sth->errstr() and die };
}
print $sth->errstr();
####
~Style ID~,~Hist Style ID~,~Model ID~,~Model Year~,~Sequence~,~Style Code~,~Full Style Code~,~Style Name~,~True Base Price~,~Invoice~
282198, 2007700803 ,16139 ,2007 ,1 ,~ZMB67~ ,~ZMB67~ ,~2dr Conv~ ,~Y~ ,21319.80
####
DBD::CSV::st fetchrow_array failed: Attempt to fetch row from a Non-SELECT statement [for Statement "SELEC T * FROM current_table"] at ./col_proc.pl line 12.
Died at ./col_proc.pl line 12.
evan@dealermade:/var/chrome/NVDv2_US_EN$ ./col_proc.pl ./problem.txt
DBD::CSV::st fetchrow_array failed: Attempt to fetch row from a Non-SELECT statement [for Statement "SELECT * FROM current_table"] at ./col_proc.pl line 12.
Died at ./col_proc.pl line 12.
####
~Style Name~
~5dr Crew Cab 130~