From: gerhard6380 Date: Fri, 5 May 2017 20:29:25 +0000 (+0200) Subject: changed sql for photo table from to avoid memory issues on large photo tables X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=877ecf6d04e807752f2856adb84f6eebd2d45296;p=friendica.git changed sql for photo table from to avoid memory issues on large photo tables --- diff --git a/include/api.php b/include/api.php index fa267f22fc..d4bd5de9e8 100644 --- a/include/api.php +++ b/include/api.php @@ -3352,7 +3352,7 @@ $called_api = null; throw new BadRequestException("no new albumname specified"); } // check if album is existing - $r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `album` = '%s'", + $r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `album` = '%s'", intval(api_user()), dbesc($album)); if (!dbm::is_result($r)) { @@ -3460,7 +3460,7 @@ $called_api = null; $mode = "update"; // check if photo is existing in database - $r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' AND `album` = '%s'", + $r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' AND `album` = '%s'", intval(api_user()), dbesc($photo_id), dbesc($album)); @@ -3580,7 +3580,7 @@ $called_api = null; throw new BadRequestException("no photo_id specified"); } // check if photo is existing in database - $r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", + $r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", intval(api_user()), dbesc($photo_id) ); @@ -3659,7 +3659,7 @@ $called_api = null; // check if specified profile id is valid if ($profileid != 0) { - $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d", + $r = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `id` = %d", intval(api_user()), intval($profileid)); // error message if specified profile id is not in database @@ -3706,7 +3706,7 @@ $called_api = null; intval(local_user()) ); } else { - $r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d", + $r = q("UPDATE `profile` SET `photo` = '%s', `thumb` = '%s' WHERE `id` = %d AND `uid` = %d", dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype), dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype), intval($_REQUEST['profile']),