From b5a6806d856b7f90512bdd4287c116c08d8d5752 Mon Sep 17 00:00:00 2001 From: Adam Kennedy Date: Fri, 3 Apr 2009 21:43:14 +0000 Subject: [PATCH] Adding a test case reported on RT --- tmp.pl | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tmp.pl diff --git a/tmp.pl b/tmp.pl new file mode 100644 index 0000000..575a7c3 --- /dev/null +++ b/tmp.pl @@ -0,0 +1,41 @@ +#!/use/bin/perl + +use strict; +use warnings; + +use DBI; + +$ENV{PATH} = "/bin:/usr/sbin"; + +my $dbh = DBI->connect("DBI:SQLite:blah", "", ""); +SCOPE: { + my $sth = $dbh->do(q{DROP TABLE IF EXISTS t1}); + my $sth2 = $dbh->do(q{CREATE TABLE t1 (c1 text)}); + my $sth3 = $dbh->prepare(q{INSERT INTO t1 VALUES (?)}); + for my $i (1 .. 5) { + $sth3->execute($i); + } + $sth3->finish(); +} +$dbh->disconnect(); + +my @dbh; +for my $i (1 .. 2) { + print "$i: before connect\n"; + print `lsof -p $$|grep test`; + $dbh[$i] = DBI->connect("DBI:SQLite:blah", "", ""); + print "$i: after connect\n"; + print `lsof -p $$|grep test`; +# { + + my $sth = $dbh[$i]->prepare(q{SELECT count(1) from t1}); + $sth->execute(); + my ($count) = $sth->fetchrow_array; + print "count: $count\n"; + $sth->finish(); + +# } + $dbh[$i]->disconnect(); + print "$i: after disconnect\n"; + print `lsof -p $$|grep test`, "\n"; +}