SQLExecutor.getFirstResultSet goes into infinite loop in stored procedure call.
-------------------------------------------------------------------------------

                 Key: IBATIS-587
                 URL: https://issues.apache.org/jira/browse/IBATIS-587
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 2.3.4
            Reporter: Young Sub, Jeon
            Priority: Blocker


SQLExecutor.getFirstResultSet method call goes into an infinite loop when using 
Stored procedure in MySQL DB. 
If there are no more results, stmt.getUpdateCount() in 
moveToNextResultsIfPresent() must return -1. But, proved that always return 0.
Below is environment setting and source file. A stored proc of application goes 
to infinite loop, but consol command is 

[mvn dependency]
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.6</version>
</dependency>
<dependency>
    <groupId>org.apache.ibatis</groupId>
    <artifactId>ibatis-sqlmap</artifactId>
   <version>2.3.4.726</version>
</dependency>

[sqlMap.xml]
<parameterMap id="PriceProcedure" class="java.util.Map">
    <parameter property="nProdC" jdbcType="INTEGER" 
javaType="java.lang.Integer" mode="IN" />
    <parameter property="bReturn" jdbcType="INTEGER" 
javaType="java.lang.Integer" mode="OUT" />
</parameterMap>
<procedure id="procedureRenewalProduct" parameterMap="PriceProcedure" >
    { CALL RenewalProduct_JYS(?, ?) }
</procedure>

========================================================================================================
The stored procdedure body is below. This is simple procedure that return same 
integer value of IN parameter. 
On the result, after procedure call phase is performed, it returns result value 
collectley.

mysql> show create procedure RenewalProduct_JYS\G
*************************** 1. row ***************************
       Procedure: RenewalProduct_JYS
        sql_mode: NO_UNSIGNED_SUBTRACTION
Create Procedure: CREATE definer=`thro...@`localhost` PROCEDURE 
`RenewalProduct_JYS`(IN nProdC INT, OUT bReturn INT)
BEGIN
            SET bReturn = nProdC;
                END
1 row in set (0.00 sec)

mysql> call RenewalProduct_JYS(12345, @bReturn);
Query OK, 0 rows affected (0.00 sec)

mysql> select @bReturn;
+----------+
| @bReturn |
+----------+
| 12345    | 
+----------+
1 row in set (0.00 sec)

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

Reply via email to