Hi Lukas,
The use case is just proper handling of query parameters. It's a shame JDBC
does not support them natively like say ADO.NET.
Of course we can live without them, it's not a matter of not being able to
accomplish something.
I understand it's not easy to do and JOOQ is very useful already as is.
I just thought it might have been possible to do it in a limited manner:
the parameters are already ordered as necessary across all query parts and
it's a matter of maintaining a map by name internally to reference already
created parameters. Now only their values are held in query instance (in a
List). If you hold Parameter instances in the list instead and have
complementary map by name in addition and then in BindContext.bindValues
instead of
for (Object value : values) {
Class<?> type = (value == null) ? Object.class :
value.getClass();
bindValue(value, type);
}
you write
for (Parameter parameter : parameters) {
bindValue(parameter);
}
and Parameter<T> will of course provide
boolean isNull();
Class<T> getParameterType();
T getValue();
void setValue(T);
and Query will have
List<Parameter<?>> getParameters()
instead of, or in addition to
List<Object> getBindValues()
Anyways, as I said, JOOQ is useful already, that's just a suggestion for
improvement.
Thanks,
Vasily