CASE WHEN arsse_subscriptions.title is not null THEN arsse_subscriptions.title ELSE arsse_feeds.title END as title,
(SELECT count(*) from arsse_articles where feed is arsse_subscriptions.feed) - (SELECT count(*) from (SELECT article,feed from arsse_subscription_articles join arsse_articles on article = arsse_articles.id where owner is ? and feed is arsse_feeds.id and read is 1)) as unread
(SELECT count(*) from arsse_articles where feed is arsse_subscriptions.feed) - (SELECT count(*) from (SELECT article,feed from arsse_marks join arsse_articles on article = arsse_articles.id where owner is ? and feed is arsse_feeds.id and read is 1)) as unread
from arsse_subscriptions join arsse_feeds on feed = arsse_feeds.id where owner is ?";
if(!is_null($folder)) {
if(!$this->db->prepare("SELECT count(*) from arsse_folders where owner is ? and id is ?", "str", "int")->run($user, $folder)->getValue()) {
@ -502,7 +502,7 @@ class Database {
}
if(sizeof($feed->changedItems)) {
$qDeleteCategories = $this->db->prepare('DELETE FROM arsse_categories WHERE article is ?', 'int');
$qClearReadMarks = $this->db->prepare('UPDATE arsse_subscription_articles SET read = 0, modified = CURRENT_TIMESTAMP WHERE article is ?', 'int');
$qClearReadMarks = $this->db->prepare('UPDATE arsse_marks SET read = 0, modified = CURRENT_TIMESTAMP WHERE article is ?', 'int');
$qUpdateArticle = $this->db->prepare(
'UPDATE arsse_articles SET url = ?, title = ?, author = ?, published = ?, edited = ?, modified = CURRENT_TIMESTAMP, guid = ?, content = ?, url_title_hash = ?, url_content_hash = ?, title_content_hash = ? WHERE id is ?',
feedintegernotnullreferencesarsse_feeds(id)ondeletecascade,-- feed for the subscription
urlTEXTnotnull,-- URL of article
urlTEXT,-- URL of article
titleTEXT,-- article title
authorTEXT,-- author's name
publisheddatetime,-- time of original publication
@ -72,9 +72,9 @@ create table arsse_articles(
modifieddatetimenotnulldefaultCURRENT_TIMESTAMP,-- date when article properties were last modified
guidTEXT,-- GUID
contentTEXT,-- content, as (X)HTML
url_title_hashvarchar(64),-- hash of URL + title; used when checking for updates and for identification if there is no guid.
url_content_hashvarchar(64),-- hash of URL + content, enclosure URL, & content type; used when checking for updates and for identification if there is no guid.
title_content_hashvarchar(64)-- hash of title + content, enclosure URL, & content type; used when checking for updates and for identification if there is no guid.
url_title_hashTEXTnotnull,-- hash of URL + title; used when checking for updates and for identification if there is no guid.
url_content_hashTEXTnotnull,-- hash of URL + content, enclosure URL, & content type; used when checking for updates and for identification if there is no guid.
title_content_hashTEXTnotnull-- hash of title + content, enclosure URL, & content type; used when checking for updates and for identification if there is no guid.