From 1ee1fcce91d64c8cee6b8621aaedbdeae0c9c330 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 2 Feb 2021 00:03:59 +0100 Subject: INSERT ... ON CONFLIT DO NOTHING for addEntry (#3409) #fix https://github.com/FreshRSS/FreshRSS/issues/3402 Explicit `INSERT OR IGNORE` / `ON CONFLICT DO NOTHING` for the `addEntry()` method, which does expect some duplicates. --- app/Models/EntryDAOSQLite.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/Models/EntryDAOSQLite.php') diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index 12e8f27e1..e53583654 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -14,6 +14,10 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { return $x; } + public function sqlIgnoreConflict($sql) { + return str_replace('INSERT INTO ', 'INSERT OR IGNORE INTO ', $sql); + } + protected function autoUpdateDb($errorInfo) { if ($tableInfo = $this->pdo->query("SELECT sql FROM sqlite_master where name='tag'")) { $showCreate = $tableInfo->fetchColumn(); -- cgit v1.2.3