#31 Problems to use Multiple ResultSets with MSSQL Server

open
None
9
2009-03-13
2009-03-13
No

I have problems to use ResultSets with MSSQL Server.

No have example tests to this and test fail because system receive only the first resultset.

Can anyone help-me?

Follow the example of my Procedure and Test XML.

I´m debugging the java code to find problem, but whether anyone know that.

Tks

PROCEDURE
-----------------

CREATE PROCEDURE pr_test
BEGIN

SELECT
'Abc' AS field1,
'Def' AS field2

SELECT
0 AS code,
'Ghi' AS field1
'Jkl' AS field2

END
GO

TEST XML
------------------

<?xml version="1.0"?>
<!DOCTYPE sqlunit SYSTEM "file:docs/sqlunit.dtd" [
<!ENTITY con SYSTEM "test/xpto/connection.xml">
]>
<sqlunit>
<!-- ***************************** ** //-->
<!-- Connection set-up information //-->
<!-- ***************************** ** //-->
&con;

<test name="TestResultSets">
<sql>
<stmt>
----------------------------------------------------
-- Exec proc
----------------------------------------------------
EXEC pr_test
</stmt>
</sql>
<result>
<resultset id="1">
<row id="1">
<col id="01" name="field1" type="VARCHAR">Abc</col>
<col id="02" name="field2" type="VARCHAR">Def</col>
</row>
</resultset>
<resultset id="2">
<row id="1">
<col id="01" name="code" type="INTEGER">3</col>
<col id="02" name="field1" type="VARCHAR">Ghi</col>
<col id="03" name="field2" type="VARCHAR">jkl</col>
</row>
</resultset>
</result>
</test>
</sqlunit>

Discussion

  • I found the cause of problem with Resultsets.

    In File: sqlunit/sqlunit/src/net/sourceforge/sqlunit/handlers/SqlHandler.java

    In Method: isMoreResultsAvailable

    System ever return False value, but it is the code to return if the system continue read the Resultsets or stop to list them.

    I only include validation to not return ever False.

    Can anyone explain why this method ever return False? Have any error situation in more then one Resultset?

    Follow three files to correct them.

    -- Correction Patch
    1 - multipleResultSets.patch

    -- New Unit Tests to Problem
    2 - TestSQLUnit_TestMultipleResultsets.xml
    3 - SQLUnit_TestMultipleResultsets.sql

     
    • priority: 5 --> 9
    • assigned_to: nobody --> sahibsingh