You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For SQL IN clauses I generally try to keep the query constant and pass an array to database. For example, using PostgreSQL the following would work:
List<Integer> ids = ...
SqlArrayidArray = SqlArray.of("int", ids); // "int" here is database specific type nameList<Foo> foos = db.findAll(Foo.class, "select bar, baz from foo where id = any(?)", array);
Unfortunately not all databases support passing arrays easily, so you need to create the query manually in that case. QueryBuilder.appendPlaceholders is helpful in those cases:
SqlQueryq = newQueryBuilder("select bar baz from foo where id in ")
.appendPlaceholders(ids)
.build();
With QueryBuilder, you lose static the static analysis provided by IDEA though. ☹️
There's no support for calling stored procedures. I've had very little need for that myself, so I've never gotten around to implementing that. Of course you can execute a transaction callback and then do whatever you wish against the connection, but that's as far as Dalesbred supports you. But anyway that's a good idea for future development.
I added #35 for tracking stored procedure support, but I have no immediately plans on starting working on it. Design ideas, prototypes or pull requests would be appreciated.
Hi
is there any special support for SQL IN clause
and also for calling stored procedures and getting out param ?
Thanks
The text was updated successfully, but these errors were encountered: