You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "William R. Speirs (JIRA)" <ji...@apache.org> on 2011/07/29 15:58:09 UTC

[jira] [Created] (DBUTILS-79) fillStatement doesn't complain when there are too few parameters

fillStatement doesn't complain when there are too few parameters
----------------------------------------------------------------

                 Key: DBUTILS-79
                 URL: https://issues.apache.org/jira/browse/DBUTILS-79
             Project: Commons DbUtils
          Issue Type: Bug
    Affects Versions: 1.3
            Reporter: William R. Speirs
             Fix For: 1.4


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.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-79) fillStatement doesn't complain when there are too few parameters

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13073198#comment-13073198 ] 

William R. Speirs commented on DBUTILS-79:
------------------------------------------

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.

> fillStatement doesn't complain when there are too few parameters
> ----------------------------------------------------------------
>
>                 Key: DBUTILS-79
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-79
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: William R. Speirs
>             Fix For: 1.4
>
>
> 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.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (DBUTILS-79) fillStatement doesn't complain when there are too few parameters

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed DBUTILS-79.
--------------------------------

    Resolution: Fixed

Resolved in r1158109 per your patch in DBUTILS-78.

> fillStatement doesn't complain when there are too few parameters
> ----------------------------------------------------------------
>
>                 Key: DBUTILS-79
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-79
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: William R. Speirs
>             Fix For: 1.4
>
>
> 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.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-79) fillStatement doesn't complain when there are too few parameters

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084181#comment-13084181 ] 

William R. Speirs commented on DBUTILS-79:
------------------------------------------

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

> fillStatement doesn't complain when there are too few parameters
> ----------------------------------------------------------------
>
>                 Key: DBUTILS-79
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-79
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: William R. Speirs
>             Fix For: 1.4
>
>
> 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.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira