commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Fabulich (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DBUTILS-44) QueryRunner#fillStatement setNull all database fix proposal
Date Sat, 07 Mar 2009 06:02:56 GMT

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

Dan Fabulich updated DBUTILS-44:
--------------------------------

    Fix Version/s:     (was: 1.2)

Removing "Fix Version: 1.2" since this is really a dupe; it clutters the release notes.

> QueryRunner#fillStatement setNull all database fix proposal
> -----------------------------------------------------------
>
>                 Key: DBUTILS-44
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-44
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Julien Aymé
>         Attachments: QueryRunnerSQLParam.java, SQLParam.java, SQLParamBuilder.java, SQLParamImpl.java
>
>
> There is currently many open issues ( DBUTILS-14, DBUTILS-31, DBUTILS-39 and DBUTILS-41)
concerning the problem with setNull(i+1, Types.VARCHAR) in the QueryRunner#fillStatement method
when the given object is null.
> I use Commons DbUtils in several projects, and I have found a workaround which works
for any database:
> The problem is that when the object is null, the API does not know to which SQL TYPE
it should map the object to.
> I've added an Interface, named SQLParam, which exactely resolve this problem:
> {code}
> public interface SQLParam {
>     /**
>      * Returns the object
>      * 
>      * @return the object
>      */
>     public Object getObject();
>     /**
>      * Returns the SQL type of the object,
>      * must be one of {@link java.sql.Types}
>      * 
>      * @return the type of the object
>      * @see java.sql.Types
>      */
>     public int getType();
> }
> {code}
> Then I've changed the QueryRunner API, by replacing all Object param and Object[] params
by SQLParam param and SQLParam[] params (in a new QueryRunnerSQLParam class).
> It does work just well for me; any comments gladly appreciated.

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


Mime
View raw message