[jira] Created: (DBUTILS-58) QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (DBUTILS-58) QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData

JIRA jira@apache.org
QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData
-------------------------------------------------------------------------------------

                 Key: DBUTILS-58
                 URL: https://issues.apache.org/jira/browse/DBUTILS-58
             Project: Commons DbUtils
          Issue Type: Improvement
    Affects Versions: 1.2
         Environment: MSSQL Server legacy jdbc driver
            Reporter: Julien Aymé
         Attachments: QueryRunner.diff, stacktrace.txt

Some legacy JDBC driver does not support the PreparedStatement#getPreparedStatementMetaData() method (see stacktrace in joined file).
I would like to add an new boolean field (named disablePmd, set via constructors) to QueryRunner, which would completly remove the use of this method in QueryRunner#fillStatement.

{code}
        ParameterMetaData pmd = null;
        if (!disablePmd) {
            pmd = stmt.getParameterMetaData();
            if (pmd.getParameterCount() < params.length) {
                throw new SQLException("Too many parameters: expected "
                        + pmd.getParameterCount() + ", was given " + params.length);
            }
        }
{code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (DBUTILS-58) QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/DBUTILS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julien Aymé updated DBUTILS-58:
-------------------------------

    Attachment: QueryRunner.diff
                stacktrace.txt

The stacktrace, and the proposed patch

> QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData
> -------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-58
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-58
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.2
>         Environment: MSSQL Server legacy jdbc driver
>            Reporter: Julien Aymé
>         Attachments: QueryRunner.diff, stacktrace.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Some legacy JDBC driver does not support the PreparedStatement#getPreparedStatementMetaData() method (see stacktrace in joined file).
> I would like to add an new boolean field (named disablePmd, set via constructors) to QueryRunner, which would completly remove the use of this method in QueryRunner#fillStatement.
> {code}
>         ParameterMetaData pmd = null;
>         if (!disablePmd) {
>             pmd = stmt.getParameterMetaData();
>             if (pmd.getParameterCount() < params.length) {
>                 throw new SQLException("Too many parameters: expected "
>                         + pmd.getParameterCount() + ", was given " + params.length);
>             }
>         }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (DBUTILS-58) QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DBUTILS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745906#action_12745906 ]

Julien Aymé commented on DBUTILS-58:
------------------------------------

The exception was thrown using msbase.jar, unknown version.
I was able to retrieve these information from com.microsoft.jdbc.base.BaseDriver.class using jad:
{code}
    public final int getMajorVersion() {
        return 2;
    }

    public final int getMinorVersion() {
        return 2;
    }
{code}

> QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData
> -------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-58
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-58
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.2
>         Environment: MSSQL Server legacy jdbc driver
>            Reporter: Julien Aymé
>         Attachments: QueryRunner.diff, stacktrace.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Some legacy JDBC driver does not support the PreparedStatement#getPreparedStatementMetaData() method (see stacktrace in joined file).
> I would like to add an new boolean field (named disablePmd, set via constructors) to QueryRunner, which would completly remove the use of this method in QueryRunner#fillStatement.
> {code}
>         ParameterMetaData pmd = null;
>         if (!disablePmd) {
>             pmd = stmt.getParameterMetaData();
>             if (pmd.getParameterCount() < params.length) {
>                 throw new SQLException("Too many parameters: expected "
>                         + pmd.getParameterCount() + ", was given " + params.length);
>             }
>         }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (DBUTILS-58) QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/DBUTILS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Fabulich updated DBUTILS-58:
--------------------------------

    Fix Version/s: 1.3

> QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData
> -------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-58
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-58
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.2
>         Environment: MSSQL Server legacy jdbc driver
>            Reporter: Julien Aymé
>             Fix For: 1.3
>
>         Attachments: QueryRunner.diff, stacktrace.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Some legacy JDBC driver does not support the PreparedStatement#getPreparedStatementMetaData() method (see stacktrace in joined file).
> I would like to add an new boolean field (named disablePmd, set via constructors) to QueryRunner, which would completly remove the use of this method in QueryRunner#fillStatement.
> {code}
>         ParameterMetaData pmd = null;
>         if (!disablePmd) {
>             pmd = stmt.getParameterMetaData();
>             if (pmd.getParameterCount() < params.length) {
>                 throw new SQLException("Too many parameters: expected "
>                         + pmd.getParameterCount() + ", was given " + params.length);
>             }
>         }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (DBUTILS-58) QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/DBUTILS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Fabulich closed DBUTILS-58.
-------------------------------

    Resolution: Fixed

Fixed in revision 832257.  I didn't use Julien's patch, but just opted to reuse pmdKnownBroken.  If PMD is known to be broken, then we don't use it for parameter counting either.

> QueryRunner: Allow to completly disable use of PreparedStatement#getParameterMetaData
> -------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-58
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-58
>             Project: Commons DbUtils
>          Issue Type: Improvement
>    Affects Versions: 1.2
>         Environment: MSSQL Server legacy jdbc driver
>            Reporter: Julien Aymé
>             Fix For: 1.3
>
>         Attachments: QueryRunner.diff, stacktrace.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Some legacy JDBC driver does not support the PreparedStatement#getPreparedStatementMetaData() method (see stacktrace in joined file).
> I would like to add an new boolean field (named disablePmd, set via constructors) to QueryRunner, which would completly remove the use of this method in QueryRunner#fillStatement.
> {code}
>         ParameterMetaData pmd = null;
>         if (!disablePmd) {
>             pmd = stmt.getParameterMetaData();
>             if (pmd.getParameterCount() < params.length) {
>                 throw new SQLException("Too many parameters: expected "
>                         + pmd.getParameterCount() + ", was given " + params.length);
>             }
>         }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.