Skip to content
Permalink
Browse files

add missing error checking to simple example

  • Loading branch information...
stanim committed Apr 14, 2016
1 parent 37aa7c6 commit ed211752885a3e9a33d39e12e8d0fa46c12d85fa
Showing with 16 additions and 2 deletions.
  1. +16 −2 _example/simple/simple.go
@@ -52,9 +52,16 @@ func main() {
for rows.Next() {
var id int
var name string
rows.Scan(&id, &name)
err = rows.Scan(&id, &name)
if err != nil {
log.Fatal(err)
}
fmt.Println(id, name)
}
err = rows.Err()
if err != nil {
log.Fatal(err)
}

stmt, err = db.Prepare("select name from foo where id = ?")
if err != nil {
@@ -86,7 +93,14 @@ func main() {
for rows.Next() {
var id int
var name string
rows.Scan(&id, &name)
err = rows.Scan(&id, &name)
if err != nil {
log.Fatal(err)
}
fmt.Println(id, name)
}
err = rows.Err()
if err != nil {
log.Fatal(err)
}
}

0 comments on commit ed21175

Please sign in to comment.
You can’t perform that action at this time.