Merge pull request #15549 from owncloud/jcf-fix-cache-update

don't update identical values
This commit is contained in:
Morris Jobke 2015-04-22 13:34:08 +02:00
commit a971fa8a90
1 changed files with 8 additions and 1 deletions

View File

@ -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);
}
/**