forked from go/golangs_learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
package main
|
|
|
|
import (
|
|
"database/sql"
|
|
"log"
|
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
)
|
|
|
|
var s = []string{
|
|
"DELETE FROM a01_config_init where DICID in ('a01a0530','a0165','a0123');",
|
|
"INSERT INTO a01_config_init (DICID, CODE, NAME, TDESC, ORDERID, ISVALI, FORMTYPE, ABOUTCODE, GRIDWIDTH, RENDERER, ALIGN) VALUES ('a0165', 'A0165', '管理类别', '管理类别', 210, 'true', 'SELECT', 'ZB130', 120, null, 'center');",
|
|
"INSERT INTO a01_config_init (DICID, CODE, NAME, TDESC, ORDERID, ISVALI, FORMTYPE, ABOUTCODE, GRIDWIDTH, RENDERER, ALIGN) VALUES ('a0123', 'A0123', '职位类别', '职位类别', 210, 'true', 'SELECT', 'XZ93', 120, null, 'center');",
|
|
"DELETE FROM a01_config;",
|
|
}
|
|
|
|
//go:generate goversioninfo -icon=rc.ico
|
|
func main() {
|
|
|
|
db, err := sql.Open("mysql", "root:admin@tcp(127.0.0.1:35017)/hy_qggwy?charset=utf8")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer db.Close()
|
|
|
|
for i := 0; i < len(s); i++ {
|
|
_, err := db.Exec(s[i])
|
|
checkErr(err, s[i])
|
|
}
|
|
|
|
}
|
|
|
|
func checkErr(err error, s string) {
|
|
if err != nil {
|
|
log.Fatal(s)
|
|
}
|
|
}
|
|
|