in reply to DBD::CSV::st execute failed:
If you use f_ext => ".csv/r", you explicitly tell the driver that the extension is required. If you add the /r, you should not add .csv to the table name. The driver will still be able to open your file, but it is not quaranteed anymore which file it opens: newCsv, newCsv.csv, or newCsv.csv.csv.
Another issue is case sensitivity. On Windows newCsv will match against any casing. On Linux you might need to check if your file name matches.
$ cat newCsv.csv foo,bar,baz 1,2,3 $ perl -MDP -MDBI -e'my$s=DBI->connect("dbi:CSV:",undef,undef,{f_ext=> +".csv/r"})->prepare("select * from newCsv");$s->execute;DDumper$s->fe +tchrow_hashref' { bar => 2, baz => 3, foo => 1 } $ perl -MDP -MDBI -e'my$s=DBI->connect("dbi:CSV:",undef,undef,{f_ext=> +".csv/r"})->prepare("select * from newCsv.csv");$s->execute;DDumper$s +->fetchrow_hashref' { bar => 2, baz => 3, foo => 1 } $ perl -MDP -MDBI -e'my$s=DBI->connect("dbi:CSV:",undef,undef,{f_ext=> +".csv/r"})->prepare("select * from newcsv");$s->execute;DDumper$s->fe +tchrow_hashref' DBD::CSV::st execute failed: Execution ERROR: Cannot open /tmp/ne.csv: No such file or directory (2 +) at /pro/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi-ld/DBI +/DBD/SqlEngine.pm line 1624. . [for Statement "select * from newcsv"] at -e line 1. DBD::CSV::st fetchrow_hashref failed: Attempt to fetch row without a p +receding execute () call or from a non-SELECT statement [for Statemen +t "select * from newcsv"] at -e line 1. undef
I see that the error message could use some improvement :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBD::CSV::st execute failed:
by Tux (Canon) on May 28, 2016 at 14:12 UTC | |
|
Re^2: DBD::CSV::st execute failed:
by Sandy_Bio_Perl (Beadle) on May 28, 2016 at 10:44 UTC | |
by erix (Prior) on May 28, 2016 at 10:52 UTC | |
by Sandy_Bio_Perl (Beadle) on May 28, 2016 at 11:48 UTC | |
by Sandy_Bio_Perl (Beadle) on May 28, 2016 at 11:32 UTC |