Skip to content

Commit

Permalink
Empty string is null on oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
rullzer committed Jun 10, 2016
1 parent 6022528 commit 28d9ad2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/private/Repair/AvatarPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
namespace OC\Repair;

use Doctrine\DBAL\Platforms\OraclePlatform;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
Expand Down Expand Up @@ -71,9 +72,16 @@ protected function fixUserRootPermissions() {
->from('storages')
->where($qb->expr()->like('id', $qb2->createParameter('like')));

if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
// '' is null on oracle
$path = $qb2->expr()->isNull('path');
} else {
$path = $qb2->expr()->eq('path', $qb2->createNamedParameter(''));
}

$qb2->update('filecache')
->set('permissions', $qb2->createNamedParameter(23))
->where($qb2->expr()->eq('path', $qb2->createNamedParameter('')))
->where($path)
->andWhere($qb2->expr()->in('storage', $qb2->createFunction($qb->getSQL())))
->andWhere($qb2->expr()->neq('permissions', $qb2->createNamedParameter(23)))
->setParameter('like', 'home::%');
Expand Down

0 comments on commit 28d9ad2

Please sign in to comment.