Menu

inout parameter part two

chabatox
2006-06-19
2013-04-25
  • chabatox

    chabatox - 2006-06-19

    I got a fresh version from the CVS, but using a simple test  I was getting a nullpointerexception:

    <test name="Test dummy" failure-message="">
      <call connection-id="1" >
        <stmt>{call PR_DUMMY(?,?,?)}</stmt>
        <param id="1"  name="P1"       type="VARCHAR" inout="in"    >50505050</param>
        <param id="2"  name="P2"           type="VARCHAR" inout="inout">${p}</param>
        <param id="3"  name="P3"         type="NUMERIC" inout="out" >${pp}</param>
      </call>
      <result>
        <outparam id="2" name="a" type="VARCHAR">${a}</outparam>
        <outparam id="3" name="b" type="NUMERIC">${b}</outparam>
      </result>
    </test>

    I looked at the code fixes and I did a little modification at SymbolTable.java

        public static synchronized void update(final DatabaseResult target,
                final DatabaseResult source) throws SQLUnitException {
            LOG.debug(">> update(target,source)");
            // update the outparams
            OutParam[] targetOutParams = target.getOutParams();
            OutParam[] sourceOutParams = source.getOutParams(); //Added
            for (int i = 0; i < targetOutParams.length; i++) {
                OutParam targetOutParam = targetOutParams[i]; //Modified
                OutParam sourceOutParam = sourceOutParams[i];  //Added
               
                String targetValue = targetOutParam.getValue();
                String sourceValue = sourceOutParam.getValue(); //Added
                if (SymbolTable.isVariableName(targetValue)) {
                    targetOutParam.setValue(SymbolTable.getValue(sourceValue));  //Modified
                }
               
            }
    I don't know if it's OK, but for me It's working.
    :)

    Chabatox

     
    • Sujit Pal

      Sujit Pal - 2006-06-25

      Hi Chabatox,

      Thanks for the fix, my code was bad, I've put in your fix into CVS.

      Commit log:
      Checking in src/net/sourceforge/sqlunit/SymbolTable.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/SymbolTable.java,v  <--  SymbolTable.java
      new revision: 1.44; previous revision: 1.43
      done

      -sujit

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.