Found why Edit*() methods didn't work, for UPDATE query Exec() method must be used instead of QueryRow().
This commit is contained in:
parent
cb623e8087
commit
5a72fbecb4
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user