catchup_feed: proper fix for mysql 5.7

This commit is contained in:
Andrew Dolgov 2015-12-07 20:07:13 +03:00
parent c4d0e08060
commit a956648502
1 changed files with 16 additions and 16 deletions

View File

@ -1137,8 +1137,8 @@
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id (SELECT DISTINCT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id
AND owner_uid = $owner_uid AND unread = true AND feed_id IN AND owner_uid = $owner_uid AND unread = true AND feed_id IN
(SELECT id FROM ttrss_feeds WHERE $cat_qpart) AND $date_qpart) as tmp)"); (SELECT id FROM ttrss_feeds WHERE $cat_qpart) AND $date_qpart) as tmp)");
@ -1154,8 +1154,8 @@
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id (SELECT DISTINCT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id
AND owner_uid = $owner_uid AND unread = true AND feed_id = $feed AND $date_qpart) as tmp)"); AND owner_uid = $owner_uid AND unread = true AND feed_id = $feed AND $date_qpart) as tmp)");
} else if ($feed < 0 && $feed > LABEL_BASE_INDEX) { // special, like starred } else if ($feed < 0 && $feed > LABEL_BASE_INDEX) { // special, like starred
@ -1163,16 +1163,16 @@
if ($feed == -1) { if ($feed == -1) {
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id (SELECT DISTINCT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id
AND owner_uid = $owner_uid AND unread = true AND marked = true AND $date_qpart) as tmp)"); AND owner_uid = $owner_uid AND unread = true AND marked = true AND $date_qpart) as tmp)");
} }
if ($feed == -2) { if ($feed == -2) {
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id (SELECT DISTINCT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id
AND owner_uid = $owner_uid AND unread = true AND published = true AND $date_qpart) as tmp)"); AND owner_uid = $owner_uid AND unread = true AND published = true AND $date_qpart) as tmp)");
} }
@ -1189,16 +1189,16 @@
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id (SELECT DISTINCT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id
AND owner_uid = $owner_uid AND score >= 0 AND unread = true AND $date_qpart AND $match_part) as tmp)"); AND owner_uid = $owner_uid AND score >= 0 AND unread = true AND $date_qpart AND $match_part) as tmp)");
} }
if ($feed == -4) { if ($feed == -4) {
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id (SELECT DISTINCT id FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id
AND owner_uid = $owner_uid AND unread = true AND $date_qpart) as tmp)"); AND owner_uid = $owner_uid AND unread = true AND $date_qpart) as tmp)");
} }
@ -1208,8 +1208,8 @@
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT ttrss_entries.id FROM ttrss_entries, ttrss_user_entries, ttrss_user_labels2 WHERE ref_id = id (SELECT DISTINCT ttrss_entries.id FROM ttrss_entries, ttrss_user_entries, ttrss_user_labels2 WHERE ref_id = id
AND label_id = '$label_id' AND ref_id = article_id AND label_id = '$label_id' AND ref_id = article_id
AND owner_uid = $owner_uid AND unread = true AND $date_qpart) as tmp)"); AND owner_uid = $owner_uid AND unread = true AND $date_qpart) as tmp)");
@ -1220,8 +1220,8 @@
} else { // tag } else { // tag
db_query("UPDATE ttrss_user_entries db_query("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN SET unread = false, last_read = NOW() WHERE ref_id IN
(SELECT DISTINCT id FROM (SELECT id FROM
(SELECT ttrss_entries.id FROM ttrss_entries, ttrss_user_entries, ttrss_tags WHERE ref_id = ttrss_entries.id (SELECT DISTINCT ttrss_entries.id FROM ttrss_entries, ttrss_user_entries, ttrss_tags WHERE ref_id = ttrss_entries.id
AND post_int_id = int_id AND tag_name = '$feed' AND post_int_id = int_id AND tag_name = '$feed'
AND ttrss_user_entries.owner_uid = $owner_uid AND unread = true AND $date_qpart) as tmp)"); AND ttrss_user_entries.owner_uid = $owner_uid AND unread = true AND $date_qpart) as tmp)");