[jifty-devel] simple group by

Dobrica Pavlinusic dpavlin at rot13.org
Sat Apr 12 05:24:14 EDT 2008


On Fri, Apr 11, 2008 at 01:15:02AM +0200, Dobrica Pavlinusic wrote:
> Is it possible to model something like
> 
> select count(l),l from organizations group by l order by count desc
> 
> using Jifty::Collection ?

Let me answer my own question :-)

http://svn.rot13.org/index.cgi/A3C/view/lib/A3C/SQL.pm

I know, I know, it's evil SQL [dpavlin avoids eye contact with jessie],
but let's face it: SQL is DSL we all know, so let's use it! Usage
looks like Collection

http://svn.rot13.org/index.cgi/A3C/view/lib/A3C/View.pm

so I avoid context switch when looking at template.

I'm really interested in feedback about this. Am I the only one so stuck
with SQL in my mind that this is useful just in limited enviroment of my
app? Might this be useful to others and turned into Jifty plugin?

I don't really see clean way of enforcing current_user_can on this, but
from reading of JDBIC code, I can't really say how they are enforced
when using group_by (for which record is it enforced if I any data which
is not in group_by and I check my ACLs using other columns?)

-- 
Dobrica Pavlinusic               2share!2flame            dpavlin at rot13.org
Unix addict. Internet consultant.             http://www.rot13.org/~dpavlin


More information about the jifty-devel mailing list