Fix order of GREATEST for Oracle

As per https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions060.htm
Oracle uses the first value to cast the rest or the values.
So when the first value is a plain int, instead of doing the math,
it will cast the expression to int and continue with a potential 0.

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-11-04 17:02:23 +01:00
parent 2c6bbe783a
commit 3c027bd0cf
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 3 additions and 3 deletions

View File

@ -104,9 +104,9 @@ class Propagator implements IPropagator {
$builder = $this->connection->getQueryBuilder();
$builder->update('filecache')
->set('size', $builder->func()->greatest(
$builder->createNamedParameter(-1, IQueryBuilder::PARAM_INT),
$builder->func()->add('size', $builder->createNamedParameter($sizeDifference)))
)
$builder->func()->add('size', $builder->createNamedParameter($sizeDifference)),
$builder->createNamedParameter(-1, IQueryBuilder::PARAM_INT)
))
->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($builder->expr()->in('path_hash', $hashParams))
->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT)));