This commit is contained in:
shoopea 2019-05-10 18:19:38 +08:00
parent e264120b04
commit 9748e83b93

4
sql.go
View File

@ -21,14 +21,14 @@ func initDB() {
failOnError(err, "initDB : set foreign_key_checks = 0") failOnError(err, "initDB : set foreign_key_checks = 0")
var name string var name string
rows, err := tx.Query("show tables") rows, err := db.Query("show tables")
failOnError(err, "initDB : show tables") failOnError(err, "initDB : show tables")
for rows.Next() { for rows.Next() {
err = rows.Scan(&name) err = rows.Scan(&name)
failOnError(err, "initDB : show tables listing") failOnError(err, "initDB : show tables listing")
_, err = db.Exec("drop table " + name) _, err = tx.Exec("drop table " + name)
failOnError(err, "initDB : drop table "+name) failOnError(err, "initDB : drop table "+name)
} }
err = rows.Err() err = rows.Err()