Commons DbUtils
  1. Commons DbUtils
  2. DBUTILS-79

fillStatement doesn't complain when there are too few parameters

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Labels:
      None

      Description

      Unless I'm reading the code incorrectly, it appears that the fillStatement function does not complain if you provide too few parameters. For example, if you supply an SQL statement like: select * from blah where ? = ?; but only provide a single parameter "test", fillStatement returns without issue. However, only the first ? is actually set.

      Granted, this will almost always cause an exception to be thrown by the driver, but since there is already a check for too many parameters, why not check for too few as well?

      (FYI: I came across this bug, and a few others in my AsyncQueryRunner implementation, while re-writing the unit tests to use Mockito.)

        Activity

        Hide
        William R. Speirs added a comment -

        See DBUTILS-78, it has an updated version of the fillStatement function which properly checks to see that the number of parameters passed in matches the number of parameters required by the statement.

        Show
        William R. Speirs added a comment - See DBUTILS-78 , it has an updated version of the fillStatement function which properly checks to see that the number of parameters passed in matches the number of parameters required by the statement.
        Hide
        William R. Speirs added a comment -

        If the latest patch I submitted to DBUTILS-78 is applied, it takes care of this issue.

        Show
        William R. Speirs added a comment - If the latest patch I submitted to DBUTILS-78 is applied, it takes care of this issue.
        Hide
        Henri Yandell added a comment -

        Resolved in r1158109 per your patch in DBUTILS-78.

        Show
        Henri Yandell added a comment - Resolved in r1158109 per your patch in DBUTILS-78 .

          People

          • Assignee:
            Unassigned
            Reporter:
            William R. Speirs
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development