Robert Huffman created DBUTILS-129:
--------------------------------------
Summary: Add methods to QueryRunner that take Collections or
Iterables
Key: DBUTILS-129
URL: https://issues.apache.org/jira/browse/DBUTILS-129
Project: Commons DbUtils
Issue Type: Improvement
Reporter: Robert Huffman
If a prepared statement is built dynamically, with a variable number of
parameters, and parameters are in a Collection of some sort instead of an
array, usage QueryRunner requires that the collection be converted to an array
first. This means the parameters are iterated twice: once to convert to an
array and once again in QueryRunner.fillStatement.
It should be straightforward to add insert, execute, and update methods that
take Collections. The methods that take arrays can then be re-implemented using
the inexpensive Arrays.asList and invoking the new methods.
It would probably be preferable to take Iterables instead of Collections.
However, the current implementation of AbstractQueryRunner.fillStatement
requires up-front knowledge of the size of the parameter set passed to it, and
that is not easily obtained from the Iterable interface. To allow iterables
that method would have to be refactored.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)