-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Use the defined func()->count() instead of manual counting #11942
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,7 +72,8 @@ public function subtract($x, $y) { | |
| return new QueryFunction($this->helper->quoteColumnName($x) . ' - ' . $this->helper->quoteColumnName($y)); | ||
| } | ||
|
|
||
| public function count($input) { | ||
| return new QueryFunction('COUNT(' . $this->helper->quoteColumnName($input) . ')'); | ||
| public function count($count, $alias = '') { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wouldn't alias work by just using
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, i added it here because its done quite often
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. having it here doesn't make sense to me though, since for the caller it's not any easier (the only difference is where you place the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with this here. It also reduces function nesting. |
||
| $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; | ||
| return new QueryFunction('COUNT(' . $this->helper->quoteColumnName($count) . ')' . $alias); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MorrisJobke the problem was
selecthere instead ofaddSelectwhich caused a lot of spam with missing index fileId across tests