Menu

handling custom datatypes

greg
2005-05-27
2013-04-25
  • greg

    greg - 2005-05-27

    I ran into a situation where our Oracle developer created a new Type that was an array of 4 numbers.  I kept getting type conflict SQLExceptions when I set the type as ARRAY.  The problem was I needed to use registerOutParameter(int paramIndex, int sqlType, String typeName).

    This change affected the following files:
    sqlunit.dtd
    Param.java
    ParamHandler.java
    CallHandler.java

    sqlunit.dtd
    ---------------
    <!ELEMENT param (#PCDATA)>
      <!ATTLIST param
        id CDATA #REQUIRED
        name CDATA #IMPLIED
        type CDATA #REQUIRED
        scale CDATA #IMPLIED
        typename CDATA #IMPLIED
        is-null (true|false) "false"
        inout (in|out|inout) "in">

    Param.java
    ----------------
    added....
    private String typeName;
    ...
    public final void setTypeName(String name) {
        this.typeName = name;
    }
       
    public final String getTypeName() {
        return this.typeName;
    }

    ParamHandler.java
    ---------------------------
    added in process(Element) ...
    param.setTypeName(XMLUtils.getAttributeValue(elParam, "typename"));

    CallHandler.java
    ------------------------
    param.setTypeName(XMLUtils.getAttributeValue(elParam, "typename"));
    ...
    //start - new code
    } else if (params[i].getTypeName() != null){
        tcs.registerOutParameter(i + 1, params[i].getSQLType(), params[i].getTypeName());
    //end - new code
    } else {
        tcs.registerOutParameter(i + 1, params[i].getSQLType());
    }

     
    • Sujit Pal

      Sujit Pal - 2005-05-29

      HI Greg,

      Thanks for pointing the bug out and providing a fix for it as well. I will incorporate the fix into CVS and this will be available in the next release.

      -sujit

       
    • Sujit Pal

      Sujit Pal - 2005-05-29

      Its in now, here are the files that were changed and their old and new version numbers:
      Checking in docs/sqlunit.dtd;
      /cvsroot/sqlunit/sqlunit/docs/sqlunit.dtd,v  <--  sqlunit.dtd
      new revision: 1.49; previous revision: 1.48
      done
      Checking in src/net/sourceforge/sqlunit/handlers/CallHandler.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/handlers/CallHandler.java,v  <--  CallHandler.java
      new revision: 1.13; previous revision: 1.12
      done
      Checking in src/net/sourceforge/sqlunit/handlers/ParamHandler.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/handlers/ParamHandler.java,v  <--  ParamHandler.java
      new revision: 1.9; previous revision: 1.8
      done
      Checking in src/net/sourceforge/sqlunit/beans/Param.java;
      /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/beans/Param.java,v  <--  Param.java
      new revision: 1.6; previous revision: 1.5
      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.