develooper Front page | perl.dbi.dev | Postings from May 2011

Operations on statement handles when database handle is disconnected

Thread Next
From:
Jonathan Leffler
Date:
May 15, 2011 05:08
Subject:
Operations on statement handles when database handle is disconnected
Message ID:
BANLkTimx335bgd1zv0e9c7RETiE16v_SyA@mail.gmail.com
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?

-- 
Jonathan Leffler <jonathan.leffler@gmail.com>  #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About