Re: OO Architecture

[email protected] (Henri Asseily) Wed, 28 Sep 2005 08:55:30 -0700
Newsgroups perl.dbi2.dev
Message-ID <[email protected]>
>>>What examples of DBI subclassing can you show to prove your case?
>>
>>Hmm...isn't Apache::DBI an example
> 
> 
> Nope, as Ask says, it hooks in using connect_via (to be as transparent
> as possible).

Yep, years ago when I tried to figure out how Apache::DBI did this so I 
could replicate it for myself, I was dismayed to find out it relied on 
what Honza calls a hack. Then I started subclassing DBI.

> Basically go with "DBI handle IS-A driver handle" (which makes
> subclassing hard because each driver uses different class names).
> But also supply a module that provides a transparent 'proxy' object
> which HAS-A driver handle.  Then anyone wanting to subclass the DBI
> would use that as the base class.
> 
> The win is that the price for re-dispatching the method calls is only
> paid by those who want to use it.
> 
> Any problems with that?

That will work fine for me. As long as we have such a way to hook into 
DBI, the advantage of simpler access to the DBD itself within the 
subclass should outweigh any time spent rewriting old DBI subclasses.

H