Append LIMIT 1 to getSource queries to improve performance

This commit is contained in:
Michael Gapczynski 2011-07-03 11:43:49 -04:00
parent b03083b881
commit e24e2d0e16

View file

@ -82,7 +82,7 @@ class OC_SHARE {
* @return source path
*/
public static function getSource($target) {
$query = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ?");
$query = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1");
$result = $query->execute(array($target, $_SESSION['user_id']))->fetchAll();
if (count($result) > 0) {
return $result[0]['source'];