https://kotlinlang.org logo
#jasync-sql
Title
# jasync-sql
d

dave08

12/10/2020, 12:21 PM
In MysqlConnection, this is how you check the amount of params
Copy code
val totalParameters = params.query.count { it == '?' }
I guess it's the same in postgres, where really it should be a regex to make sure that the
?
is not surrounded by quotes.
o

oshai

12/10/2020, 12:25 PM
yes, it's pretty simplistic. we dont really parse the request
can you open an issue for that?
d

dave08

12/10/2020, 12:25 PM
Sure
I guess there isn't really any workarounds for this 🙈?
At least until it gets fixed...
o

oshai

12/10/2020, 6:17 PM
the workaround is to use query instead of prepared statement
the fix will probably be a simpler check. I don't want to compile the expression
d

dave08

12/10/2020, 6:30 PM
I don't know how much you'll save from a simpler check... compiling the expression is only once per connection creation.
You might want to benchmark the difference between the "simpler" algorithm (using a biggish/complex sql statement) and the regex version
o

oshai

12/10/2020, 10:06 PM
do you know how to compile it?
can you try double question marks? https://github.com/jasync-sql/jasync-sql/issues/196
d

dave08

12/13/2020, 9:37 AM
It does't really make sense that ?? should help, but we can try...
params.query.count { it == '?' }
should report two extra ? instead of one...
It does work though 🤔...
Oh... the implementation of Mysql's
PreparedStatementHolder
is different.
3 Views