On Sun, Feb 13, 2005 at 05:48:26PM -0800, David Wheeler wrote:
> On Feb 13, 2005, at 2:51 PM, Tim Bunce wrote:
>
> >>>Maybe the answer it to not allow changing attributes on a cached
> >>>handle.
> >>
> >>That's already the rule and would not change.
> >
> >Er, that's news to me.
>
> Uh, sorry, I was thinking of the resetting of AutoCommit.
>
> >Different applications use handle caching for different reasons.
> >For many changing attribute values is okay. But I can see value in
> >making it easy to warn or die on attribute changes.
>
> Yes, I agree.
>
> >If we had per-handle-per-method callbacks (as previously discussed)
> >then it would be easy to add a callback for STORE to implement that.
> >That's the only practical way to do it without modifying all drivers.
>
> They just seemed to be getting so complex...
In relation to connect_cached it boiled down to just the difference between:
if ($dbh and my $oc = $dbh->{OnConnect}) {
$oc->($dbh, $dsn, $user, $pass, $attr) if ref $oc eq 'CODE';
}
and:
if (my $cb = $dbh->{Callbacks}) {
my $oc = $cb->{"connect_cached.reused"};
$oc->($dbh, $dsn, $user, $pass, $attr) if ref $oc eq 'CODE';
}
Not much in it really! :)
The rest of the $h->{Callbacks} infrastructure needn't be implemented
for just that bit. All it needs is for Callbacks to become a valid
DBI attribute.
Tim.