|
@ -17,7 +17,7 @@ var DB *sql.DB |
|
|
|
|
|
|
|
|
var SLAVER_DB *sql.DB |
|
|
var SLAVER_DB *sql.DB |
|
|
|
|
|
|
|
|
//db类型,默认空,如TencentDB(腾讯),
|
|
|
|
|
|
|
|
|
// db类型,默认空,如TencentDB(腾讯),
|
|
|
var DB_PROVIDER string |
|
|
var DB_PROVIDER string |
|
|
|
|
|
|
|
|
func Connect(DBHOST, DBUSER, DBPWD, DBNAME, DBPORT string, conns ...int) error { |
|
|
func Connect(DBHOST, DBUSER, DBPWD, DBNAME, DBPORT string, conns ...int) error { |
|
@ -123,7 +123,16 @@ func getTableName(dbName, table string, dbtype ...string) string { |
|
|
ret = table |
|
|
ret = table |
|
|
} |
|
|
} |
|
|
if dbName != "" { |
|
|
if dbName != "" { |
|
|
ret = helper.StringJoin(dbName, ".", table) |
|
|
|
|
|
|
|
|
if strings.Contains(table, ",") { |
|
|
|
|
|
arr := strings.Split(table, ",") |
|
|
|
|
|
arrStrs := make([]string, 0, len(arr)) |
|
|
|
|
|
for _, v := range arr { |
|
|
|
|
|
arrStrs = append(arrStrs, helper.StringJoin(dbName, ".", v)) |
|
|
|
|
|
} |
|
|
|
|
|
ret = strings.Join(arrStrs, ",") |
|
|
|
|
|
} else { |
|
|
|
|
|
ret = helper.StringJoin(dbName, ".", table) |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
ret = table |
|
|
ret = table |
|
|
} |
|
|
} |
|
|