Re: Time to Document Callbacks
by David E . Wheeler other posts by this author
Oct 25 2009 10:40PM messages near this date
Re: Time to Document Callbacks
|
ppport.h
On Oct 25, 2009, at 10:24 PM, David E. Wheeler wrote:
> It output nothing. When I uncommented that second-to-last line, it
> output "Set in STH". So it seems that a callback added to the dbh
> for a statement method name does not end up getting passed on to the
> statement handle. So I guess the Callbacks attribute is not passed
> on to statement handles created for the database handle? Seems a
> shameâ¦
One other thing: It's nice that the callbacks execute before the
method call, so that you can disable it by undefing $_. But it'd be
equally handle to have callbacks after the method call. For example,
I'd love to be able to create a callback on a statement handle to
convert a timestamp column to a DateTime object:
$sth-> {PostCallbacks}{fetch} = sub {
my ($sth, $row) = @_;
$row-> [3] = DateTime::Format::Pg->parse_datetime($row->[3]);
};
Is this something that's done at any level in the callbacks, or would
it have to be added? Thoughts?
Thanks,
David
Thread:
David E. Wheeler
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
David Nicol
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
H.Merijn Brand
Tim Bunce
David E . Wheeler
David E. Wheeler
David E. Wheeler
David E . Wheeler
|