in reply to Perl DBI: problems inserting data to a table
I'm going to assume (yeah, right) that this line is not throwing an exception:
$sth->execute(@arguments) or die $sth->errstr;
You might be getting bit by the "zero but true" return that DBI uses. That is, DBI can return a value of 0E0 when an error occurs, which evaluates as being true in a Boolean context but is equal to "0" in a numeric context.
I would change your test so it looks for a return value greater than 0 (since that statement should return the number of rows inserted), and if it is not, then print the error message from DBI. That might as least give you a hint to what is going on.
die $sth->errstr unless $sth->execute(@arguments) > 0;
You could of course use a print instead of die if you want to capture the output for all rows causing an error to a log file.
|
|---|