Add error checking in simple example for tx.Commit
Based on https://golang.org/pkg/database/sql/#Tx.Commit this function returns an error type. So why not check it.sqlite-amalgamation-3390400
parent
43dcd3131f
commit
b819467576
|
@ -42,7 +42,10 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tx.Commit()
|
err = tx.Commit()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
rows, err := db.Query("select id, name from foo")
|
rows, err := db.Query("select id, name from foo")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue