On Sat, 18 Jun 2005 15:34:36 +0100, Tim Bunce wrote:

> 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:
[snip] 
>> 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?

I'm writing a subclass designed to ensure that inserts coming in a
continuous stream get to the database even if the connection is down and
they have to be buffered on local disk pending retries.  (It only has to
handle inserts and the transaction issues are understood.)  So my subclass
is going to fire off a subprocess that does the actual connection to the
database and reconnects whenever necessary, while the parent writes insert
statements to files, looking to the user like a regular DBI interface
(although it will claim that all do()s succeed, will signal fatal errors
through a SIGCHLD handler croaking, and will probably croak on a fetch).
(Furthermore, I'll have to timeout connects and do()s in a couple of
seconds due to the data rate.)  It's my first DBI subclass and I've only
just started, so I may have to revise that design some, but that's the
current idea.  Therefore I'm planning on capturing the connect info from
connected() before the fork.

>> 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? :)

That wasn't what I had in mind :-)  What was the original intent?  Do
you not want to change the behavior because of legacy expectations, or
have I missed something in the reasoning behind providing connected()?

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/

Reply via email to