On Tue, Mar 29, 2005 at 11:55:57AM -0800, David Wheeler wrote:
> On Mar 29, 2005, at 2:39 AM, Tim Bunce wrote:
> 
> >>Callbacks should only apply to the database handle, I think.
> >
> >I don't see any reason to limit them in that way. They already work
> >for all methods on all handles. Note that sth callbacks, for example,
> >give you a relatively clean way to set the UTF8 flag on fetched data.
> 
> Oh, so you remember my winging about that last year, eh? I'll 
> definitely be taking advantage of that functionality.

Well, I was kinda hoping your next contribution might be an
implementation of $h->{SetUTF8} :-) That would be much faster.

[Look back in the archives for details.]

> Is there a way to 
> set it on an entire row at once, or would it have to be done for each 
> column in each row?

Each column.

> But I mispoke above. What I meant to say is that I can't see that they 
> should ever be applied to the driver handle. One doesn't really use the 
> driver handle or call methods on it.

A $drh->{Callbacks}->{connect} = ... would be a useful way to
supply callbacks for all future connects using that driver
without having to add explicit Callbacks to each connect call.


> >>That seems reasonable to me. Since the drh isn't really available in
> >>user space, it doesn't matter so much to me.
> >
> >   $drh = DBI->install_driver('Pg');
> >   $drh->{Callbacks} = ...
> >
> >but that's discouraged :)
> 
> Huh. What other attributes are settable on the drh (but discouraged)? 
> It doesn't make a lot of sense to me to do that...

Messing with driver handles gets in the way of DBD::Proxy,
which is why it's discouraged.

> >I've left in the "connect_cached.reused" special case but removed the
> >"connect" one as it wasn't 'special' enough and there's no clear need.
> >That'll do for now.
> 
> Well, and since that's the one I really need, it makes me happy. :-)

I added "connect_cached.new" as well, for consistency. It fires just
before the $drh->connect call.

Tim.

Reply via email to