File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
main/kotlin/org/jetbrains/kotlinx/dataframe/io/db
test/kotlin/org/jetbrains/kotlinx/dataframe/io Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ public object MsSql : DbType("sqlserver") {
50
50
override fun convertSqlTypeToKType (tableColumnMetadata : TableColumnMetadata ): KType ? = null
51
51
52
52
public override fun sqlQueryLimit (sqlQuery : String , limit : Int ): String {
53
- sqlQuery.replace(" SELECT" , " SELECT TOP $limit " , ignoreCase = true )
54
- return sqlQuery
53
+ return sqlQuery.replace(" SELECT" , " SELECT TOP $limit " , ignoreCase = true )
55
54
}
56
55
}
Original file line number Diff line number Diff line change
1
+ package org.jetbrains.kotlinx.dataframe.io
2
+
3
+ import io.kotest.matchers.shouldBe
4
+ import org.intellij.lang.annotations.Language
5
+ import org.jetbrains.kotlinx.dataframe.DataFrame
6
+ import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
7
+ import org.jetbrains.kotlinx.dataframe.api.cast
8
+ import org.jetbrains.kotlinx.dataframe.api.filter
9
+ import org.jetbrains.kotlinx.dataframe.io.db.MsSql
10
+ import org.junit.AfterClass
11
+ import org.junit.BeforeClass
12
+ import org.junit.Test
13
+ import java.sql.Connection
14
+ import java.sql.DriverManager
15
+ import java.sql.SQLException
16
+ import kotlin.reflect.typeOf
17
+
18
+ class MsSqlTest {
19
+ companion object {
20
+ @BeforeClass
21
+ @JvmStatic
22
+ fun setUpClass () {
23
+ }
24
+
25
+ @AfterClass
26
+ @JvmStatic
27
+ fun tearDownClass () {
28
+ }
29
+ }
30
+
31
+ @Test
32
+ fun `test SQL Server TOP limit functionality` () {
33
+ MsSql .sqlQueryLimit(" SELECT * FROM TestTable1" , 1 ) shouldBe " SELECT TOP 1 * FROM TestTable1"
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments