fix sql call style
This commit is contained in:
@@ -74,7 +74,7 @@ func getPackageInfo(orm *mysqldb.MySqlDB, info *model.DBInfo) {
|
||||
tab.SQLBuildStr = CreateTable
|
||||
}
|
||||
}
|
||||
// rows.Close()
|
||||
rows.Close()
|
||||
// ----------end
|
||||
}
|
||||
|
||||
@@ -170,7 +170,6 @@ func getTables(orm *mysqldb.MySqlDB) map[string]string {
|
||||
fmt.Println(err)
|
||||
return tbDesc
|
||||
}
|
||||
// defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
var table string
|
||||
@@ -178,10 +177,10 @@ func getTables(orm *mysqldb.MySqlDB) map[string]string {
|
||||
tables = append(tables, table)
|
||||
tbDesc[table] = ""
|
||||
}
|
||||
rows.Close()
|
||||
|
||||
// Get table annotations.获取表注释
|
||||
rows1, err := orm.Raw("SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE table_schema= '" + config.GetMysqlDbInfo().Database + "'").Rows()
|
||||
// defer rows1.Close()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return tbDesc
|
||||
@@ -192,6 +191,7 @@ func getTables(orm *mysqldb.MySqlDB) map[string]string {
|
||||
rows1.Scan(&table, &desc)
|
||||
tbDesc[table] = desc
|
||||
}
|
||||
rows1.Close()
|
||||
|
||||
return tbDesc
|
||||
}
|
||||
|
||||
1
go.sum
1
go.sum
@@ -56,6 +56,7 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jander/golog v0.0.0-20150917071935-954a5be801fc/go.mod h1:uWhWXOR4dpfk9J8fegnMY7sP2GFXxe3PFI9Ps+TRXJs=
|
||||
github.com/jinzhu/gorm v1.9.11 h1:gaHGvE+UnWGlbWG4Y3FUwY1EcZ5n6S9WtqBA/uySMLE=
|
||||
|
||||
Reference in New Issue
Block a user