-
-
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
Conversation
|
|
||
| public function count($input) { | ||
| return new QueryFunction('COUNT(' . $this->helper->quoteColumnName($input) . ')'); | ||
| public function count($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.
wouldn't alias work by just using selectAlias($qb->func()->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.
Yeah, i added it here because its done quite often
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.
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 )) and it's duplicating code/functionality
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.
I'm fine with this here. It also reduces function nesting.
MorrisJobke
left a comment
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.
Code looks good 👍
|
@icewind1991 @rullzer Any comments on this one? |
icewind1991
left a comment
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.
fine with me
|
Yay PHPunit tests fail 😢 I should have checked that earlier |
Ah - disk was just full -> let's do another round: https://drone.nextcloud.com/nextcloud/server/12482 |
|
This causes the same "Disk is full" errors 😨 |
|
strange, let me investigate |
08ee437 to
7365078
Compare
| $qb->createFunction('COUNT(' . $qb->getColumnName('c.id') . ')'), | ||
| 'num_ids' | ||
| ) | ||
| ->addSelect($qb->func()->count('c.id', 'num_ids')) |
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 select here instead of addSelect which caused a lot of spam with missing index fileId across tests
|
Still this one: |
|
fixed |
7365078 to
82fb91b
Compare
|
Fails on Postgres https://drone.nextcloud.com/nextcloud/server/12537/167: |
Signed-off-by: Joas Schilling <[email protected]>
82fb91b to
bb352fb
Compare
MorrisJobke
left a comment
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.
Looks good 👍
Now there are only 2 "functions" left which are both called twice and don't have a wrapper:
Not sure if it's worth the effort.