On Fri, Jun 17, 2005 at 05:49:01PM -0700, Peter Scott wrote:
> The connected() method of subclasses doesn't get all the attribute
> that were set by the caller; three of them are deleted first:
> 
> DBI.pm:
>    643              foreach $a (qw(RaiseError PrintError AutoCommit)) { # do 
> the
> se first
>    644                  next unless  exists $attr->{$a};
>    645                  $dbh->{$a} = delete $attr->{$a};
>    646              }
>    647              foreach $a (keys %$attr) {
>    648                  eval { $dbh->{$a} = $attr->{$a} } or $@ && warn $@;
>    649              }
>    650          }
>    651
>    652          # if we've been subclassed then let the subclass know that 
> we're
>  connected
>    653          $dbh->connected($dsn, $user, $pass, $attr) if ref $dbh ne 
> 'DBI::
> dbh;
> 
> I'd rather like to get those attributes in my subclass.  Would a
> patch be accepted?

They're only deleted as they're applied to the handle, so connected()
can get the values from the handle.

> Likewise - and this is more debatable - the $dsn passed to
> connected() has had the driver prefix stripped off so you can't
> tell which driver was used.

You can get it from $dbh->{Driver}->{Name}
(unless you're using DBI_AUTOPROXY, I think).

> That information would be most valuable to my application.

Why?

> It does seem from reading the documentation
> as though the expectation is that connected() will get the same
> arguments as connect(), so would a patch for this be accepted also?

A documentation patch? :)

Tim.

Reply via email to