|
32 | 32 | */ |
33 | 33 | namespace OC; |
34 | 34 |
|
| 35 | +use Doctrine\DBAL\Platforms\OraclePlatform; |
35 | 36 | use OCP\Cache\CappedMemoryCache; |
36 | 37 | use OCP\DB\QueryBuilder\IQueryBuilder; |
37 | 38 | use OCP\IConfig; |
@@ -490,12 +491,15 @@ public function getUsersForUserValue($appName, $key, $value) { |
490 | 491 | $this->fixDIInit(); |
491 | 492 |
|
492 | 493 | $qb = $this->connection->getQueryBuilder(); |
| 494 | + $configValueColumn = ($this->connection->getDatabasePlatform() instanceof OraclePlatform) |
| 495 | + ? $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR) |
| 496 | + : 'configvalue'; |
493 | 497 | $result = $qb->select('userid') |
494 | 498 | ->from('preferences') |
495 | 499 | ->where($qb->expr()->eq('appid', $qb->createNamedParameter($appName, IQueryBuilder::PARAM_STR))) |
496 | 500 | ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key, IQueryBuilder::PARAM_STR))) |
497 | 501 | ->andWhere($qb->expr()->eq( |
498 | | - $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR), |
| 502 | + $configValueColumn, |
499 | 503 | $qb->createNamedParameter($value, IQueryBuilder::PARAM_STR)) |
500 | 504 | )->orderBy('userid') |
501 | 505 | ->executeQuery(); |
@@ -524,13 +528,18 @@ public function getUsersForUserValueCaseInsensitive($appName, $key, $value) { |
524 | 528 | // Email address is always stored lowercase in the database |
525 | 529 | return $this->getUsersForUserValue($appName, $key, strtolower($value)); |
526 | 530 | } |
| 531 | + |
527 | 532 | $qb = $this->connection->getQueryBuilder(); |
| 533 | + $configValueColumn = ($this->connection->getDatabasePlatform() instanceof OraclePlatform) |
| 534 | + ? $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR) |
| 535 | + : 'configvalue'; |
| 536 | + |
528 | 537 | $result = $qb->select('userid') |
529 | 538 | ->from('preferences') |
530 | 539 | ->where($qb->expr()->eq('appid', $qb->createNamedParameter($appName, IQueryBuilder::PARAM_STR))) |
531 | 540 | ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key, IQueryBuilder::PARAM_STR))) |
532 | 541 | ->andWhere($qb->expr()->eq( |
533 | | - $qb->func()->lower($qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR)), |
| 542 | + $qb->func()->lower($configValueColumn), |
534 | 543 | $qb->createNamedParameter(strtolower($value), IQueryBuilder::PARAM_STR)) |
535 | 544 | )->orderBy('userid') |
536 | 545 | ->executeQuery(); |
|
0 commit comments