diff options
author | Andrew Dolgov <[email protected]> | 2009-02-04 10:19:36 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2009-02-04 10:19:36 +0300 |
commit | 774b8df8739d2cab5656fa9907c6e6dd6f32158e (patch) | |
tree | e9a0b4c9fe8880abec0963e91cc2d319edf4e352 /offline.js | |
parent | 4681834e66e46584684cb4d28feb50ab00237cf3 (diff) |
move more stuff to offline.js
Diffstat (limited to 'offline.js')
-rw-r--r-- | offline.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/offline.js b/offline.js index 371aeecf0..58c2377c2 100644 --- a/offline.js +++ b/offline.js @@ -490,3 +490,28 @@ function update_local_feedlist_counters() { exception_error("update_local_feedlist_counters", e); } } + +function get_local_feed_unread(id) { + try { + var rs; + + if (id == -4) { + rs = db.execute("SELECT SUM(unread) FROM articles"); + } else if (id == -1) { + rs = db.execute("SELECT SUM(unread) FROM articles WHERE marked = 1"); + } else { + rs = db.execute("SELECT SUM(unread) FROM articles WHERE feed_id = ?", [id]); + } + + if (rs.isValidRow()) { + return rs.field(0); + } else { + return 0; + } + + } catch (e) { + exception_error("get_local_feed_unread", e); + } +} + + |