[Catalyst] C::M::DBIC::Schema::QyeryLog: can't collect any stats...
Marcello Romani
mromani at ottotecnica.com
Wed Sep 19 10:00:27 GMT 2007
Again on querylog vs. catalyst...
I've setup a minimal app to test the querylog stuff, but, I can't get
any results, i.e. the statistics obtained from querylog are always zero.
The attached file contains the entire app; here I show the most relevant
files.
I think I must be missing something obvious...
Thanks in advance for any help.
Model/Main.pm:
==============
package TestQueryLog::Model::Main;
use strict;
use warnings;
use base 'Catalyst::Model::DBIC::Schema::QueryLog';
__PACKAGE__->config(
schema_class => 'TestQueryLog::Schema',
connect_info => [
'dbi:Pg:dbname=testquerylog',
'testquerylog',
'testquerylog',
{ AutoCommit => 1, PrintError => 1, RaiseError => 1 },
],
);
1;
Schema.pm:
==========
package TestQueryLog::Schema;
use strict;
use warnings;
use base 'DBIx::Class::Schema';
__PACKAGE__->load_classes;
1;
Schema/Users.pm:
================
package TestQueryLog::Schema::Users;
use strict;
use warnings;
use base qw/ DBIx::Class /;
__PACKAGE__->load_components( qw/ PK::Auto Core / );
__PACKAGE__->table( 'users' );
__PACKAGE__->add_columns( qw/ id name email / );
__PACKAGE__->set_primary_key( qw/ id / );
1;
Controller/Users.pm:
====================
package TestQueryLog::Controller::Users;
use strict;
use warnings;
use base 'Catalyst::Controller';
sub list : Local {
my ( $self, $c ) = @_;
$c->stash->{items} = $c->model('Users');
return;
}
[snip]
1;
users/list.tt
=============
<table>
[% SET item = items.next %]
[% WHILE item %]
<tr>
<td>[% item.id %]</td>
<td>[% item.name %]</td>
<td>[% item.email %]</td>
</tr>
[% SET item = items.next %]
[% END %]
</table>
--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
More information about the Catalyst
mailing list