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

Reply via email to