[Catalyst] wrong generated SQL
Kenneth S Mclane
ksmclane at us.ibm.com
Fri Jun 1 18:10:38 GMT 2012
Matthias Zeichmann <matthias.zeichmann at gmail.com> wrote on 06/01/2012
01:04:58 PM:
> From:
>
> Matthias Zeichmann <matthias.zeichmann at gmail.com>
>
> To:
>
> The elegant MVC web framework <catalyst at lists.scsys.co.uk>
>
> Date:
>
> 06/01/2012 01:07 PM
>
> Subject:
>
> Re: [Catalyst] wrong generated SQL
>
> On Fri, Jun 1, 2012 at 6:55 PM, Kenneth S Mclane <ksmclane at us.ibm.com>
wrote:
> > Can someone tell me why this:
> >
> > my $rs1 = $c->model('ORANGES::File')->search({'report_id' =>
$rptcode}, {
> > rows => 1,
> > page => $page,
> > });
> >
> > Results in the following SQL?
> >
> > SELECT COUNT( * ) FROM HCDB_TEST.FILE me WHERE ( report_id = ? ):
'541861'
> >
> > When it used to create SQL that actually pulled the fields. It was
working
> > and I have had to re-create several of my template files which is how
I
> > discovered this. I made no changes to this code and suddenly it is
> > generating this count(*) instead of getting the columns.
>
> you probably used something like .all, .first or a while loop with
> .next on your resultset in your template.
> unless you do so again, no actual results are going to be fetched from
> your database
>
> you might just as well use "find" instead of search if you are only
> going for one row
>
> https://metacpan.org/module/DBIx::Class::ResultSet
>
> cheers m
> --
> siggen.pl: Segmentation Fault
I did use .next in my template, but this code should (and did) return 4
rows. I am also using a pager on the resultset, which still shows 4 pages
when I display the template, however I get no column data, just the count.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120601/6c5416cd/attachment.htm
More information about the Catalyst
mailing list