Revert "INSERT ... RETURNING is well-supported now" - mysql doesn't...

This reverts commit 633d5c5348.
This commit is contained in:
Shish
2023-06-25 20:31:11 +00:00
parent 1f908bdd05
commit 33f32f7b22
11 changed files with 55 additions and 47 deletions

View File

@ -626,12 +626,12 @@ class CommentList extends Extension
if ($user->is_anonymous()) {
$page->add_cookie("nocache", "Anonymous Commenter", time()+60*60*24, "/");
}
$cid = $database->get_one(
"INSERT INTO comments(image_id, owner_id, owner_ip, posted, comment)
VALUES(:image_id, :user_id, :remote_addr, now(), :comment)
RETURNING id",
$database->execute(
"INSERT INTO comments(image_id, owner_id, owner_ip, posted, comment) ".
"VALUES(:image_id, :user_id, :remote_addr, now(), :comment)",
["image_id"=>$image_id, "user_id"=>$user->id, "remote_addr"=>get_real_ip(), "comment"=>$comment]
);
$cid = $database->get_last_insert_id('comments_id_seq');
$snippet = substr($comment, 0, 100);
$snippet = str_replace("\n", " ", $snippet);
$snippet = str_replace("\r", " ", $snippet);