ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Boden <list...@pandora.be>
Subject Re: Oracle ref cursors
Date Thu, 09 Feb 2006 22:08:50 GMT

There can be more than 1 out result sets, Michael's testcases on the 
wiki show that.

Will check the second bullet tomorrow, we can probably find a way around 
it.... it should also be just a resultset (but I vaguely remember some 
problems with it from past experiments).


Clinton Begin wrote:

>So the assumptions made here are:
>  * There can be only one out parameter of type ResultSet
>  * The default result set (possibly returned from a SELECT) is lost, as
>it's overidden by the ResultSet parameter.
>Seems a bit hackey, but I'm interested in everyone else's opinion.
>On 2/9/06, Sven Boden <list123@pandora.be> wrote:
>>I've been playing a bit with Michael Fagan's patch for supporting
>>ResultMaps using Oracle ref cursors. Sometimes I'm also a bit fond of
>>pushing as much functionality as possible in Oracle procedures and only
>>exposing a ref cursor to the (C) applications.
>>The patch works but having ORACLECURSOR in the iBATIS code puts me a bit
>>off. So I made some small cosmetic changes... what about the following:
>>- Michael Fagan's patch (now already to be redone because of other
>>changes in 2.1.7)
>>- With following changes:
>>    # Adding javaType="java.sql.ResultSet" to the parameterMap
>>    <parameterMap id="single-rs" class="map" >
>>        <parameter property="in1" jdbcType="int"
>>javaType="java.lang.Integer" mode="IN"/>
>>        <parameter property="output1" jdbcType="ORACLECURSOR"
>>javaType="java.sql.ResultSet" mode="OUT"/>
>>    </parameterMap>
>>    # doing the ResultSet extraction as follows (hardcoding ResultSet
>>instead of ORACLECURSOR).
>>    ....
>>    if (mapping.isOutputAllowed()) {
>>       if (
>>"java.sql.ResultSet".equalsIgnoreCase(mapping.getJavaTypeName()) )  {
>>              ResultSet rs = (ResultSet) cs.getObject( i + 1 );
>>    ....
>>    # In the TypeHandlerFactory a shortcut "cursor" could be made for
>>The above change would not put something "Oracle only" in iBATIS source
>>code, it would make the SQLMap still dependent on Oracle because of
>>ORACLECURSOR but I don't see this as a big problem (as soon as you use
>>SQL dialect in the SqlMaps you're also dependent upon a database).
>>As long as an other database supports a type for "cursor" it can use the
>>implementation above. Or is there something I'm missing, which could
>>come back to haunt us?
>>People using the current patch should then only add
>>"javaType="java.sql.ResultSet"" to their maps.
>>Sven Boden

View raw message