Support for IN sql clause with PreparedStatement using setArray
jbaris opened this issue · 4 comments
jbaris commented
Using raw JDBC, you can do this:
PreparedStatement statement = connection.prepareStatement("Select * from test where field in (?)");
Array array = statement.getConnection().createArrayOf("VARCHAR", new Object[]{"A1", "B2","C3"});
statement.setArray(1, array);
ResultSet rs = statement.executeQuery();
Using vertx-jdbc-client I want to do the same:
List<Long> ids = ...
connection.preparedQuery("SELECT * FROM test WHERE field IN (?)")
.execute(Tuple.wrap(ids))
.onSuccess(rowSet -> {
....
}).onFailure(...);
I see the method JDBCPreparedQuery#fillStatement has only references to ps.setObject
So, AFAIK this feature is not supported yet.
vietj commented
What is the database used in the example ?
jbaris commented
What is the database used in the example ?
Oracle. But, I think, should be the same for any JDBC compatible database that supports IN clause (like MySQL).
Thanks for reply!
pmlopes commented
This is supported, yet there's almost no documentation on how to use it. I'll create documentation + example code to show it's usage.