Date: | Sun, 28 Sep 2003 12:21:16 +0800 |
From: | Autrijus Tang <autrijus [...] autrijus.org> |
To: | Jesse Vincent <jesse [...] bestpractical.com> |
Subject: | [PATCH] SB::Handle::dbh should _not_ be singleton |
Patch follows. It was not advertised to be a singleton, and the
current behaviour breaks RTx::Report pretty hard.
I'm aware that it must be made a package variable to not break
Storable, so a per-object hash looks like a good idea to me.
I'd be happy if you can incoporate it into the next release, so
RTx::Report can have a SB version to depend on.
Thanks,
/Autrijus/
--- Handle.pm.orig Sun Sep 28 12:02:17 2003
+++ Handle.pm Sun Sep 28 12:18:32 2003
@@ -4,7 +4,7 @@
use DBI;
use strict;
use Class::ReturnValue;
-use vars qw($VERSION @ISA $DBIHandle $DEBUG $TRANSDEPTH);
+use vars qw($VERSION @ISA %DBIHandle $DEBUG $TRANSDEPTH);
$TRANSDEPTH = 0;
@@ -288,9 +288,9 @@
my $self=shift;
#If we are setting the database handle, set it.
- $DBIHandle = shift if (@_);
+ $DBIHandle{$self} = shift if (@_);
- return($DBIHandle);
+ return($DBIHandle{$self});
}
# }}}
@@ -760,6 +760,7 @@
sub DESTROY {
my $self = shift;
$self->Disconnect if $self->{'DisconnectHandleOnDestroy'};
+ delete $DBIHandle{$self};
}
Message body not shown because it is not plain text.