Use the defined func()->count() instead of manual counting#11942
Use the defined func()->count() instead of manual counting#11942MorrisJobke merged 1 commit intomasterfrom
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.
wouldn't alias work by just using selectAlias($qb->func()->count(...), 'alias')
There was a problem hiding this comment.
Yeah, i added it here because its done quite often
There was a problem hiding this comment.
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.
I'm fine with this here. It also reduces function nesting.
|
@icewind1991 @rullzer Any comments on this one? |
|
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.
@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 <coding@schilljs.com>
82fb91b to
bb352fb
Compare
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.