1
0

Found why Edit*() methods didn't work, for UPDATE query Exec() method must be used instead of QueryRow().

This commit is contained in:
Alexander Andreev 2023-05-09 23:31:39 +04:00
parent cb623e8087
commit 5a72fbecb4
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -212,9 +212,9 @@ func (d *SQLiteDatabase) EditEntry(entry *guestbook.Entry) error {
}
defer tx.Rollback()
row := tx.Stmt(stmtUpdateEntry).QueryRow(entry.Name, entry.Message, entry.Website, entry.HideWebsite, entry.ID)
if row.Err() != nil {
return row.Err()
_, err = tx.Stmt(stmtUpdateEntry).Exec(entry.Name, entry.Message, entry.Website, entry.HideWebsite, entry.ID)
if err != nil {
return err
}
tx.Commit()
@ -261,9 +261,9 @@ func (d *SQLiteDatabase) EditReply(reply *guestbook.Reply) error {
}
defer tx.Rollback()
row := tx.Stmt(stmtUpdateReply).QueryRow(reply.Message, reply.ID)
if row.Err() != nil {
return row.Err()
_, err = tx.Stmt(stmtUpdateReply).Exec(reply.Message, reply.ID)
if err != nil {
return err
}
tx.Commit()