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
+20.3k Golang : Check if os.Stdin input data is piped or from terminal
+5.5k Golang : If else example and common mistake
+10.4k Golang : cannot assign type int to value (type uint8) in range error
+7.5k Golang : Rot13 and Rot5 algorithms example
+6k Golang : How to verify input is rune?
+9.1k Golang : How to capture return values from goroutines?
+19.2k Golang : Execute shell command
+6.1k Golang : Debug with Godebug
+3.4k Golang : Fix go-cron set time not working issue
+6.2k Golang : Process non-XML/JSON formatted ASCII text file example
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+27.9k Golang : Decode/unmarshal unknown JSON data type with map[string]interface