[Dbix-class] Query translation

Kenneth S Mclane ksmclane at us.ibm.com
Fri May 11 13:15:26 GMT 2012


I created a resultset, but am at a loss as to how to integrate it into the 
existing query I am building.

sub list :Local {
        my ($self, $c, $page) = @_;
        $page = $c->req->param('page') || 1;
        my $rs = $c->model('ORANGES::Server')->search_rs(undef, { 
                prefetch => ['account','subs', 'server'],
                rows => 15,
                page => $page,
                order_by => ['account.account_code', 'me.server_name'],
        });
        $c->stash(rows => $rs);
        $c->stash(pager => $rs->pager());
        $c->stash->{'template'}=>'server/list';
} 




From:
fREW Schmidt <frioux at gmail.com>
To:
"DBIx::Class user and developer list" <dbix-class at lists.scsys.co.uk>
Date:
05/10/2012 05:29 PM
Subject:
Re: [Dbix-class] Query translation




Ok, I understand how that works I think, but how/where do I integrate it 
into my code as I am using Catalyst models and I'm very confused on this 
one. 

I don't completely have enough information to answer, but you need to make 
a base resultset and use that in your schema, and put the correlate helper 
in the base resultset.  "Catalyst models" are just DBIx::Class results. 
-- 
fREW Schmidt
http://blog.afoolishmanifesto.com
_______________________________________________
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/dbix-class@lists.scsys.co.uk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120511/b1116e5f/attachment.htm


More information about the DBIx-Class mailing list