[Dbix-class] Caching DBIx-Class Fixtures

Pedro Melo melo at simplicidade.org
Wed Jun 18 17:57:33 BST 2008


Hi,

On Jun 18, 2008, at 2:39 PM, Drew Taylor wrote:
> On Wed, Jun 18, 2008 at 2:18 PM, Ovid <publiustemp-dbic at yahoo.com>  
> wrote:
>> --- Drew Taylor <taylor.andrew.j at gmail.com> wrote:
>> So I guess this all goes back to my original question:  when I'm
>> running DBIx::Class, is there any way I can trap the SQL and bind
>> parameters used so I can potentially cache them?

Yes,  you can create your own statistics subclass. See http:// 
search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Storage/Statistics.pm

It will have access to the SQL and the bind parameters.


> You can dump the queries and the bind values using $ENV{DBIC_TRACE}. I
> suppose you could redirect that to a separate file somehow and parse
> it from there. That is pushing the extent of my DBIC internals
> knowledge, so someone else will have to chime in.

Actually DBIC_TRACE can be a filename. The syntax is:

$ENV{DBIC_TRACE} = '1=/tmp/trace.out';

See http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/ 
Troubleshooting.pod for more info.

Best regards,
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo at simplicidade.org
Use XMPP!





More information about the DBIx-Class mailing list