ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z...@umich.edu
Subject Re: c# ibatis:procedure
Date Sun, 19 Feb 2006 21:57:50 GMT
Thank you very much, Mr. Grabowski. It works. But I got another issue.
For the example of swap email, here I have my code:

create or replace procedure
ps_swap_email_address (inout_email_1 in out varchar2, inout_email_2 in 
out varchar2)
is
  tmp_e varchar2(120);
begin
  tmp_e := inout_email_1;
  inout_email_1 := inout_email_2;
  inout_email_2 := tmp_e;
end;
/

<parameterMap id="swap_result" class="System.Collections.Hashtable">
  <parameter property="email_1" column="inout_email_1"/>
  <parameter property="email_2" column="inout_email_2"/>
</parameterMap>

<statement id="call_ps_swap_email_address" parameterMap="swap_result">
call ps_swap_email_address(?,?)
</statement>

            string first = "1_Joe.Dalton@somewhere.com";
            string second = "2_Averel.Dalton@somewhere.com";

            Hashtable map = new Hashtable();
            map.Add("email_1", first);
            map.Add("email_2", second);

            sqlMapper.QueryForObject("call_ps_swap_email_address", map);

            Console.WriteLine("1="+map["email_1"].ToString());
            Console.WriteLine("2="+map["email_2"].ToString());

But the results didn't swap the email values.

If I change the sqlmap.xml file to:

<parameterMap id="swap_result" class="System.Collections.Hashtable">
  <parameter property="email_1" column="inout_email_1" 
direction="InputOutput" />
  <parameter property="email_2" column="inout_email_2" 
direction="InputOutput" />
</parameterMap>

I go the following errors:

Object reference not set to an instance of an object.
   at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.RetrieveOutputParame
ters(RequestScope request, IDalSession session, IDbCommand command, 
Object resul
t)
   at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject(Re
questScope request, IDalSession session, Object parameterObject, Object 
resultOb
ject)
   at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObjec
t(IDalSession session, Object parameterObject, Object resultObject)
   at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObjec
t(IDalSession session, Object parameterObject)
   at IBatisNet.DataMapper.SqlMapper.QueryForObject(String 
statementName, Object
parameterObject)

Could you help me out this?

-Henry

Mime
View raw message