I'm trying to get the following test to work:
<test name="Getting an objective name">
<call>
<stmt>{? = call GetObjectiveName(?)}</stmt>
<param id="1" type="INTEGER">1201</param>
<param id="2" type="VARCHAR" inout="out">${rc}</param>
</call>
<result>
<outparam id="2" type="VARCHAR">Number Concepts</outparam>
</result>
</test>
But it returns NULL as an output parameter and gives the following:
[sqlunit] <exception>
[sqlunit] <code>0</code>
[sqlunit] <message>[TDS Driver]Empty Parameter:1</message>
[sqlunit] </exception>
[sqlunit] </result>
It should be returning "Number Concepts" and the stored procedure is correct.
Any ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One thing that I noticed is that your parameters should be reversed. Parameters are numbered from left to right, starting with an id of "1". The first parameter should be your return code.
That is, your code should be:
<call>
<stmt>{? = call GetObjectiveName(?)}</stmt>
<param id="1" type="VARCHAR" inout="out">${rc}</param>
<param id="2" type="INTEGER">1201</param>
</call>
Second, since I believe stored procedures only return integers as return codes, your expected result is also incorrect. It should be:
or something similar, since the return code is the first parameter.
If you are using an OUTPUT parameter as the second parameter, then you will need to make the second parameter an "inout", and specify a second <outparam> within the <result>. If your stored procdure returns a result set, then you will need to specify a <resultset> in addition to the <outparam> for the return code within the <result>.
Hope this helps.
-jh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the pointers. I've got it working better now - but I keep getting one error:
[sqlunit] outparam[2].id(3) out of bounds
[sqlunit] Tearing down test...
[sqlunit] sqlunit-ant: SQLUnit Tests Failed: In file: test/ms-sql/test.xml, te
sts: 1, failures: 1, errors = 0
Here is my new syntax:
<test name="Getting an objective name">
<call>
<stmt>{? = call GetObjectiveName(?,?)}</stmt>
<param id="1" type="INTEGER" inout="out" is-null="false" name="ReturnValue">${retval}</param>
<param id="2" type="INTEGER" inout="in" name="IN_ObjId" >1201</param>
<param id="3" type="VARCHAR" inout="out" name="OUT_ObjName">${rc}</param>
</call>
<result>
<outparam id="1" type="INTEGER">0</outparam>
<outparam id="3" type="VARCHAR">Number Concepts</outparam>
</result>
</test>
Any ideas about the out of bounds error?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you pull a the files mentioned in this thread from CVS, place them in the proper location within the "src" directory, and rebuild (using the command ant install), it should solve the problem.
Your other choice is to download the SQLUnit 4.7 tarball which does not exhibit this behavior.
Hope this helps.
-jh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to get the following test to work:
<test name="Getting an objective name">
<call>
<stmt>{? = call GetObjectiveName(?)}</stmt>
<param id="1" type="INTEGER">1201</param>
<param id="2" type="VARCHAR" inout="out">${rc}</param>
</call>
<result>
<outparam id="2" type="VARCHAR">Number Concepts</outparam>
</result>
</test>
But it returns NULL as an output parameter and gives the following:
[sqlunit] <exception>
[sqlunit] <code>0</code>
[sqlunit] <message>[TDS Driver]Empty Parameter:1</message>
[sqlunit] </exception>
[sqlunit] </result>
It should be returning "Number Concepts" and the stored procedure is correct.
Any ideas?
Hi Rick,
One thing that I noticed is that your parameters should be reversed. Parameters are numbered from left to right, starting with an id of "1". The first parameter should be your return code.
That is, your code should be:
<call>
<stmt>{? = call GetObjectiveName(?)}</stmt>
<param id="1" type="VARCHAR" inout="out">${rc}</param>
<param id="2" type="INTEGER">1201</param>
</call>
Second, since I believe stored procedures only return integers as return codes, your expected result is also incorrect. It should be:
<result>
<outparam id="1" type="INTEGER">0</outparam>
</result>
or something similar, since the return code is the first parameter.
If you are using an OUTPUT parameter as the second parameter, then you will need to make the second parameter an "inout", and specify a second <outparam> within the <result>. If your stored procdure returns a result set, then you will need to specify a <resultset> in addition to the <outparam> for the return code within the <result>.
Hope this helps.
-jh
Thanks for the pointers. I've got it working better now - but I keep getting one error:
[sqlunit] outparam[2].id(3) out of bounds
[sqlunit] Tearing down test...
[sqlunit] sqlunit-ant: SQLUnit Tests Failed: In file: test/ms-sql/test.xml, te
sts: 1, failures: 1, errors = 0
Here is my new syntax:
<test name="Getting an objective name">
<call>
<stmt>{? = call GetObjectiveName(?,?)}</stmt>
<param id="1" type="INTEGER" inout="out" is-null="false" name="ReturnValue">${retval}</param>
<param id="2" type="INTEGER" inout="in" name="IN_ObjId" >1201</param>
<param id="3" type="VARCHAR" inout="out" name="OUT_ObjName">${rc}</param>
</call>
<result>
<outparam id="1" type="INTEGER">0</outparam>
<outparam id="3" type="VARCHAR">Number Concepts</outparam>
</result>
</test>
Any ideas about the out of bounds error?
Hi Rick,
It looks like you're running into the same problem that I ran into when I pulled SQLUnit 4.8. Check out the following thread:
http://sourceforge.net/forum/forum.php?thread_id=1294550&forum_id=265576
If you pull a the files mentioned in this thread from CVS, place them in the proper location within the "src" directory, and rebuild (using the command ant install), it should solve the problem.
Your other choice is to download the SQLUnit 4.7 tarball which does not exhibit this behavior.
Hope this helps.
-jh
Thanks. That did the trick.