Ash Berlin wrote:

On 26 Feb 2008, at 11:23, Alex Povolotsky wrote:

Hello!

I'm using (with Catalyst and TT) some simple code to count related data

[% FOREACH loc IN llist -%]
<li>[% loc.name %] : (<a href="[% Catalyst.uri_for("edit/$loc.lid") %]>Edit</a>) [% loc.contacts.count+0 %] contacts (more): [% loc.servers.count+0 %] servers (more):
here will be traffic
[% END -%]

Debugging SQL requests, I've found that both counts use "select *" instead of "select count(*)".

Is it a bug or a feature? Maybe count should be better optimized?

Alex.


TT calls everything i list context. So that count method is actually TT's count vmethod.

you want [% loc.contacts_rs.count %] to get SELECT COUNT(*) executed.

Whooops... where is it documented?...

Alex.


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to