After some use in real life apps, I made a 180 degrees turn on positional 
parameters logic. The change affects SQLSelect/SQLTemplate and Expression. In 
cases where a given named parameter is mentioned more than once in a template, 
originally we'd treat each occurrence as an individual position. E.g.:

   ExpressionFactory.exp("a = $a or x = $x and y = $x").paramsArray("A", 5, 6);

This caused a few issues:

* Allowing to bind a given parameter to different values (see example above) 
was a dubious "feature" to begin with.
* In most cases you'd bind it to the same value though, resulting in ugly 
repeat bindings.
* Inconsistency with named bindings - you would have fewer params if you bind 
with a Map vs. binding with an array.
* Conditional logic in SQLTemplate would break, with no reasonable workaround. 

The last item tipped the scale and I changed to a different approach. From 
Javadocs:

"If a given parameter name is used more than once, only the first occurrence is 
treated as "position", subsequent occurrences are bound with the same value as 
the first one." So the example above would look like this:


   ExpressionFactory.exp("a = $a or x = $x and y = $x").paramsArray("A", 5);

So if you used "paramsArray" from nightly builds, you may revisit your code and 
remove repeating bindings if any.

Andrus

Reply via email to