aboutsummaryrefslogtreecommitdiff
path: root/app/Models/FeedDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-07-05 01:52:41 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-07-05 01:52:41 +0200
commit805c91da98c2f582e279f3c853fba9e43f572419 (patch)
tree4f81b17c32a896e0b6b66f4622f31dc550d7b872 /app/Models/FeedDAOSQLite.php
parent1b43167fb8206dfd17923c389de1e3bd6b76045e (diff)
Add support for SQLite
https://github.com/marienfressinaud/FreshRSS/issues/100 Warning: MySQL has been changed too, so bugs may have been introduced
Diffstat (limited to 'app/Models/FeedDAOSQLite.php')
-rw-r--r--app/Models/FeedDAOSQLite.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.php
index f3c92149e..bb75c860b 100644
--- a/app/Models/FeedDAOSQLite.php
+++ b/app/Models/FeedDAOSQLite.php
@@ -2,4 +2,18 @@
class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO {
+ public function updateCachedValues() { //For one single feed, call updateLastUpdate($id)
+ $sql = 'UPDATE `' . $this->prefix . 'feed` '
+ . 'SET cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=feed.id),'
+ . 'cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=feed.id AND e2.is_read=0)';
+ $stm = $this->bd->prepare($sql);
+ if ($stm && $stm->execute()) {
+ return $stm->rowCount();
+ } else {
+ $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
+ Minz_Log::record('SQL error updateCachedValues: ' . $info[2], Minz_Log::ERROR);
+ return false;
+ }
+ }
+
}