ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Wang (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-173) Incorrect resultset retrieve when calling stored procedure
Date Tue, 19 Jul 2005 14:59:47 GMT
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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message