Explorar el Código

SQL: SQLite syntax uniformisation

https://github.com/marienfressinaud/FreshRSS/commit/805c91da98c2f582e279f3c853fba9e43f572419#diff-101042bec0ff3ac9d691b2e77fca3313R7
Alexandre Alapetite hace 11 años
padre
commit
e358c5e2e1
Se han modificado 2 ficheros con 3 adiciones y 3 borrados
  1. 1 1
      app/Models/EntryDAOSQLite.php
  2. 2 2
      app/Models/FeedDAOSQLite.php

+ 1 - 1
app/Models/EntryDAOSQLite.php

@@ -10,7 +10,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
 		$sql = 'UPDATE `' . $this->prefix . 'feed` '
 		 . 'SET cache_nbUnreads=('
 		 .	'SELECT COUNT(*) AS nbUnreads FROM `' . $this->prefix . 'entry` e '
-		 .	'WHERE e.id_feed=feed.id AND e.is_read=0) '
+		 .	'WHERE e.id_feed=`' . $this->prefix . 'feed`.id AND e.is_read=0) '
 		 . 'WHERE 1';
 		$values = array();
 		if ($feedId !== false) {

+ 2 - 2
app/Models/FeedDAOSQLite.php

@@ -4,8 +4,8 @@ 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)';
+		     . 'SET cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),'
+		     . 'cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0)';
 		$stm = $this->bd->prepare($sql);
 		if ($stm && $stm->execute()) {
 			return $stm->rowCount();