Hello Vasily,

These features have been implemented on SVN trunk, Github and the
latest 2.0.1-SNAPSHOT version:
https://sourceforge.net/apps/trac/jooq/ticket/914
https://sourceforge.net/apps/trac/jooq/ticket/980

As I stated before, the implementation details were a bit tricky, as
jOOQ does not keep a serialised list of bind values in its QueryParts.
With a couple of refactorings in BindContext and RenderContext, I
could extract the suggested Param<T> wrappers for bind variables,
though. These Param<T> wrappers will

#980: Allow for naming parameters where this makes sense (e.g. Spring
supports named parameters)
#914: Allow for extracting parameters from already constructed queries
in order to modify their values

The Param<T> API can be seen here:
https://github.com/lukaseder/jOOQ/blob/master/jOOQ/src/main/java/org/jooq/Param.java

It is constructed using various overloaded Factory.param() methods:
https://github.com/lukaseder/jOOQ/blob/a91dc9a9dfe3ac6ee15d3509577805854cccaa2f/jOOQ/src/main/java/org/jooq/impl/Factory.java#L3602

Both Factory.param() and Factory.val() bind values are accessible
through the Query.getParam(String) and Query.getParams() methods. If
Factory.val() is used, then the param name will be the bind index:
https://github.com/lukaseder/jOOQ/blob/a91dc9a9dfe3ac6ee15d3509577805854cccaa2f/jOOQ/src/main/java/org/jooq/Query.java#L105

The complete commit can be seen here:
https://github.com/lukaseder/jOOQ/commit/a91dc9a9dfe3ac6ee15d3509577805854cccaa2f

Integration tests show that it is thus possible to reuse an existing
Query or parts thereof with new bind values for bind variables.
Any feedback on that solution is welcome!

Cheers
Lukas

Reply via email to