use RETURNING syntax when creating base filter record during OPML import

This commit is contained in:
Andrew Dolgov
2025-05-06 05:06:17 +03:00
parent e91c49b747
commit 77e5deb9dd

View File

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