Fix problem with mysql table query.
This commit is contained in:
parent
1e0b90a99c
commit
aadcf63e52
1 changed files with 2 additions and 2 deletions
|
@ -80,12 +80,12 @@ func (m *MySQLDriver) TableNames(schema string, whitelist, blacklist []string) (
|
||||||
query := fmt.Sprintf(`select table_name from information_schema.tables where table_schema = ?`)
|
query := fmt.Sprintf(`select table_name from information_schema.tables where table_schema = ?`)
|
||||||
args := []interface{}{schema}
|
args := []interface{}{schema}
|
||||||
if len(whitelist) > 0 {
|
if len(whitelist) > 0 {
|
||||||
query += fmt.Sprintf("and table_name in (%s);", strings.Repeat(",?", len(whitelist))[1:])
|
query += fmt.Sprintf(" and table_name in (%s);", strings.Repeat(",?", len(whitelist))[1:])
|
||||||
for _, w := range whitelist {
|
for _, w := range whitelist {
|
||||||
args = append(args, w)
|
args = append(args, w)
|
||||||
}
|
}
|
||||||
} else if len(blacklist) > 0 {
|
} else if len(blacklist) > 0 {
|
||||||
query += fmt.Sprintf("and table_name not in (%s);", strings.Repeat(",?", len(blacklist))[1:])
|
query += fmt.Sprintf(" and table_name not in (%s);", strings.Repeat(",?", len(blacklist))[1:])
|
||||||
for _, b := range blacklist {
|
for _, b := range blacklist {
|
||||||
args = append(args, b)
|
args = append(args, b)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue