The die may seem excessive, but I didn't expect any problems. Turns out I was wrong. The second and third column are marked as 'not null' in the database. This code died on the first line of the text file, claiming that the third column was null. I assumed I screwed up the regex, so added 1,2, and 3 to the die just to verify like so:if (/^\s*(\S+)\s+(\S+)\s+(.+\S)\s*$/) { $dbh->do('replace into reference_code values (?,?,?)',undef,$1,$ +2,$3) or die $dbh->errstr ;
and while it died with the same error, all three columns had a fair amount of data. Thinking something may be going wrong with the error string, I decided to print 1,2,and 3 just before each execution, just to make sure it was trying to insert what I thought it was:if (/^\s*(\S+)\s+(\S+)\s+(.+\S)\s*$/) { $dbh->do('replace into reference_code values (?,?,?)',undef,$1,$ +2,$3) or die "[$1] [$2] [$3] [". $dbh->errstr ."]";
This ran to completion without error. Wtf? If I comment out the print, it once again errors right off the bat saying the third column is null, and if I uncomment it again, it runs fine. ??????if (/^\s*(\S+)\s+(\S+)\s+(.+\S)\s*$/) { print "[$1] [$2] [$3]\n"; $dbh->do('replace into reference_code values (?,?,?)',undef,$1,$ +2,$3) or die "[$1] [$2] [$3] [". $dbh->errstr ."]";
In reply to Bitten by the lazy execution bug? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |