@@ -5,6 +5,7 @@ import com.github.jasync.sql.db.exceptions.InsufficientParametersException
5
5
import com.github.jasync.sql.db.mysql.MySQLQueryResult
6
6
import com.github.jasync.sql.db.mysql.exceptions.MySQLException
7
7
import com.github.jasync.sql.db.mysql.exceptions.MysqlErrors
8
+ import io.r2dbc.spi.Parameter
8
9
import io.r2dbc.spi.R2dbcBadGrammarException
9
10
import io.r2dbc.spi.R2dbcDataIntegrityViolationException
10
11
import io.r2dbc.spi.R2dbcPermissionDeniedException
@@ -55,7 +56,7 @@ internal class JasyncStatement(private val clientSupplier: Supplier<JasyncConnec
55
56
}
56
57
57
58
override fun bind (identifier : String , value : Any ): Statement {
58
- return bind(identifier.toInt(), value)
59
+ throw UnsupportedOperationException ( " named binding is not supported by jasync driver $identifier = $ value" )
59
60
}
60
61
61
62
override fun bind (index : Int , value : Any ): Statement {
@@ -87,13 +88,12 @@ internal class JasyncStatement(private val clientSupplier: Supplier<JasyncConnec
87
88
val allParams = bindings.all().asSequence().mapIndexed { i, binding ->
88
89
(0 until binding.size).map {
89
90
if (it in binding) {
90
- binding[it]
91
+ mapBindingValue( binding[it])
91
92
} else {
92
93
throw IllegalStateException (" binding failed with bind index $i and param index $it for query '$sql '" )
93
94
}
94
95
}
95
96
}.toFlux()
96
-
97
97
allParams.concatMap { connection.sendPreparedStatement(sql, it, releasePreparedStatementAfterUse).toMono() }
98
98
} else {
99
99
connection.sendQuery(sql).toMono()
@@ -112,6 +112,13 @@ internal class JasyncStatement(private val clientSupplier: Supplier<JasyncConnec
112
112
}
113
113
}
114
114
115
+ private fun mapBindingValue (bindValue : Any? ): Any? {
116
+ return when (bindValue) {
117
+ is Parameter -> bindValue.value
118
+ else -> bindValue
119
+
5317
}
120
+ }
121
+
115
122
private fun mapException (throwable : Throwable ) = when (throwable) {
116
123
is ConnectionTimeoutedException -> R2dbcTimeoutException (throwable)
117
124
is IllegalArgumentException -> throwable
0 commit comments