#1203 confirmed
Ming

aggregate function count broken for queries with :limit

Reported by Ming | February 24th, 2010 @ 02:34 PM | in 1.1.1

This is related to the problem and fix posted over a year ago:

 http://groups.google.com/group/datamapper/browse_thread/thread/503cfb37c9ca23e5/3031713f309910b1?lnk=gst&q=size+count#3031713f309910b1

dkubb commented out the optimization of size calling count

 http://github.com/datamapper/dm-more/commit/35ac591458ba477c875b3541f0b419a2c06f00e7

to use Array#size to properly recognize :limit in the query.

If size recognizes :limit in the query, shouldn't count also?

For instance, dm-pager assumes this of count and breaks on queries with :limit:

 http://github.com/visionmedia/dm-pagination/blob/master/lib/dm-pager/pagination.rb

 options.merge! :total => count(query), :page => page

(The root cause is probably do_mysql adapter not translating the query correctly.)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by

Pages