Golang database/sql.DB.Exec function example
package database/sql
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
Golang database/sql.DB.Exec function usage example
db, err := sql.Open("mysql", dbURL)
if err != nil {
t.Fatalf("Error connecting: %s", err.Error())
}
defer db.Close()
db.Exec("DROP TABLE IF EXISTS dummy") // <-- here
Reference :
Advertisement
Something interesting
Tutorials
+17.7k Golang : Read data from config file and assign to variables
+52.6k Golang : How to get struct field and value by name
+9.6k Golang : Read file with ioutil
+18.6k Golang : Generate thumbnails from images
+5.9k Golang : Extract unicode string from another unicode string example
+28.2k Golang : Connect to database (MySQL/MariaDB) server
+5.3k Swift : Convert string array to array example
+37.5k Golang : Converting a negative number to positive number
+8.4k Your page has meta tags in the body instead of the head
+12.7k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+20.9k Golang : Convert PNG transparent background image to JPG or JPEG image