From 2957e3d413b9386a7f7a94f0ef1aab060e4b0c19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:31:57 +0000 Subject: [PATCH 1/4] Initial plan From d23ddfaa9db2081f225851e0ef4a4bfaff6c9059 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:38:32 +0000 Subject: [PATCH 2/4] Initial plan Co-authored-by: ShreckYe <27768951+ShreckYe@users.noreply.github.com> --- META-INF/main.kotlin_module | Bin 0 -> 42 bytes Test_queryKt.class | Bin 0 -> 994 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 META-INF/main.kotlin_module create mode 100644 Test_queryKt.class diff --git a/META-INF/main.kotlin_module b/META-INF/main.kotlin_module new file mode 100644 index 0000000000000000000000000000000000000000..dc6e37a17d84ec220036c5ac3d1c2d7ba53d3623 GIT binary patch literal 42 qcmZQzU|?ooU|@n`AjQDICBVfX#1oQQToPYcnp#xpU82OG#Q*?0uLX(# literal 0 HcmV?d00001 diff --git a/Test_queryKt.class b/Test_queryKt.class new file mode 100644 index 0000000000000000000000000000000000000000..f059cd3f2533c1027367b1614a9d1f7150f3e8b4 GIT binary patch literal 994 zcmah{TTc^F5dO}#bjw<#l$+oM1TU=$OA&7rQ6MoP)@w-<(+6_eJ!wwa?$+J21m5^d z`cRD~hG&12an2UyX5waZX3y+5^UZuSKYxAu0bmIm44Ewvs_l=F2=-qp6O19-;=9~- zx!1Jc)LWuK-ULIk&85eX$QP;%xiY4!9@(})LDjEKWN%5q3QwE7usU4 z+Nfqwz#R*D++`Tc*UrgbDiEYk57odtZ3GXR zA<_K<$S_pi@s%q*`;}1K;fj|SjP`DV*3Qre7}yTE_N2Zo(3exBT!#lK>+rxbvc_a8 zdw4KuEYLz4&LYzR1BzC4E?(979g-rs;X8r`Tb7=99kuHs*y44UJh`&p;BJ)%Qs0l9 zR>hBkhIk=0V&Z+|DcKfP8A^hzd7iJhlD-$BNZloMg=8mmyTrUow-Vj;GxZ(m4_|O0 zH_*jUZn%qyF0OPj{Ta8mySVp>APmpw)G~n*Tth0`Pj>Do(M*g0l3!u>(9g+}p}*wA w0u`XC*W&Xj*2xy>-y&tWUqfOOOY!>v56R-uCLZHS4J^bmN;McE`a-Py22tVa!T Date: Fri, 21 Nov 2025 19:46:40 +0000 Subject: [PATCH 3/4] Replace Query with AbstractQuery in API parameters and return types Co-authored-by: ShreckYe <27768951+ShreckYe@users.noreply.github.com> --- META-INF/main.kotlin_module | Bin 42 -> 0 bytes Test_queryKt.class | Bin 994 -> 0 bytes core/api/exposed-vertx-sql-client-core.api | 20 +++++++-------- .../exposedvertxsqlclient/DatabaseClient.kt | 23 +++++++++--------- ...osed-vertx-sql-client-crud-with-mapper.api | 6 ++--- .../crud/mapping/QueriesWithMapper.kt | 5 ++-- .../exposedvertxsqlclient/crud/Queries.kt | 6 ++--- 7 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 META-INF/main.kotlin_module delete mode 100644 Test_queryKt.class diff --git a/META-INF/main.kotlin_module b/META-INF/main.kotlin_module deleted file mode 100644 index dc6e37a17d84ec220036c5ac3d1c2d7ba53d3623..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 42 qcmZQzU|?ooU|@n`AjQDICBVfX#1oQQToPYcnp#xpU82OG#Q*?0uLX(# diff --git a/Test_queryKt.class b/Test_queryKt.class deleted file mode 100644 index f059cd3f2533c1027367b1614a9d1f7150f3e8b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 994 zcmah{TTc^F5dO}#bjw<#l$+oM1TU=$OA&7rQ6MoP)@w-<(+6_eJ!wwa?$+J21m5^d z`cRD~hG&12an2UyX5waZX3y+5^UZuSKYxAu0bmIm44Ewvs_l=F2=-qp6O19-;=9~- zx!1Jc)LWuK-ULIk&85eX$QP;%xiY4!9@(})LDjEKWN%5q3QwE7usU4 z+Nfqwz#R*D++`Tc*UrgbDiEYk57odtZ3GXR zA<_K<$S_pi@s%q*`;}1K;fj|SjP`DV*3Qre7}yTE_N2Zo(3exBT!#lK>+rxbvc_a8 zdw4KuEYLz4&LYzR1BzC4E?(979g-rs;X8r`Tb7=99kuHs*y44UJh`&p;BJ)%Qs0l9 zR>hBkhIk=0V&Z+|DcKfP8A^hzd7iJhlD-$BNZloMg=8mmyTrUow-Vj;GxZ(m4_|O0 zH_*jUZn%qyF0OPj{Ta8mySVp>APmpw)G~n*Tth0`Pj>Do(M*g0l3!u>(9g+}p}*wA w0u`XC*W&Xj*2xy>-y&tWUqfOOOY!>v56R-uCLZHS4J^bmN;McE`a-Py22tVa!T( @Deprecated("This function is called nowhere except `Row.toExposedResultRowWithTransaction`. Consider inlining and removing it.") @ExperimentalEvscApi - fun Query.getFieldExpressionSetWithTransaction() = + fun AbstractQuery<*>.getFieldExpressionSetWithTransaction() = set.getFieldExpressionSetWithTransaction() @Deprecated( @@ -251,7 +252,7 @@ class DatabaseClient( "This is also of potential poor performance if accidentally called to transform multiple rows." ) @ExperimentalEvscApi - private fun Row.toExposedResultRowWithTransaction(query: Query) = + private fun Row.toExposedResultRowWithTransaction(query: AbstractQuery<*>) = toExposedResultRow(query.getFieldExpressionSetWithTransaction()) @PublishedApi @@ -264,7 +265,7 @@ class DatabaseClient( block() @ExperimentalEvscApi - fun Query.getFieldExpressionSetWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction: Boolean) = + fun AbstractQuery<*>.getFieldExpressionSetWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction: Boolean) = runWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction) { getFieldExpressionSet() } /** @@ -277,7 +278,7 @@ class DatabaseClient( ) */ suspend inline fun executeQuery( - query: Query, + query: AbstractQuery<*>, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction, crossinline resultRowMapper: ResultRow.() -> Data ): RowSet = @@ -302,7 +303,7 @@ class DatabaseClient( ) */ suspend fun executeQuery( - query: Query, + query: AbstractQuery<*>, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction ): RowSet = executeQuery(query, getFieldExpressionSetWithExposedTransaction) { this } @@ -313,7 +314,7 @@ class DatabaseClient( */ @ExperimentalEvscApi suspend fun executeQueryForList( - query: Query, + query: AbstractQuery<*>, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction ): List { val rowSet = executeForVertxSqlClientRowSet(query) @@ -426,7 +427,7 @@ class DatabaseClient( @ExperimentalEvscApi suspend inline fun executeBatchQuery( fieldSet: FieldSet, - queries: Iterable, + queries: Iterable>, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction, crossinline resultRowMapper: ResultRow.() -> Data ): Sequence> { @@ -437,7 +438,7 @@ class DatabaseClient( } } - suspend fun executeBatchQuery(fieldSet: FieldSet, queries: Iterable): Sequence> = + suspend fun executeBatchQuery(fieldSet: FieldSet, queries: Iterable>): Sequence> = executeBatchQuery(fieldSet, queries) { this } /* @@ -491,7 +492,7 @@ fun FieldSet.getFieldExpressionSet() = /** * @see FieldSet.getFieldExpressionSet */ -fun Query.getFieldExpressionSet() = +fun AbstractQuery<*>.getFieldExpressionSet() = set.getFieldExpressionSet() /** @@ -499,11 +500,11 @@ fun Query.getFieldExpressionSet() = */ @Deprecated( - "It's a rare case that only one row is transformed and this function calls `Query.getFieldExpressionSet` when transforming every row. " + + "It's a rare case that only one row is transformed and this function calls `AbstractQuery.getFieldExpressionSet` when transforming every row. " + "Call `getFieldExpressionSet` directly with or without an Exposed `transaction` yourself to have finer-grained control and slightly improve performance.", ReplaceWith("toExposedResultRow(query.getFieldExpressionSet())") ) -fun Row.toExposedResultRow(query: Query) = +fun Row.toExposedResultRow(query: AbstractQuery<*>) = toExposedResultRow(query.getFieldExpressionSet()) class SingleUpdateException(rowCount: Int) : Exception("update row count: $rowCount") diff --git a/crud-with-mapper/api/exposed-vertx-sql-client-crud-with-mapper.api b/crud-with-mapper/api/exposed-vertx-sql-client-crud-with-mapper.api index 9da91be..3c7d0b6 100644 --- a/crud-with-mapper/api/exposed-vertx-sql-client-crud-with-mapper.api +++ b/crud-with-mapper/api/exposed-vertx-sql-client-crud-with-mapper.api @@ -2,9 +2,9 @@ public final class com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWi public static final fun batchInsertIgnoreWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Iterable;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun batchInsertWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Iterable;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun batchUpdateBuilderSetter (Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;)Lkotlin/jvm/functions/Function3; - public static final fun executeQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun executeQueryWithMapper$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun executeVertxSqlClientRowQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;Lcom/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun executeQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun executeQueryWithMapper$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun executeVertxSqlClientRowQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;Lcom/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun insertIgnoreWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Object;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun insertWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Object;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun selectWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/ColumnSet;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt b/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt index f743fcd..2b04171 100644 --- a/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt +++ b/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt @@ -12,6 +12,7 @@ import io.vertx.sqlclient.RowSet import org.jetbrains.exposed.v1.core.ColumnSet import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.v1.core.Table +import org.jetbrains.exposed.v1.core.AbstractQuery import org.jetbrains.exposed.v1.core.statements.UpdateBuilder import org.jetbrains.exposed.v1.jdbc.Query import org.jetbrains.exposed.v1.jdbc.select @@ -20,7 +21,7 @@ import org.jetbrains.exposed.v1.jdbc.select @ExperimentalEvscApi suspend fun DatabaseClient<*>.executeQueryWithMapper( - query: Query, + query: AbstractQuery<*>, dataQueryMapper: DataQueryMapper, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction ): RowSet = @@ -36,7 +37,7 @@ suspend fun DatabaseClient<*>.executeQueryWithMapper( */ @ExperimentalEvscApi suspend fun DatabaseClient<*>.executeVertxSqlClientRowQueryWithMapper( - query: Query, rowDataQueryMapper: RowDataQueryMapper + query: AbstractQuery<*>, rowDataQueryMapper: RowDataQueryMapper ): RowSet = executeWithMapping(query, rowDataQueryMapper::rowToData) diff --git a/crud/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/Queries.kt b/crud/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/Queries.kt index 122fb5b..516a00f 100644 --- a/crud/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/Queries.kt +++ b/crud/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/Queries.kt @@ -18,7 +18,7 @@ import kotlin.sequences.Sequence suspend inline fun DatabaseClient<*>.select( columnSet: ColumnSet, - buildQuery: ColumnSet.() -> Query, + buildQuery: ColumnSet.() -> AbstractQuery<*>, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction, crossinline resultRowMapper: ResultRow.() -> Data ): RowSet = @@ -26,7 +26,7 @@ suspend inline fun DatabaseClient<*>.select( suspend inline fun DatabaseClient<*>.select( columnSet: ColumnSet, - buildQuery: ColumnSet.() -> Query, + buildQuery: ColumnSet.() -> AbstractQuery<*>, getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction ): RowSet = @Suppress("MoveLambdaOutsideParentheses") @@ -143,7 +143,7 @@ suspend fun DatabaseClient<*>.update( */ @ExperimentalEvscApi suspend fun DatabaseClient<*>.selectBatch( - fieldSet: FieldSet, buildQuery: FieldSet.(E) -> Query, data: Iterable + fieldSet: FieldSet, buildQuery: FieldSet.(E) -> AbstractQuery<*>, data: Iterable ): Sequence> = executeBatchQuery(fieldSet, data.asSequence().map { fieldSet.buildQuery(it) }.asIterable()) From 52e3d3f008039154c7768eb07ad44f8e7b1a3550 Mon Sep 17 00:00:00 2001 From: Yongshun Ye Date: Sun, 23 Nov 2025 18:26:39 +0800 Subject: [PATCH 4/4] Check all the `Query` usages that are not replaced and reformat with IntelliJ IDEA Confirmed that all the remaining `Query` usages that are not replaced can not be replaced. --- .../exposedvertxsqlclient/DatabaseClient.kt | 10 ++++++---- .../crud/mapping/QueriesWithMapper.kt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt index 16dae91..5389c6b 100644 --- a/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt +++ b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt @@ -16,9 +16,7 @@ import org.jetbrains.exposed.v1.core.statements.InsertStatement import org.jetbrains.exposed.v1.core.statements.Statement import org.jetbrains.exposed.v1.core.statements.UpdateStatement import org.jetbrains.exposed.v1.jdbc.Database -import org.jetbrains.exposed.v1.jdbc.Query import org.jetbrains.exposed.v1.jdbc.SchemaUtils -import org.jetbrains.exposed.v1.core.AbstractQuery import org.jetbrains.exposed.v1.jdbc.transactions.transaction import org.jetbrains.exposed.v1.jdbc.transactions.transactionManager import org.slf4j.LoggerFactory @@ -265,7 +263,9 @@ class DatabaseClient( block() @ExperimentalEvscApi - fun AbstractQuery<*>.getFieldExpressionSetWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction: Boolean) = + fun AbstractQuery<*>.getFieldExpressionSetWithOptionalReadOnlyExposedTransaction( + getFieldExpressionSetWithExposedTransaction: Boolean + ) = runWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction) { getFieldExpressionSet() } /** @@ -438,7 +438,9 @@ class DatabaseClient( } } - suspend fun executeBatchQuery(fieldSet: FieldSet, queries: Iterable>): Sequence> = + suspend fun executeBatchQuery( + fieldSet: FieldSet, queries: Iterable> + ): Sequence> = executeBatchQuery(fieldSet, queries) { this } /* diff --git a/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt b/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt index 2b04171..04f4874 100644 --- a/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt +++ b/crud-with-mapper/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWithMapper.kt @@ -9,10 +9,10 @@ import com.huanshankeji.exposedvertxsqlclient.crud.* import com.huanshankeji.exposedvertxsqlclient.toExposedResultRow import com.huanshankeji.vertx.sqlclient.datamapping.RowDataQueryMapper import io.vertx.sqlclient.RowSet +import org.jetbrains.exposed.v1.core.AbstractQuery import org.jetbrains.exposed.v1.core.ColumnSet import org.jetbrains.exposed.v1.core.Op import org.jetbrains.exposed.v1.core.Table -import org.jetbrains.exposed.v1.core.AbstractQuery import org.jetbrains.exposed.v1.core.statements.UpdateBuilder import org.jetbrains.exposed.v1.jdbc.Query import org.jetbrains.exposed.v1.jdbc.select