Merge pull request #15549 from owncloud/jcf-fix-cache-update
don't update identical values
This commit is contained in:
commit
a971fa8a90
|
@ -306,10 +306,17 @@ class Cache {
|
|||
}
|
||||
|
||||
list($queryParts, $params) = $this->buildParts($data);
|
||||
// duplicate $params because we need the parts twice in the SQL statement
|
||||
// once for the SET part, once in the WHERE clause
|
||||
$params = array_merge($params, $params);
|
||||
$params[] = $id;
|
||||
|
||||
$sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? WHERE `fileid` = ?';
|
||||
// don't update if the data we try to set is the same as the one in the record
|
||||
// some databases (Postgres) don't like superfluous updates
|
||||
$sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? ' .
|
||||
'WHERE (' . implode(' <> ? OR ', $queryParts) . ' <> ? ) AND `fileid` = ? ';
|
||||
\OC_DB::executeAudited($sql, $params);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue