Only prepare an SQL statement once.

This commit is contained in:
Arthur Schiwon 2013-03-25 21:46:50 +01:00
parent 1d676fb0e6
commit 2a2d409733
1 changed files with 4 additions and 1 deletions

View File

@ -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'], '"');