catching errors from BDI.pm

From: Jeffrey <seesej(at)uswest(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: catching errors from BDI.pm
Date: 2000-04-16 00:12:31
Message-ID: B51E537E.375B%seesej@uswest.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am having trouble catching errors from postgress. I am connecting to the
database via perl and DBI.pm The following will work

($dbh = DBI->connect("$dsn", "", "") ) or (print $DBI::errstr and exit());

But this wont (from deliberately spelled wrong)
($sth=$dbh->prepare("select * form tablename")) || (
# error
print "\nError".$dbh->errstr
# error
);

Actually it will work from a telnet prompt, but if I run this script in a
cgi, it writes the error to the error log instead of the standard out. It
does not execute the code inside the error comments.

Thank you for your help
Jeff Seese

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph 2000-04-16 01:55:20 Win32 Install
Previous Message Bruce Momjian 2000-04-15 19:54:37 Re: Does error within transaction imply restarting it?