EvanCarroll has asked for the wisdom of the Perl Monks concerning the following question:
And it seems to crash on this data:#!/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 C +ode~,~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-SE +LECT 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-SE +LECT statement [for Statement "SELECT * FROM current_table"] at ./col +_proc.pl line 12. Died at ./col_proc.pl line 12.
From a later post: synopsis of thread. BUG FOUND When this is the data file it works fine!!! Data File:Still no resolutionDeduction: The bug is DBD::CSV breaking if there is an occurance of a double quotes within a non-standard quote character of '~', (so what is the point of using quote_char) ?~Style Name~ ~5dr Crew Cab 130~
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A bug in DBD::CSV?
by diotalevi (Canon) on Apr 12, 2006 at 22:37 UTC | |
by EvanCarroll (Chaplain) on Apr 13, 2006 at 07:11 UTC | |
by diotalevi (Canon) on Apr 13, 2006 at 07:13 UTC | |
|
Re: A bug in DBD::CSV?
by cosimo (Hermit) on Apr 13, 2006 at 13:00 UTC | |
|
Re: A bug in DBD::CSV?
by EvanCarroll (Chaplain) on Apr 13, 2006 at 16:23 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |