Skip to content

Commit 2b0ffc4

Browse files
committed
fix: make sure to use the database name when getting table columns
database variable was not used
1 parent e6ff2b3 commit 2b0ffc4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: drivers/mysql.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (db *MySQL) GetTables(database string) (map[string][]string, error) {
8484
func (db *MySQL) GetTableColumns(database, table string) (results [][]string, err error) {
8585
table = db.formatTableName(table)
8686

87-
rows, err := db.Connection.Query("DESCRIBE " + table)
87+
rows, err := db.Connection.Query(fmt.Sprintf("DESCRIBE %s.%s", database, table))
8888
if err != nil {
8989
return nil, err
9090
}

Diff for: drivers/sqlite.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (db *SQLite) GetTables(database string) (map[string][]string, error) {
8484
}
8585

8686
func (db *SQLite) GetTableColumns(database, table string) (results [][]string, err error) {
87-
rows, err := db.Connection.Query("PRAGMA table_info(" + table + ")")
87+
rows, err := db.Connection.Query(fmt.Sprintf("PRAGMA %s.table_info(%s)", database, table))
8888
if err != nil {
8989
return nil, err
9090
}

0 commit comments

Comments
 (0)