diff options
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 0acc2c510..572c9054d 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -248,18 +248,18 @@ SQL; public function commitNewEntries(): bool { $sql = <<<'SQL' -SET @rank=(SELECT MAX(id) - COUNT(*) FROM `_entrytmp`); - -INSERT IGNORE INTO `_entry` ( - id, guid, title, author, content_bin, link, date, `lastSeen`, - hash, is_read, is_favorite, id_feed, tags, attributes -) -SELECT @rank:=@rank+1 AS id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags, attributes -FROM `_entrytmp` -ORDER BY date, id; - -DELETE FROM `_entrytmp` WHERE id <= @rank; -SQL; + SET @rank=(SELECT MAX(id) - COUNT(*) FROM `_entrytmp`); + + INSERT IGNORE INTO `_entry` ( + id, guid, title, author, content_bin, link, date, `lastSeen`, + hash, is_read, is_favorite, id_feed, tags, attributes + ) + SELECT @rank:=@rank+1 AS id, guid, title, author, content_bin, link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags, attributes + FROM `_entrytmp` etmp + ORDER BY etmp.date, etmp.id; + + DELETE FROM `_entrytmp` WHERE id <= @rank; + SQL; $hadTransaction = $this->pdo->inTransaction(); if (!$hadTransaction) { $this->pdo->beginTransaction(); |
