@@ -302,9 +302,10 @@ public void setArticleIsRead(string articleIDs, ArticleStatus readStatus)
302302 var read = readStatus == ArticleStatus . READ ;
303303 Logger . debug(" Mark " + articleIDs + " as " + (read ? " read" : " unread" ));
304304 var entries = new Gee .ArrayList<Decsync . EntryWithPath >();
305+ var db = DataBase . readOnly();
305306 foreach (var articleID in articleIDs. split(" ," ))
306307 {
307- Article ? article = DataBase . readOnly() . read_article(articleID);
308+ Article ? article = db . read_article(articleID);
308309 if (article != null )
309310 {
310311 var path = articleToPath(article, " read" );
@@ -380,12 +381,13 @@ public bool addFeed(string feedURL, string? catID, string? newCatName, out strin
380381
381382public bool addFeedWithDecsync (string feedURL , string ? catID , string ? newCatName , out string feedID , out string errmsg , bool updateDecsync = true )
382383{
384+ var db = DataBase . writeAccess();
383385 var catIDs = new Gee .ArrayList<string> ();
384386 if (catID == null && newCatName != null )
385387 {
386388 string cID = createCategory(newCatName, null );
387389 var cat = new Category (cID, newCatName, 0 , 99 , CategoryID . MASTER. to_string(), 1 );
388- DataBase . writeAccess() . write_categories(ListUtils . single(cat));
390+ db . write_categories(ListUtils . single(cat));
389391 catIDs. add(cID);
390392 }
391393 else if (catID != null && newCatName == null )
@@ -404,8 +406,8 @@ public bool addFeedWithDecsync(string feedURL, string? catID, string? newCatName
404406
405407 if (feed != null )
406408 {
407- if (! DataBase . readOnly() . feed_exists(feed. getURL())) {
408- DataBase . writeAccess() . write_feeds(ListUtils . single(feed));
409+ if (! db . feed_exists(feed. getURL())) {
410+ db . write_feeds(ListUtils . single(feed));
409411
410412 if (updateDecsync)
411413 {
@@ -455,8 +457,9 @@ public void moveFeed(string feedID, string newCatID, string? currentCatID)
455457
456458public string createCategory (string title , string ? parentID )
457459{
458- string ? catID = DataBase . readOnly(). getCategoryID(title);
459- while (catID == null || DataBase . readOnly(). read_category(catID) != null )
460+ var db = DataBase . readOnly();
461+ string ? catID = db. getCategoryID(title);
462+ while (catID == null || db. read_category(catID) != null )
460463 {
461464 catID = " catID%05d " . printf(Random . int_range(0 , 100000 ));
462465 }
@@ -561,6 +564,7 @@ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, str
561564
562565 Logger . debug(" Got %u articles" . printf(doc. get_items(). length()));
563566 var newArticles = new Gee .ArrayList<Article > ();
567+ var db = DataBase . readOnly();
564568 foreach (Rss . Item item in doc. get_items())
565569 {
566570 string ? articleID = item. guid;
@@ -576,9 +580,9 @@ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, str
576580 articleID = item. link;
577581 }
578582
579- if (DataBase . readOnly() . read_article(articleID) != null )
580- {
581- continue ;
583+ if (db . read_article(articleID) != null )
584+ {
585+ continue ;
582586 }
583587
584588 var date = Rfc822 . parseDate(item. pub_date);
0 commit comments