Hi, Are you not just really worried about losing your connection and if so can use $dbh->ping() ? Otherwise I think you have to be a little more detailed about "bad or good" with the statement handle. My only thought was that what can be esp difficult sometimes is a query that on execute causes the db or connection to die.
Eric At 10:19 PM 10/23/03 -0700, [EMAIL PROTECTED] wrote: >Let's assume that the $sth->prepare() was good but something failed at >this line: > >$sth = $dbh->exeute(); > >if($sth) is not consistent when connection or something goes bad. > >Can you or someone comment further about testing $sth if there are rows? > > >-thanks > >> On Wed, 22 Oct 2003 22:18:18 -0700 (PDT) [EMAIL PROTECTED] wrote: >> >>> How can I test the status of $sth itself? >>> >>> A scenario is that a $sth is passed from a sub. And now, I have a >>> $sth. Of course $sth->rows return 0 or whatever int row. However, a >>> test using $sth->rows is not good when something is wrong. It return >>> some large number. So How can I test to see if its bad or good >>> without access to previous calls? >> >> If the $dbh->prepare() call failed, $sth will be false. The only >> portable way to tell if $sth will return rows is to fetch some. >> >> -- >> Mac :}) >> ** I usually forward private questions to the appropriate mail list. ** >> Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html >> Give a hobbit a fish and he eats fish for a day. >> Give a hobbit a ring and he eats fish for an age. >> >> > > > >----------------------------------------- >eMail solutions by >http://www.swanmail.com > (250) 655 - 9513 (PST Time Zone) "Inquiry is fatal to certainty." -- Will Durant
