Search Postgresql Archives

Catching errors with Perl DBI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How can I catch the errors generated whne I call an INSERT that violates a
constraint? I have coded like this:

             my $sth = $dbh->prepare($stmt);
			 my $rv = $sth->execute() or die $DBI::errstr;
			 if ( $rv < 0 ) {
				 print $DBI::errstr;
			 }

But, if the INSERT violates a constraint, it never gets the the evaluation
of the $rv

Is this a setting for the DBI?

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux