From e91c49b747f5a643d27b664c32bfa4d13be18346 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 6 May 2025 05:04:47 +0300 Subject: [PATCH] use RETURNING syntax when creating article record in share anything --- classes/Article.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/classes/Article.php b/classes/Article.php index c0d77123c..e939298bc 100644 --- a/classes/Article.php +++ b/classes/Article.php @@ -124,18 +124,15 @@ class Article extends Handler_Protected { $sth = $pdo->prepare("INSERT INTO ttrss_entries (title, guid, link, updated, content, content_hash, date_entered, date_updated) VALUES - (?, ?, ?, NOW(), ?, ?, NOW(), NOW())"); + (?, ?, ?, NOW(), ?, ?, NOW(), NOW()) RETURNING id"); $sth->execute([$title, $guid, $url, $content, $content_hash]); - $sth = $pdo->prepare("SELECT id FROM ttrss_entries WHERE guid = ?"); - $sth->execute([$guid]); - if ($row = $sth->fetch()) { $ref_id = $row["id"]; $sth = $pdo->prepare("UPDATE ttrss_entries - SET tsvector_combined = to_tsvector( :ts_content) - WHERE id = :id"); + SET tsvector_combined = to_tsvector( :ts_content) + WHERE id = :id"); $params = [ ":ts_content" => mb_substr(\Soundasleep\Html2Text::convert($content), 0, 900000), ":id" => $ref_id];