Hi Lukas,

The extra roundtrip for preparation may not actually eventuate; JDBC driver 
may and should cache prepared statements in associated connection.
I checked it with jtds and there was no repeated preparation, so that's not 
an issue really.
Prepared statement is probably only valid in the context of the connection 
where it was created anyways.

As to the way to bind/provide new parameter values - it would be ideal to 
have explicit OO way to handle that, maybe using a class to represent all 
parameters.
Why not have all parameters in a map by name while maintaining their 
position as before

in some sort of Query class
<T> Parameter<T> parameter(String name, T value); // create or set value
<T> Parameter<T> getParameter(String name); // get existing

and then in Parameter<T>
T getValue();
void setValue(T newValue);
int getIndex();

Then user will set new value with 
query.getParameter("name").setValue(newValue);

It's not a thoroughly thought over solution, of course.

Regards,
Vasily

Reply via email to