Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Oracle hates empty strings
  • Loading branch information
Vincent Petry authored and tomneedham committed Nov 1, 2017
commit fece7b2dc8db89d91d15ddc573615a13347a586f
18 changes: 14 additions & 4 deletions lib/private/Repair/RepairMismatchFileCachePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ private function fixEntryPath(IOutput $out, $fileId, $wrongPath, $correctStorage
// delete target if exists
$qb = $this->connection->getQueryBuilder();
$qb->delete('filecache')
->where($qb->expr()->eq('storage', $qb->createNamedParameter($correctStorageNumericId)))
->andWhere($qb->expr()->eq('path', $qb->createNamedParameter($correctPath)));
->where($qb->expr()->eq('storage', $qb->createNamedParameter($correctStorageNumericId)));

if ($correctPath === '' && $this->connection->getDatabasePlatform() instanceof OraclePlatform) {
$qb->andWhere($qb->expr()->isNull('path'));
} else {
$qb->andWhere($qb->expr()->eq('path', $qb->createNamedParameter($correctPath)));
}
$entryExisted = $qb->execute() > 0;

$qb = $this->connection->getQueryBuilder();
Expand Down Expand Up @@ -363,8 +368,13 @@ private function getOrCreateEntry($storageId, $path, $reuseFileId = null) {
// from oc_filecache
->from('filecache')
// where storage=$storage and path='$parentPath'
->where($qb->expr()->eq('storage', $qb->createNamedParameter($storageId)))
->andWhere($qb->expr()->eq('path', $qb->createNamedParameter($path)));
->where($qb->expr()->eq('storage', $qb->createNamedParameter($storageId)));

if ($path === '' && $this->connection->getDatabasePlatform() instanceof OraclePlatform) {
$qb->andWhere($qb->expr()->isNull('path'));
} else {
$qb->andWhere($qb->expr()->eq('path', $qb->createNamedParameter($path)));
}
$results = $qb->execute();
$rows = $results->fetchAll();
$results->closeCursor();
Expand Down