-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a90d21e
commit b5be729
Showing
69 changed files
with
100 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
includeBuild("terpal-sql-core") | ||
includeBuild("terpal-sql-jdbc") | ||
|
||
rootProject.name = "terpal-sql" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
plugins { | ||
id("conventions") | ||
id("publish") | ||
id("io.exoquery.terpal-plugin") version "2.0.0-0.2.0" | ||
kotlin("jvm") version "2.0.0" | ||
kotlin("plugin.serialization") version "2.0.0" | ||
} | ||
|
||
val thisVersion = version | ||
|
||
dependencies { | ||
// Looks like it knows to do a project-dependency even if there is a version attached (i.e. I guess it ignores the version?) | ||
api("io.exoquery:terpal-sql-core:${thisVersion}") | ||
|
||
api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.2") | ||
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2") | ||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") | ||
// Optional by the user. This library provides certain utilities that enhance Hikari. | ||
implementation("com.zaxxer:HikariCP:5.0.1") | ||
implementation("com.typesafe:config:1.4.1") | ||
|
||
testImplementation("io.exoquery:pprint-kotlin:2.0.2") | ||
testImplementation("io.zonky.test:embedded-postgres:2.0.7") | ||
testImplementation("mysql:mysql-connector-java:8.0.29") | ||
testImplementation("com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre11") | ||
testImplementation("com.h2database:h2:2.2.224") | ||
testImplementation("org.xerial:sqlite-jdbc:3.42.0.1") | ||
testImplementation("com.oracle.ojdbc:ojdbc8:19.3.0.0") | ||
|
||
testImplementation(kotlin("test")) | ||
testImplementation("io.kotest:kotest-runner-junit5:5.9.1") | ||
testImplementation("io.kotest.extensions:kotest-extensions-testcontainers:2.0.2") | ||
|
||
testImplementation("org.testcontainers:mysql:1.19.8") | ||
testImplementation("org.testcontainers:postgresql:1.19.8") | ||
testImplementation("org.testcontainers:mssqlserver:1.19.8") | ||
testImplementation("org.testcontainers:oracle-xe:1.19.8") | ||
|
||
testApi(platform("io.zonky.test.postgres:embedded-postgres-binaries-bom:16.2.0")) | ||
testImplementation("org.flywaydb:flyway-core:7.15.0") // corresponding to embedded-postgres | ||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pluginManagement { | ||
includeBuild("../build-logic") | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
terpal-sql-jdbc/src/main/kotlin/io/exoquery/sql/jdbc/JdbcRowDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.exoquery.sql.jdbc | ||
|
||
import io.exoquery.sql.* | ||
import kotlinx.serialization.descriptors.SerialDescriptor | ||
import java.sql.Connection | ||
import java.sql.ResultSet | ||
import java.sql.ResultSetMetaData | ||
|
||
class JdbcRowDecoder( | ||
ctx: JdbcDecodingContext, | ||
initialRowIndex: Int, | ||
api: ApiDecoders<Connection, ResultSet>, | ||
decoders: Set<SqlDecoder<Connection, ResultSet, out Any>>, | ||
columnInfos: List<ColumnInfo>, | ||
type: RowDecoderType, | ||
endCallback: (Int) -> Unit | ||
): RowDecoder<Connection, ResultSet>(ctx, initialRowIndex, api, decoders, columnInfos, type, endCallback) { | ||
|
||
companion object { | ||
operator fun invoke( | ||
ctx: JdbcDecodingContext, | ||
api: ApiDecoders<Connection, ResultSet>, | ||
decoders: Set<SqlDecoder<Connection, ResultSet, out Any>>, | ||
descriptor: SerialDescriptor | ||
): JdbcRowDecoder { | ||
fun metaColumnData(meta: ResultSetMetaData) = | ||
(1..meta.columnCount).map { ColumnInfo(meta.getColumnName(it), meta.getColumnTypeName(it)) } | ||
val metaColumns = metaColumnData(ctx.row.metaData) | ||
descriptor.verifyColumns(metaColumns) | ||
return JdbcRowDecoder(ctx, 1, api, decoders, metaColumns, RowDecoderType.Regular, {}) | ||
} | ||
} | ||
|
||
override fun cloneSelf(ctx: JdbcDecodingContext, initialRowIndex: Int, type: RowDecoderType, endCallback: (Int) -> Unit): RowDecoder<Connection, ResultSet> = | ||
JdbcRowDecoder(ctx, initialRowIndex, api, decoders, columnInfos, type, endCallback) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.