Only prepare an SQL statement once.
This commit is contained in:
parent
1d676fb0e6
commit
2a2d409733
|
@ -91,11 +91,14 @@ class Legacy {
|
|||
* @return string
|
||||
*/
|
||||
function getEtag($path) {
|
||||
static $query = null;
|
||||
list(, $user, , $relativePath) = explode('/', $path, 4);
|
||||
if (is_null($relativePath)) {
|
||||
$relativePath = '';
|
||||
}
|
||||
$query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND propertypath = ? AND propertyname = "{DAV:}getetag"');
|
||||
if(is_null($query)){
|
||||
$query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND propertypath = ? AND propertyname = "{DAV:}getetag"');
|
||||
}
|
||||
$result = $query->execute(array($user, '/' . $relativePath));
|
||||
if ($row = $result->fetchRow()) {
|
||||
return trim($row['propertyvalue'], '"');
|
||||
|
|
Loading…
Reference in New Issue