Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lukas Gernert <jangernert@gmail.com>2017-10-14 16:49:27 +0300
committerJan Lukas Gernert <jangernert@gmail.com>2017-10-14 16:49:27 +0300
commitad150d68c75cb26002512990a919111277ba2e64 (patch)
tree8dbab3a98cb015ac6bc2d9a781c8cdf9e53c1332
parentd3083139de6d210429c51f4ee1e861c79e210c02 (diff)
write icon_url of feeds to db
-rw-r--r--Constants.vala.in2
-rw-r--r--src/DataBaseReadOnly.vala13
-rw-r--r--src/DataBaseWriteAccess.vala6
3 files changed, 14 insertions, 7 deletions
diff --git a/Constants.vala.in b/Constants.vala.in
index d0ef77b9..d56f8f1f 100644
--- a/Constants.vala.in
+++ b/Constants.vala.in
@@ -56,7 +56,7 @@ namespace FeedReader {
public const string INSTALL_LIBDIR = "@PKGLIBDIR@";
public const string GIT_SHA1 = "@GIT_SHA1@";
public const string USER_AGENT = "FeedReader @VERSION@";
- public const int DB_SCHEMA_VERSION = 5;
+ public const int DB_SCHEMA_VERSION = 6;
public const int REDOWNLOAD_FAVICONS_AFTER_DAYS = 7;
// tango colors
diff --git a/src/DataBaseReadOnly.vala b/src/DataBaseReadOnly.vala
index 404a47cd..3d37472d 100644
--- a/src/DataBaseReadOnly.vala
+++ b/src/DataBaseReadOnly.vala
@@ -69,7 +69,8 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
"url" TEXT NOT NULL,
"category_id" TEXT,
"subscribed" INTEGER DEFAULT 1,
- "xmlURL" TEXT
+ "xmlURL" TEXT,
+ "iconURL" TEXT
)""");
executeSQL( """CREATE TABLE IF NOT EXISTS "main"."categories"
@@ -1119,12 +1120,12 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
while(stmt.step () == Sqlite.ROW)
{
var tmpfeed = new Feed(
- feedID,
+ stmt.column_text(0),
stmt.column_text(1),
stmt.column_text(2),
getFeedUnread(feedID),
StringUtils.split(stmt.column_text(3), ",", true),
- null,
+ stmt.column_text(6),
stmt.column_text(5));
return tmpfeed;
}
@@ -1157,6 +1158,7 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
string feedID = stmt.column_text(0);
string catString = stmt.column_text(3);
string xmlURL = stmt.column_text(5);
+ string iconURL = stmt.column_text(6);
string url = stmt.column_text(2);
string name = stmt.column_text(1);
var categories = StringUtils.split(catString, ",", true);
@@ -1167,7 +1169,7 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
else
count = getFeedUnread(feedID);
- var feed = new Feed(feedID, name, url, count, categories, null, xmlURL);
+ var feed = new Feed(feedID, name, url, count, categories, iconURL, xmlURL);
feeds.add(feed);
}
@@ -1249,10 +1251,11 @@ public class FeedReader.DataBaseReadOnly : GLib.Object {
string feedID = stmt.column_text(0);
string catString = stmt.column_text(3);
string xmlURL = stmt.column_text(5);
+ string iconURL = stmt.column_text(6);
string url = stmt.column_text(2);
string name = stmt.column_text(1);
var categories = StringUtils.split(catString, ",", true);
- var feed = new Feed(feedID, name, url, getFeedUnread(feedID), categories, null, xmlURL);
+ var feed = new Feed(feedID, name, url, getFeedUnread(feedID), categories, iconURL, xmlURL);
feeds.add(feed);
}
diff --git a/src/DataBaseWriteAccess.vala b/src/DataBaseWriteAccess.vala
index c24bc4b8..29d77d7e 100644
--- a/src/DataBaseWriteAccess.vala
+++ b/src/DataBaseWriteAccess.vala
@@ -171,6 +171,7 @@ public class FeedReader.DataBase : DataBaseReadOnly {
query.insertValuePair("category_id", "$CATID");
query.insertValuePair("subscribed", "1");
query.insertValuePair("xmlURL", "$XMLURL");
+ query.insertValuePair("iconURL", "$ICONURL");
query.build();
Sqlite.Statement stmt;
@@ -187,12 +188,14 @@ public class FeedReader.DataBase : DataBaseReadOnly {
int feedName_pos = stmt.bind_parameter_index("$FEEDNAME");
int feedURL_pos = stmt.bind_parameter_index("$FEEDURL");
int catID_pos = stmt.bind_parameter_index("$CATID");
- int xmlURL_pos = stmt.bind_parameter_index("$XMLURL");
+ int xmlURL_pos = stmt.bind_parameter_index("$XMLURL");
+ int iconURL_pos = stmt.bind_parameter_index("$ICONURL");
assert (feedID_pos > 0);
assert (feedName_pos > 0);
assert (feedURL_pos > 0);
assert (catID_pos > 0);
assert (xmlURL_pos > 0);
+ assert (iconURL_pos > 0);
foreach(var feed_item in feeds)
{
@@ -209,6 +212,7 @@ public class FeedReader.DataBase : DataBaseReadOnly {
stmt.bind_text(feedURL_pos, feed_item.getURL());
stmt.bind_text(catID_pos, catString);
stmt.bind_text(xmlURL_pos, feed_item.getXmlUrl());
+ stmt.bind_text(iconURL_pos, feed_item.getIconURL());
while(stmt.step() == Sqlite.ROW){}
stmt.reset();