[Dbix-class] How to get bind values into DBIC::QueryLog

Cory Watson jheephat at gmail.com
Fri Sep 7 15:33:26 GMT 2007


On 9/7/07, Richard Jones <ra.jones at dpw.clara.co.uk> wrote:
> I find DBIx:Class::QueryLog very useful in dumping SQL data to the
> browser in a nicely formatted table, but find it lacks one very useful
> feature of DBIC::Profiler - displaying the bind values. That makes it
> easy to run the query manually in a client.

It doesn't lack this feature at all. The QueryLog object is just a
list of Query and Transaction objects.  Each Query object has a
params() accessor that will give you the bind values for the statement
that the Query object represents.

Something like (from memory, forgive syntax or other simple mistakes):

foreach my $trans (@{ $ql->log() }) {
  foreach my $query (@{ $trans->queries() }) {
    print $query->sql()." ".$query->params()."\n";
  }
}

Looking at the docs to answer your question I see some gaps.  I'll fix
them this weekend.

-- 
Cory 'G' Watson
http://www.onemogin.com



More information about the DBIx-Class mailing list