Skip to content

Commit

Permalink
Revert inProperCase visibility modifier change
Browse files Browse the repository at this point in the history
Add comment to private function.
  • Loading branch information
bog-walk committed Aug 30, 2023
1 parent 3c35e63 commit 4921604
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion exposed-core/api/exposed-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -3290,7 +3290,6 @@ public final class org/jetbrains/exposed/sql/vendors/DatabaseDialect$DefaultImpl

public final class org/jetbrains/exposed/sql/vendors/DefaultKt {
public static final fun getCurrentDialect ()Lorg/jetbrains/exposed/sql/vendors/DatabaseDialect;
public static final fun inProperCase (Ljava/lang/String;)Ljava/lang/String;
}

public abstract class org/jetbrains/exposed/sql/vendors/ForUpdateOption {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1328,5 +1328,5 @@ internal val currentDialectIfAvailable: DatabaseDialect?
null
}

fun String.inProperCase(): String =
internal fun String.inProperCase(): String =
TransactionManager.currentOrNull()?.db?.identifierManager?.inProperCase(this@inProperCase) ?: this
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ class JdbcDatabaseMetadataImpl(database: String, val metadata: DatabaseMetaData)
return result
}

/**
* For each table, returns metadata for each of its columns
*/
override fun columns(vararg tables: Table): Map<Table, List<ColumnMetadata>> {
val result = mutableMapOf<Table, List<ColumnMetadata>>()
val useSchemaInsteadOfDatabase = currentDialect is MysqlDialect
Expand Down Expand Up @@ -306,6 +303,15 @@ class JdbcDatabaseMetadataImpl(database: String, val metadata: DatabaseMetaData)
}
}

/**
* Returns the name of the database in which a [table] is found, as well as it's schema name.
*
* If the table name does not include a schema prefix, the metadata value `currentScheme` is used instead.
*
* MySQL/MariaDB are special cases in that a schema definition is treated like a separate database. This means that
* a connection to 'testDb' with a table defined as 'my_schema.my_table' will only successfully find the table's
* metadata if 'my_schema' is used as the database name.
*/
private fun tableCatalogAndSchema(table: Table): Pair<String, String> {
val tableSchema = identifierManager.inProperCase(table.schemaName ?: currentScheme)
return if (currentDialect is MysqlDialect && tableSchema != currentScheme) {
Expand Down

0 comments on commit 4921604

Please sign in to comment.