Golang database/sql.Stmt.Close function example
package database/sql
Close closes the statement.
Golang database/sql.Stmt.Close function usage example
func closeResources(rows *sql.Rows, stmt *sql.Stmt) error {
var err error
if rows != nil {
err = rows.Close()
if err != nil {
return err
}
}
if stmt != nil {
err = stmt.Close() // <--- here
if err != nil {
return err
}
}
return nil
}
Reference :
Advertisement
Something interesting
Tutorials
+13.6k Golang : reCAPTCHA example
+7.7k Golang : How to execute code at certain day, hour and minute?
+46.4k Golang : Encode image to base64 example
+9.3k Golang : Generate random Chinese, Japanese, Korean and other runes
+7.9k Golang Hello World Example
+6k Golang : Compound interest over time example
+5.5k Golang : Stop goroutine without channel
+17.1k Golang : Capture stdout of a child process and act according to the result
+7.2k CloudFlare : Another way to get visitor's real IP address
+5.8k Golang : Find change in a combination of coins example
+9.6k Golang : How to generate Code 39 barcode?
+13.7k Golang : Image to ASCII art example