Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

aggregate function count broken for queries with :limit #7

Open
solnic opened this issue May 17, 2011 · 4 comments
Open

aggregate function count broken for queries with :limit #7

solnic opened this issue May 17, 2011 · 4 comments

Comments

@solnic
Copy link
Contributor

solnic commented May 17, 2011

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.)


Created by Ming - 2010-02-24 20:34:11 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1203

@solnic
Copy link
Contributor Author

solnic commented May 17, 2011

See #1416

by Martin Gamsjaeger (snusnu)

@solnic
Copy link
Contributor Author

solnic commented May 17, 2011

(from [1f9b8bf]) Add failing spec for #count called on a limited collection

[#1334 state:confirmed]
[#1203 state:confirmed]
[#1416 state:confirmed]
http://github.com/datamapper/dm-aggregates/commit/1f9b8bf0d97a2458b9721e5fa02a7f1f69fdcdf3

by Dan Kubb (dkubb)

@solnic
Copy link
Contributor Author

solnic commented May 17, 2011

(from [0b2afc9]) Mark #count on a limited collection spec as pending

[#1334 state:confirmed]
[#1203 state:confirmed]
[#1416 state:confirmed]
http://github.com/datamapper/dm-aggregates/commit/0b2afc96e4917e868853f3c9ddcc5c8f31ba58e5

by Dan Kubb (dkubb)

@solnic
Copy link
Contributor Author

solnic commented May 17, 2011

[bulk edit]

by Dan Kubb (dkubb)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant