Re: Operations on statement handles when database handle is disconnected
"Martin J. Evans" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Organization | Easysoft Limited |
| Message-ID | <[email protected]> |
On 15/05/11 13:08, Jonathan Leffler wrote:
> Tested using Perl 5.13.4 and DBI 1.616 now - but I originally spotted the
> problem in 2003 when the versions were a lot older...
>
> Consider:
>
> # Test that statement handles from disconnected connections fail!
>
> use strict;
> use warnings;
> use DBI;
>
> my $table = "dbd_tester";
> my $dbh = DBI->connect('dbi:NullP:immaterial', '', '', {RaiseError=>1});
> #connect_to_test_database({RaiseError => 1});
> my $sth = $dbh->prepare(qq{INSERT INTO $table VALUES(?)});
> $dbh->disconnect;
> $sth->execute(1);
> print "** Failed to FAIL!\n";
>
>
> The print statement is executed, despite the fact that errors are supposed
> to be raised.
> I get the same result using DBD::Informix instead of NullP.
>
> Is this a defect in DBI or in DBD::Informix (and NullP)? Or is it WAD -
> Working As Designed?
>
DBD::ODBC ouputs:
DBD::ODBC::st execute failed: Unable to fetch information about the error at x.pl line 10.
DBD::ODBC::st execute failed: Unable to fetch information about the error at x.pl line 10.
It is unable to find why execute failed because the connection is closed.
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com