I do not see any code, so I cannot tell how you created the database connection. The use of csv_auto_diag, which is also automatically set when using the autodie module, might help you.
$ perl -MDBI -wle'DBI->connect("dbi:CSV:csv_auto_diag=1")->prepare("se
+lect * from non_exist")->execute'
DBD::CSV::st execute failed:
Execution ERROR: Cannot open /home/merijn/non_exist: No such file or d
+irectory (2) at /pro/lib/perl5/site_perl/5.10.1/x86_64-linux/DBD/File
+.pm line 684
.
[for Statement "select * from non_exist"] at -e line 1.
$ perl -MDBI -wle'DBI->connect("dbi:CSV:csv_auto_diag=1")->prepare("se
+lect * from empty_file")->execute'
DBD::CSV::st execute failed:
Execution ERROR: Missing first row at /pro/lib/perl5/site_perl/5.10.1/
+x86_64-linux/DBD/File.pm line 684
.
[for Statement "select * from bin"] at -e line 1.
$
The second will also occur when the table cannot be opened as a file, e.g. when it is a folder or when the first line contains a (serious) error. If the header line was fine, errors in the data lines will now be printed immediately:
$ perl -MDBI -wle'DBI->connect("dbi:CSV:csv_auto_diag=1")->prepare("se
+lect * from bad")->execute'
DBD::CSV::st execute failed: Error 2034 while reading file /home/merij
+n/bad: EIF - Loose unescaped quote at /pro/lib/perl5/site_perl/5.10.1
+/SQL/Statement.pm line 1032
[for Statement "select * from bad"] at -e line 1.
$
I'll have a look if I can make the error reporting from the middle one (cannot open, empty file or bad header) a bit better.
Enjoy, Have FUN! H.Merijn
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|