datamapper / dm-aggregates

DataMapper plugin providing support for aggregates on collections
http://datamapper.org/
MIT License
16 stars 15 forks source link

incorrect sql for limit + count (DM 1.0) #8

Open solnic opened 13 years ago

solnic commented 13 years ago

In DM 1.0, the expression Foo.all(:limit=>2).count produces the query SELECT COUNT(*) FROM foos LIMIT 2 which is incorrect, as the precedence of LIMIT applies to the one row returned by count. This is a big deal with many pagination plugins.


Created by Gary Yngve - 2010-06-23 04:55:07 UTC

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

solnic commented 13 years ago

(from [1f9b8bf0d97a2458b9721e5fa02a7f1f69fdcdf3]) 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 commented 13 years ago

(from [0b2afc96e4917e868853f3c9ddcc5c8f31ba58e5]) 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 commented 13 years ago

[bulk edit]

by Dan Kubb (dkubb)