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
+11.6k Get form post value in Go
+6.5k Unix/Linux : How to get own IP address ?
+10.2k Golang : Text file editor (accept input from screen and save to file)
+5.3k Golang : Generate Interleaved 2 inch by 5 inch barcode
+19.3k Golang : Calculate entire request body length during run time
+9.7k Golang : Find correlation coefficient example
+10.6k Golang : Flip coin example
+36.7k Golang : Display float in 2 decimal points and rounding up or down
+19.1k Golang : Display list of time zones with GMT
+8.5k Linux/Unix : fatal: the Postfix mail system is already running
+27.5k Golang : Convert integer to binary, octal, hexadecimal and back to integer
+4.7k Unix/Linux : How to pipe/save output of a command to file?