New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #135: CActiveRecord::count() respects group and having #2167
Issue #135: CActiveRecord::count() respects group and having #2167
Conversation
Was it tested with non-MySQL? Especially SQLite. |
Test case "CActiveRecordTest" uses SQLite memory connection (line 19). |
This pull request adds logic from "CDbCommandBuilder::createCountCommand()" to "CActiveFinder::count()". |
Looks OK for me. @yiisoft/core-developers any comments? |
This could potentially break BC. |
In this fix I perform the count via sub query, which means count of the result of other query. Actually the solution I suggest just copies the approach of "CDbCommandBuilder::createCountCommand()". Back there none has any complains. |
By BC, I mean users' existing code may rely on the fact that group-by/having is ignored in the old code. |
As for BC: may be you should tell @zhongjq and @alexandernst the issue they request actually breaks a BC and just close the issue #135. |
I think we should try merging it for the next RC. |
It seems like most people who want group by/having to work with their code show up here to report bugs :-) There are regular reports of problems. Having it actually fixed and then clearly documented as one of the more major fixes would eliminate the BC concern, wouldn't it? |
Should be OK but we definitely need to mention it in the UPGRADE. |
…ect-group-and-having Issue #135: CActiveRecord::count() respects group and having
Thanks for working on this one. |
You forgot to add the params (bindParams()) to the criteria |
@simontong, it is already done by #2230 |
Fixes #135
Now "CActiveRecord::count()" respects group and having.
Unit tests for "CActiveRecord" has been updated. Tests have been passed successfully.