[Catalyst] How to use querylog plugin...
Marcello Romani
mromani at ottotecnica.com
Tue Sep 18 16:28:17 GMT 2007
Marcello Romani ha scritto:
> Marcello Romani ha scritto:
>> Matt S Trout ha scritto:
>>> On Wed, Sep 12, 2007 at 04:13:36PM +0200, Marcello Romani wrote:
>>>> Hallo,
>>>> I've installed C::P::QueryLog and installed the template
>>>> provided by the pod doc, but I always get 0.00 seconds of elapsed
>>>> time, no matter how many db accesses I do.
>>>
>>> Uninstall it and use the replacement model mixin the author wrote after
>>> discussions on here about why it shouldn't have been a plugin.
>>>
>>
>> Well in fact I'm not using that pulgin at all... (I just installed it
>> - sorry for not thinking twice before writing).
>> I'm testing it in two separate ways: by using
>> C::M::DBIC::Schema::QueryLog as base class for my model class, and by
>> attaching a DBIx::Class::QueryLog object to the $schema instance.
>>
>> The problem is that the querylog object doesn't collecte any data (or
>> so it seems to me, since the stats are all zero...)
>>
>> I think I'll build a simple "dummy" app just for testing the querylog,
>> so I get to "know" it (I'm trying to use it in a non-trivial app).
>> Sometimes in order to solve a problem you need to isolate it...
>>
>> Thanks.
>>
>
> Ok, I've written a very small app that only has one table
> (users(id,name,email)) and a couple of methods (create, list). The app's
> model use base C::M::DBIC::Schema::QueryLog.
> Now my problem is how to obtain the querylog object used in the template
> from the docs...
>
> Thanks.
>
For future reference: if the model is
MyApp::Model::Main
then one can access the querylog object by calling:
$c->model('Main')->querylog
--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
More information about the Catalyst
mailing list