aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-03-07 19:41:17 +0100
committerGravatar GitHub <noreply@github.com> 2021-03-07 19:41:17 +0100
commit0206fc1e5ea31d6a97838425153b8826d80fa3d6 (patch)
tree3cda06d8f7edf7b604e75cd81913955008ccef13 /app/Models/EntryDAO.php
parentb10cd770eeca5520d9beb5e4e2f1a85bfcb75a9b (diff)
fix updateEntryPrepared (#3500)
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index c6c4af62a..c641878ad 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -187,10 +187,10 @@ SQL;
$sql = 'UPDATE `_entry` '
. 'SET title=:title, author=:author, '
. ($this->isCompressed() ? 'content_bin=COMPRESS(:content)' : 'content=:content')
- . ', link=:link, date=:date, `lastSeen`=:last_seen, '
- . 'hash=' . $this->sqlHexDecode(':hash')
- . ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=:is_read, ')
- . 'tags=:tags '
+ . ', link=:link, date=:date, `lastSeen`=:last_seen'
+ . ', hash=' . $this->sqlHexDecode(':hash')
+ . ', is_read=COALESCE(:is_read, is_read)'
+ . ', tags=:tags '
. 'WHERE id_feed=:id_feed AND guid=:guid';
$this->updateEntryPrepared = $this->pdo->prepare($sql);
}
@@ -213,7 +213,9 @@ SQL;
$this->updateEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT);
$valuesTmp['lastSeen'] = time();
$this->updateEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT);
- if ($valuesTmp['is_read'] !== null) {
+ if ($valuesTmp['is_read'] === null) {
+ $this->updateEntryPrepared->bindValue(':is_read', null, PDO::PARAM_NULL);
+ } else {
$this->updateEntryPrepared->bindValue(':is_read', $valuesTmp['is_read'] ? 1 : 0, PDO::PARAM_INT);
}
$this->updateEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT);