experimental: add optional _HEADLINES_QUERY_NO_DISTINCT to disable DISTINCT keyword in queryFeedHeadlines query

This commit is contained in:
Andrew Dolgov 2020-12-03 14:42:01 +03:00
parent 81c52b4b1e
commit e9673eb13d
1 changed files with 7 additions and 4 deletions

View File

@ -1412,6 +1412,9 @@ class Feeds extends Handler_Protected {
$pdo = Db::pdo(); $pdo = Db::pdo();
// experimental: define _HEADLINES_QUERY_NO_DISTINCT to disable DISTINCT keyword on headline queries
$HEADLINES_QUERY_DISTINCT = defined('_HEADLINES_QUERY_NO_DISTINCT') ? "" : "DISTINCT";
// WARNING: due to highly dynamic nature of this query its going to quote parameters // WARNING: due to highly dynamic nature of this query its going to quote parameters
// right before adding them to SQL part // right before adding them to SQL part
@ -1729,7 +1732,7 @@ class Feeds extends Handler_Protected {
if (!$search && !$skip_first_id_check) { if (!$search && !$skip_first_id_check) {
// if previous topmost article id changed that means our current pagination is no longer valid // if previous topmost article id changed that means our current pagination is no longer valid
$query = "SELECT DISTINCT $query = "SELECT $HEADLINES_QUERY_DISTINCT
ttrss_feeds.title, ttrss_feeds.title,
date_entered, date_entered,
$yyiw_qpart, $yyiw_qpart,
@ -1769,7 +1772,7 @@ class Feeds extends Handler_Protected {
} }
} }
$query = "SELECT DISTINCT $query = "SELECT $HEADLINES_QUERY_DISTINCT
date_entered, date_entered,
$yyiw_qpart, $yyiw_qpart,
guid, guid,
@ -1810,7 +1813,7 @@ class Feeds extends Handler_Protected {
} else { } else {
// browsing by tag // browsing by tag
$query = "SELECT DISTINCT $query = "SELECT $HEADLINES_QUERY_DISTINCT
date_entered, date_entered,
guid, guid,
note, note,