Skip to content

Commit

Permalink
Rebase from main
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeySoshin authored and bog-walk committed Aug 30, 2023
1 parent 5ae746a commit 8859614
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,6 @@ class JdbcDatabaseMetadataImpl(database: String, val metadata: DatabaseMetaData)
override fun columns(vararg tables: Table): Map<Table, List<ColumnMetadata>> {
val databases = mutableListOf(databaseName)

// For MySQL, table names that contain schema are considered to be in their own DB
// For example, if you connect to testdb, but your table is my_schema.test_table,
// the metadata you need to query is for my_schema, not testdb
if (currentDialect is MysqlDialect) {
databases.addAll(extractSchemas(tables))
}

val result = mutableMapOf<Table, List<ColumnMetadata>>()
for (database in databases) {
val columnsMetadata = metadata.getColumns(database, null, "%", "%")
Expand Down Expand Up @@ -320,15 +313,6 @@ class JdbcDatabaseMetadataImpl(database: String, val metadata: DatabaseMetaData)
}
}

/**
* Returns the set of schemas the tables are defined in
*/
internal fun extractSchemas(tables: Array<out Table>): Set<String> {
return tables.map { table ->
table.schema
}.toSet()
}

private fun <T> ResultSet.iterate(body: ResultSet.() -> T): List<T> {
val result = arrayListOf<T>()
while (next()) {
Expand Down

0 comments on commit 8859614

Please sign in to comment.