File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
r2dbc-mysql/src/main/java Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ internal class JasyncStatement(private val clientSupplier: Supplier<JasyncConnec
26
26
27
27
private var isPrepared = false
28
28
private var selectLastInsertId: Boolean = false
29
+ private var releasePreparedStatementAfterUse: Boolean = false
29
30
30
31
private var generatedKeyName: String = " LAST_INSERT_ID"
31
32
@@ -71,6 +72,13 @@ internal class JasyncStatement(private val clientSupplier: Supplier<JasyncConnec
71
72
return this
72
73
}
73
74
75
+ fun releasePreparedStatementAfterUse (): Statement {
76
+ check(isPrepared) { " releasePreparedStatementAfterUse can only be called for prepared statements" }
77
+
78
+ releasePreparedStatementAfterUse = true
79
+ return this
80
+ }
81
+
74
82
override fun execute (): Publisher <out Result > {
75
83
return Mono .fromSupplier(clientSupplier).flatMapMany { connection ->
76
84
if (isPrepared) {
@@ -84,7 +92,7 @@ internal class JasyncStatement(private val clientSupplier: Supplier<JasyncConnec
84
92
}
85
93
}.toFlux()
86
94
87
- allParams.concatMap { connection.sendPreparedStatement(sql, it).toMono() }
95
+ allParams.concatMap { connection.sendPreparedStatement(sql, it, releasePreparedStatementAfterUse ).toMono() }
88
96
} else {
89
97
connection.sendQuery(sql).toMono()
90
98
}
You can’t perform that action at this time.
0 commit comments