mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-23 11:38:34 -04:00
PostgreSQL compatibility boolean
https://github.com/FreshRSS/FreshRSS/issues/1311
This commit is contained in:
1 parent
1013c7d2e2
commit
d184478fb4
2 files changed
+16
-8
No files matched your search
@@ -273,15 +273,19 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
||||
. 'WHERE e.is_read=0 '
|
||||
. 'GROUP BY e.id_feed'
|
||||
. ') x ON x.id_feed=f.id '
|
||||
. 'SET f.`cache_nbUnreads`=COALESCE(x.nbUnreads, 0) '
|
||||
. 'WHERE 1';
|
||||
. 'SET f.`cache_nbUnreads`=COALESCE(x.nbUnreads, 0)';
|
||||
$hasWhere = false;
|
||||
$values = array();
|
||||
if ($feedId !== false) {
|
||||
$sql .= ' AND f.id=?';
|
||||
$sql .= $hasWhere ? ' AND' : ' WHERE';
|
||||
$hasWhere = true;
|
||||
$sql .= ' f.id=?';
|
||||
$values[] = $id;
|
||||
}
|
||||
if ($catId !== false) {
|
||||
$sql .= ' AND f.category=?';
|
||||
$sql .= $hasWhere ? ' AND' : ' WHERE';
|
||||
$hasWhere = true;
|
||||
$sql .= ' f.category=?';
|
||||
$values[] = $catId;
|
||||
}
|
||||
$stm = $this->bd->prepare($sql);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user