use RETURNING syntax when creating base filter record

This commit is contained in:
Andrew Dolgov
2025-05-06 05:01:23 +03:00
parent ea6f42dc61
commit 9735ff83cc

View File

@@ -689,14 +689,10 @@ class Pref_Filters extends Handler_Protected {
$sth = $this->pdo->prepare("INSERT INTO ttrss_filters2
(owner_uid, match_any_rule, enabled, title, inverse) VALUES
(?, ?, ?, ?, ?)");
(?, ?, ?, ?, ?) RETURNING id");
$sth->execute([$_SESSION['uid'], $match_any_rule, $enabled, $title, $inverse]);
$sth = $this->pdo->prepare("SELECT MAX(id) AS id FROM ttrss_filters2
WHERE owner_uid = ?");
$sth->execute([$_SESSION['uid']]);
if ($row = $sth->fetch()) {
$filter_id = $row['id'];