|
|
|
@ -30,15 +30,19 @@ 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=`' . $this->prefix . 'feed`.id AND e.is_read=0) ' |
|
|
|
|
. 'WHERE 1'; |
|
|
|
|
. 'WHERE e.id_feed=`' . $this->prefix . 'feed`.id AND e.is_read=0)'; |
|
|
|
|
$hasWhere = false; |
|
|
|
|
$values = array(); |
|
|
|
|
if ($feedId !== false) { |
|
|
|
|
$sql .= ' AND id=?'; |
|
|
|
|
$sql .= $hasWhere ? ' AND' : ' WHERE'; |
|
|
|
|
$hasWhere = true; |
|
|
|
|
$sql .= ' id=?'; |
|
|
|
|
$values[] = $feedId; |
|
|
|
|
} |
|
|
|
|
if ($catId !== false) { |
|
|
|
|
$sql .= ' AND category=?'; |
|
|
|
|
$sql .= $hasWhere ? ' AND' : ' WHERE'; |
|
|
|
|
$hasWhere = true; |
|
|
|
|
$sql .= ' category=?'; |
|
|
|
|
$values[] = $catId; |
|
|
|
|
} |
|
|
|
|
$stm = $this->bd->prepare($sql); |
|
|
|
|