ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sven Boden (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-173) Incorrect resultset retrieve when calling stored procedure
Date Fri, 23 Sep 2005 16:59:28 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-173?page=comments#action_12330299 ] 

Sven Boden commented on IBATIS-173:

In IBATIS-53 look at attached file showcase_storedprocedure.txt

Download that file and cut it up. It shows how to return a ResultSet (but not yet to get a
ResultMap back).

The cs.executeQuery() was in a previous version of iBATIS, but was changed to cs.execute()
to solve another problem. A little bit of information on creating TypeHandlers is in the SqlMap
documentation (developer guide), search for "Creating custom Type Handlers"

About the mapping of a ResultSet to a ResultMap, that's still open (IBATIS-154).


> Incorrect resultset retrieve when calling stored procedure
> ----------------------------------------------------------
>          Key: IBATIS-173
>          URL: http://issues.apache.org/jira/browse/IBATIS-173
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: Windows XP, JDK 1.4.2, Sybase JDBC 2, Sybase 12.5
>     Reporter: Phil Wang

> In SqlExecutor.java method:executeQueryProcedure, 
> ------------------code snippet -----------------------------------------------
>       cs.execute();
>       rs = cs.getResultSet();
>       errorContext.setMoreInfo("Check the results (failed to retrieve results).");
>       handleResults(request, rs, skipResults, maxResults, callback);
> -----------------end code snippet ---------------------------------------
> The handle to getResultSet is wrong, because the first thing might not be resultset rather
than update count.
> You should loop to first real resultset.
> A simple fix like this will be helpful:
> ------------------------code snippet-------------------------------------
> 			while (!((cs.getMoreResults() == false) && (cs.getUpdateCount() == -1))) {
> 				ResultSet rs = cs.getResultSet();
>                                 if (rs != null) { 
>                                          //put result set handler here, if you want to
handle only single resultset, you can jump out from here...
>                                 }
> 			}
> ----------------------end of code snippet---------------------------------

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message