sql: limit 1 for UPDATE and DELETE is not supported by the SQL standard and postgresql

(see: https://www.postgresql.org/message-id/flat/1291109101.26137.35.camel%40pcd12478 )
This commit is contained in:
Florian Steinel
2016-10-27 02:41:32 +02:00
parent c3af36d33b
commit c1c96e01fa
11 changed files with 19 additions and 19 deletions

View File

@@ -448,7 +448,7 @@ class Connedit extends \Zotlabs\Web\Controller {
}
if($cmd === 'resetphoto') {
q("update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s' limit 1",
q("update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s'",
dbesc($orig_record[0]['xchan_hash'])
);
$cmd = 'refresh';

View File

@@ -707,7 +707,7 @@ class Events extends \Zotlabs\Web\Controller {
$sync_event = $r[0];
if($r) {
$r = q("delete from event where event_hash = '%s' and uid = %d limit 1",
$r = q("delete from event where event_hash = '%s' and uid = %d",
dbesc($event_id),
intval(local_channel())
);

View File

@@ -226,7 +226,7 @@ class Like extends \Zotlabs\Web\Controller {
$z[0]['deleted'] = 1;
build_sync_packet($ch[0]['channel_id'],array('likes' => $z));
q("delete from likes where id = %d limit 1",
q("delete from likes where id = %d",
intval($z[0]['id'])
);
if($z[0]['i_mid']) {

View File

@@ -259,7 +259,7 @@ class Photos extends \Zotlabs\Web\Controller {
@file_put_contents($r[0]['content'],$ph->imageString());
$data = $r[0]['content'];
$fsize = @filesize($r[0]['content']);
q("update attach set filesize = %d where hash = '%s' and uid = %d limit 1",
q("update attach set filesize = %d where hash = '%s' and uid = %d",
intval($fsize),
dbesc($resource_id),
intval($page_owner_uid)

View File

@@ -70,7 +70,7 @@ class Regdir extends \Zotlabs\Web\Controller {
if(! $result['success'])
$valid = 0;
q("update site set site_valid = %d where site_url = '%s' limit 1",
q("update site set site_valid = %d where site_url = '%s'",
intval($valid),
strtolower($url)
);