Skip to content

Commit 63ecf8a

Browse files
committed
Revert "Introduce Mode enum for H2 compatibility modes with deprecation of old constants"
This reverts commit d4aab31.
1 parent 0037070 commit 63ecf8a

File tree

2 files changed

+7
-53
lines changed
  • dataframe-jdbc/src
    • main/kotlin/org/jetbrains/kotlinx/dataframe/io/db
    • test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2

2 files changed

+7
-53
lines changed

dataframe-jdbc/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/db/H2.kt

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public open class H2(public val dialect: DbType = MySql) : DbType("h2") {
1818
require(dialect::class != H2::class) { "H2 database could not be specified with H2 dialect!" }
1919
}
2020

21-
2221
/**
2322
* It contains constants related to different database modes.
2423
*
@@ -30,36 +29,16 @@ public open class H2(public val dialect: DbType = MySql) : DbType("h2") {
3029
* @see [createH2Instance]
3130
*/
3231
public companion object {
33-
/**
34-
* Represents the compatibility modes supported by an H2 database.
35-
*
36-
* @property value The string value used in H2 JDBC URL and settings.
37-
*/
38-
public enum class Mode(public val value: String) {
39-
MySql("MySQL"),
40-
PostgreSql("PostgreSQL"),
41-
MsSqlServer("MSSQLServer"),
42-
MariaDb("MariaDB");
43-
44-
public companion object {
45-
/**
46-
* Finds a Mode by its string value (case-insensitive).
47-
*
48-
* @param value The string value to search for.
49-
* @return The matching Mode, or null if not found.
50-
*/
51-
public fun fromValue(value: String): Mode? =
52-
entries.find { it.value.equals(value, ignoreCase = true) }
53-
}
54-
}
55-
56-
@Deprecated("Use Mode.MySql.value instead", ReplaceWith("Mode.MySql.value"))
32+
/** It represents the mode value "MySQL" for the H2 database. */
5733
public const val MODE_MYSQL: String = "MySQL"
58-
@Deprecated("Use Mode.PostgreSql.value instead", ReplaceWith("Mode.PostgreSql.value"))
34+
35+
/** It represents the mode value "PostgreSQL" for the H2 database. */
5936
public const val MODE_POSTGRESQL: String = "PostgreSQL"
60-
@Deprecated("Use Mode.MsSqlServer.value instead", ReplaceWith("Mode.MsSqlServer.value"))
37+
38+
/** It represents the mode value "MSSQLServer" for the H2 database. */
6139
public const val MODE_MSSQLSERVER: String = "MSSQLServer"
62-
@Deprecated("Use Mode.MariaDb.value instead", ReplaceWith("Mode.MariaDb.value"))
40+
41+
/** It represents the mode value "MariaDB" for the H2 database. */
6342
public const val MODE_MARIADB: String = "MariaDB"
6443
}
6544

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2/h2Test.kt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -974,31 +974,6 @@ class JdbcTest {
974974
exception.message shouldBe "H2 database could not be specified with H2 dialect!"
975975
}
976976

977-
978-
@Test
979-
fun `regular mode for H2 with DbConnectionConfig`() {
980-
val url = "jdbc:h2:mem:testDatabase"
981-
val username = "sa"
982-
val password = ""
983-
984-
val dbConfig = DbConnectionConfig(url, username, password)
985-
986-
val df = DataFrame.readSqlQuery(dbConfig, "SELECT 1")
987-
df.rowsCount() shouldBe 1
988-
}
989-
990-
@Test
991-
fun `regular mode for H2 with Connection`() {
992-
val url = "jdbc:h2:mem:testDatabase"
993-
val username = "sa"
994-
val password = ""
995-
996-
DriverManager.getConnection(url, username, password).use { connection ->
997-
val df = DataFrame.readSqlQuery(connection, "SELECT 1")
998-
df.rowsCount() shouldBe 1
999-
}
1000-
}
1001-
1002977
// helper object created for API testing purposes
1003978
object CustomDB : H2(MySql)
1004979

0 commit comments

Comments
 (0)