Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ When using JDBC, add the following to your `build.gradle.kts` file:

```kotlin
plugins {
kotlin("jvm") version "1.9.22" // Currently the plugin is only available for Kotlin-JVM
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
kotlin("jvm") version "2.1.20" // Currently the plugin is only available for Kotlin-JVM
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
}

dependencies {
api("io.exoquery:terpal-sql-jdbc:1.0.0.PL-1.0.0")
api("io.exoquery:terpal-sql-jdbc:2.0.0.PL-1.2.0")
api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.2")
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
// Your databse driver for example postgres:
Expand Down Expand Up @@ -116,13 +116,13 @@ For Android development, add the following to your `build.gradle.kts` file:

```kotlin
plugins {
kotlin("android") version "1.9.22"
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
kotlin("android") version "2.1.20"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
}

dependencies {
api("io.exoquery:terpal-sql-android:1.0.0.PL-1.0.0")
api("io.exoquery:terpal-sql-android:2.0.0.PL-1.2.0")
api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.2")
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
implementation("androidx.sqlite:sqlite-framework:2.4.0")
Expand All @@ -140,7 +140,7 @@ dependencies {
> To fix it do this:
> ```kotlin
> commonMain.dependencies {
> implementation("io.exoquery:terpal-sql-core:1.0.0.PL-1.0.0") {
> implementation("io.exoquery:terpal-sql-core:2.0.0.PL-1.2.0") {
> exclude("com.sschr15.annotations","jb-annotations-kmp")
> }
> }
Expand Down Expand Up @@ -211,9 +211,9 @@ val person: List<Person> = Sql("SELECT * FROM Person").queryOf<Person>().runOn(c
For iOS, OSX, Linux and Windows development, with Kotlin Multiplatform, add the following to your `build.gradle.kts` file:
```kotlin
plugins {
kotlin("multiplatform") version "1.9.22"
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
kotlin("multiplatform") version "2.1.20"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
}

kotlin {
Expand All @@ -223,8 +223,8 @@ kotlin {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
// Note that terpal-sql-native supports iOS, OSX, Linux and Windows
api("io.exoquery:terpal-runtime:1.9.22-1.0.0.PL")
implementation("io.exoquery:terpal-sql-native:1.0.0.PL-1.0.0")
api("io.exoquery:terpal-runtime:2.1.20-2.0.0.PL")
implementation("io.exoquery:terpal-sql-native:2.0.0.PL-1.2.0")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20")
implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.8.20")

Expand Down
2 changes: 1 addition & 1 deletion build-logic/src/main/kotlin/conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repositories {

group = "io.exoquery"
// Everything inherits the version from here
version = "1.0.0.PL-1.1.0"
version = "2.0.0.PL-1.2.0"

check("$version".isNotBlank() && version != "unspecified")
{ "invalid version $version" }
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
`maven-publish`
signing
kotlin("jvm") version "1.9.22" apply false
kotlin("jvm") version "2.1.20" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.1.0" apply false
kotlin("multiplatform") version "1.9.22" apply false
kotlin("multiplatform") version "2.1.20" apply false
id("com.android.library") version "8.2.0" apply false
id("org.jetbrains.dokka") version "1.9.10" apply false
}
Expand Down
7 changes: 3 additions & 4 deletions terpal-sql-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.ir.backend.js.compile
import org.jetbrains.kotlin.konan.target.HostManager

plugins {
id("conventions")
kotlin("multiplatform")
id("com.android.library")
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
// Already on the classpath
//id("org.jetbrains.kotlin.android") version "1.9.23"
}
Expand Down Expand Up @@ -75,7 +74,7 @@ kotlin {
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
//api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
api("io.exoquery:terpal-runtime:1.9.22-1.0.0.PL")
api("io.exoquery:terpal-runtime:2.1.20-2.0.0.PL")

//implementation("androidx.sqlite:sqlite:2.4.0")
//implementation("androidx.sqlite:sqlite-ktx:2.4.0")
Expand Down
8 changes: 4 additions & 4 deletions terpal-sql-core-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("multiplatform")
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
id("nativebuild")
}

kotlin {
// Add java targets so this can be resused for android etc... the `nativebuild` plugin will provide the others
// This needs to be compiled with at least JDK17 to support the android build.
jvmToolchain(17)
jvm {
jvmToolchain(17)
}

java {
Expand All @@ -34,7 +34,7 @@ kotlin {
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
//api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
api("io.exoquery:terpal-runtime:1.9.22-1.0.0.PL")
api("io.exoquery:terpal-runtime:2.1.20-2.0.0.PL")
implementation("org.jetbrains.kotlinx:atomicfu:0.23.1")
implementation("app.cash.sqldelight:runtime:2.0.2")

Expand Down
8 changes: 4 additions & 4 deletions terpal-sql-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("conventions")
kotlin("multiplatform")
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
id("nativebuild")
}

kotlin {
jvmToolchain(17)
jvm {
jvmToolchain(17)
}

java {
Expand All @@ -30,7 +30,7 @@ kotlin {
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
//api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
api("io.exoquery:terpal-runtime:1.9.22-1.0.0.PL")
api("io.exoquery:terpal-runtime:2.1.20-2.0.0.PL")
implementation("org.jetbrains.kotlinx:atomicfu:0.23.1")
implementation("com.sschr15.annotations:jb-annotations-kmp:24.1.0+apple")
}
Expand Down
2 changes: 1 addition & 1 deletion terpal-sql-core/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pluginManagement {
// eachPlugin {
// if (requested.id.namespace == "io.exoquery" && requested.id.name == "terpal-runtime") {
// println("---------------------- HERE ----------------------")
// useModule("io.exoquery:terpal-runtime:1.9.22-0.3.2")
// useModule("io.exoquery:terpal-runtime:2.1.20-0.3.2")
// }
// }
//}
Expand Down
9 changes: 7 additions & 2 deletions terpal-sql-core/src/commonMain/kotlin/io/exoquery/sql/Sql.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ fun Sql(@Language("SQL") query: String): Statement = Messages.throwPluginNotExec
need specify a serializer for the type or (if it is contextual) ensure that it has a encoder in the `additionalEncoders` of the context."""
)
object SqlBatch: SqlCommonBatchBase() {
override fun inlined(value: String?): Param<*> =
throw IllegalArgumentException("The `inline` function is not yet supported in terpal-sql.")

override fun wrap(value: String?): Param<String> = Param(value)
override fun wrap(value: Int?): Param<Int> = Param(value)
override fun wrap(value: Long?): Param<Long> = Param(value)
Expand All @@ -127,6 +130,9 @@ object SqlBatch: SqlCommonBatchBase() {

// The Jdbc Specific Sql implemenation which will use the Jdbc wrapping functions to auto-wrap things
abstract class SqlCommonBase(): SqlBase() {
override fun inlined(value: String?): SqlFragment =
throw IllegalArgumentException("The `inline` function is not yet supported in terpal-sql.")

override fun wrap(value: String?): SqlFragment = Param(value)
override fun wrap(value: Int?): SqlFragment = Param(value)
override fun wrap(value: Long?): SqlFragment = Param(value)
Expand All @@ -144,8 +150,7 @@ abstract class SqlCommonBase(): SqlBase() {
}

abstract class SqlCommonBatchBase(): SqlBatchBase() {
// TODO Should check this at compile-time
override fun <V> wrap(value: V, cls: KClass<*>): Param<*> =
fun <V> wrap(value: V, cls: KClass<*>): Param<*> =
when (cls) {
String::class -> Param(value as String)
Int::class -> Param(value as Int)
Expand Down
6 changes: 3 additions & 3 deletions terpal-sql-jdbc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
plugins {
id("conventions")
kotlin("multiplatform")
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
}

val thisVersion = version
Expand Down Expand Up @@ -57,8 +57,8 @@ tasks.withType<Test>().configureEach {
}

kotlin {
jvmToolchain(17)
jvm {
jvmToolchain(17)
}

java {
Expand Down
9 changes: 7 additions & 2 deletions terpal-sql-jdbc/src/main/kotlin/io/exoquery/sql/jdbc/Sql.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ fun Sql(@Language("SQL") query: String): Statement = io.exoquery.terpal.Messages
need specify a serializer for the type or (if it is contextual) ensure that it has a encoder in the `additionalEncoders` of the context."""
)
object SqlBatch: SqlJdbcBatchBase() {
override fun inlined(value: String?): Param<*> =
throw IllegalArgumentException("The `inline` function is not yet supported in terpal-sql.")

override fun wrap(value: String?): Param<String> = Param(value)
override fun wrap(value: Int?): Param<Int> = Param(value)
override fun wrap(value: Long?): Param<Long> = Param(value)
Expand Down Expand Up @@ -67,6 +70,9 @@ object SqlBatch: SqlJdbcBatchBase() {

// The Jdbc Specific Sql implemenation which will use the Jdbc wrapping functions to auto-wrap things
abstract class SqlJdbcBase(): SqlBase() {
override fun inlined(value: String?): SqlFragment =
throw IllegalArgumentException("The `inline` function is not yet supported in terpal-sql.")

override fun wrap(value: String?): SqlFragment = Param(value)
override fun wrap(value: Int?): SqlFragment = Param(value)
override fun wrap(value: Long?): SqlFragment = Param(value)
Expand Down Expand Up @@ -102,8 +108,7 @@ abstract class SqlJdbcBase(): SqlBase() {
}

abstract class SqlJdbcBatchBase(): SqlBatchBase() {
// TODO Should check this at compile-time
override fun <V> wrap(value: V, cls: KClass<*>): Param<*> =
fun <V> wrap(value: V, cls: KClass<*>): Param<*> =
when (cls) {
String::class -> Param(value as String)
Int::class -> Param(value as Int)
Expand Down
6 changes: 3 additions & 3 deletions terpal-sql-native/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import org.jetbrains.kotlin.konan.target.HostManager
plugins {
id("conventions")
kotlin("multiplatform")
id("io.exoquery.terpal-plugin") version "1.9.22-1.0.0.PL"
kotlin("plugin.serialization") version "1.9.22"
id("io.exoquery.terpal-plugin") version "2.1.20-2.0.0.PL"
kotlin("plugin.serialization") version "2.1.20"
id("nativebuild")
}

Expand Down Expand Up @@ -96,7 +96,7 @@ kotlin {
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
//api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
api("io.exoquery:terpal-runtime:1.9.22-1.0.0.PL")
api("io.exoquery:terpal-runtime:2.1.20-2.0.0.PL")
implementation("app.cash.sqldelight:native-driver:2.0.2")

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class PoolConcurrencySpec {
}

// Need to have underscores or odd errors happen in android. Not sure why.
// ERROR: /home/alexi/git/terpal-sql/terpal-sql-core-testing/build/libs/terpal-sql-core-testing-jvm-1.9.22-0.3.0.jar: D8: com.android.tools.r8.internal.vc: Space characters in SimpleName 'io/exoquery/sql/PoolConcurrencyOps$Pool should wait once all connections are exhausted$1$1' are not allowed prior to DEX version 040
// ERROR: /home/alexi/git/terpal-sql/terpal-sql-core-testing/build/libs/terpal-sql-core-testing-jvm-2.1.20-0.3.0.jar: D8: com.android.tools.r8.internal.vc: Space characters in SimpleName 'io/exoquery/sql/PoolConcurrencyOps$Pool should wait once all connections are exhausted$1$1' are not allowed prior to DEX version 040
@Test
fun `Pool_should_wait_once_all_connections_are_exhausted`() {
fun currTime() = run {
Expand Down
Loading