On Fri, Apr 16, 2004 at 01:19:09PM -0400, Michael Schwern wrote:
> On Friday, April 9, 2004, at 06:13 PM, Tim Bunce wrote:
> >On Fri, Apr 09, 2004 at 01:14:57PM -0400, Michael Schwern wrote:
> >>Now that I've used DBI::Profile and DBI::ProfileDumper for a few days,
> >>I've got some feature requests.
> >>
> >>It seems DBI::Profile doesn't record the statement handed to do().  So
> >>I get their profiling information all glommed together even when using
> >>DBIprofile_Statement and DBIprofile_Method.
> >
> >Umm, looks like a bug.
> >
> >>It would be nice if do() methods were handled same as prepared
> >>statements with profiling split by both statement and method.
> >
> >That should be.
> 
> You don't happen to have a patch lying around for this?  I've got a lot 
> of slow do() queries.

It's a bug in DBD::mysql and probably other drivers that implement
their own do() method. The $dbh->{Statement} attribute isn't being set.

Drivers implemented in C need to do something like this:

    tmp_svp = hv_fetch((HV*)SvRV(h), "Statement", 9, 1);
    sv_setsv(statement_sv);

and those in perl just the obvious $dbh->{Statement} = $statement;

[Drivers which don't implement their own do() method get the DBI's
default one which does a prepare()/execute() and the prepare() step
sets $dbh->{Statement}.]

Tim.

p.s. DBD::mysql also has a bug in that it doesn't validate the
number of bind variables passed to do()

Reply via email to