I have the problem with a prepared statement like this:
select ... from ... where xy = ? and foo = ? and bla = ?
can i set a string for every index? Otherwise i had to do
prep.setString(1, "bla");
prep.setString(2, "bla");
prep.setString(3, "bla");
or with for loop… but is there an elegant way? (beside adapt prepared statement or so?) may there is a method i dont know yet…
otherwise i create my own PreparedStatement class and extend it with this function
How often do you really need to set the same value to several indexes in a
PreparedStatement? I wouldn’t bother too much about looping once or twice for the few use-cases, where you actually have to do this…UPDATE: Of course you could also re-write your SQL to something like this 😉
Then you’d only have one bind variable and a functionally equivalent SQL statement. I don’t know about performance, though…