[Dbix-class] having attribute with count
Les Fletcher
les at affinitycircles.com
Tue Jul 31 23:01:21 GMT 2007
I am building up a result set and am see difference between the actual
selection of the objects from the database and counting of those same
objects. The query has a prefetch, groupby, having and a limit clause.
What I am seeing is that when I request the objects from the database
the query is working just fine, but when I am doing a count, the having
clause is dropped from the count query. In the source of resultset I
see that the having attribute is deleted from time to time and then
processed differently. Is there something that I can do to ensure that
the having clause is used in the count? Thanks.
Les
The code is structured like this:
sub get_rs {
# returns a result set
...->search(
{
...
},
{
order_by => ...
having => ...
prefetch => ...
order_by => ...
}
);
}
sub get_records {
&get_rs->search(
undef,
{
page => 1,
rows => 10
}
)->all;
}
sub get_count {
&get_rs->count;
}
More information about the Dbix-class
mailing list