On Thu, Aug 30, 2001 at 07:15:41AM -0700, Randal L. Schwartz wrote:
> >>>>> "Alex" == Alex Pilosov <[EMAIL PROTECTED]> writes:
> 
> Alex> My tiny annoyance with DBI is (or maybe I don't understand the
> Alex> way DBI works) is that the only way I can add driver-specific
> Alex> functions to DBI handle is by using $dbh->func('funcname',args),
> Alex> which is pretty ugly. Is there a better way to be able to write
> Alex> directly $dbh->funcname(args)?
> 
> I think you would have to subclass DBI to create database handles that
> understand the new methods.

That's certainly one way, but it puts the method into the 'outer world'
of the application, not the 'inner world' for the driver. In other words
the DBI dispatcher doesn't see calls to those method so can't log them
of provide RaiseError/PrintError behaviour for them.

> But it would be interesting for DBI's
> dbhandles to have an AUTOLOAD (or equivalent) that first attempts a
> $dbh->func call with that name.  I don't know if that's worse or
> better than a controlled subclass. :)
> 
> Tim?

It's my intention to allow the DBI's private install_method() method
to be used to install driver-specific methods - so long as the name
of the method begins with the drivers own prefix (ie ora_ for DBD::Oracle).

Patches welcome.

Tim.

Reply via email to