Menu

UDTs handled in 5.0?

2006-05-12
2013-04-25
  • Douglas Kvidera

    Douglas Kvidera - 2006-05-12

    Will the next version handle user-defined types returned as STRUCTs?  I'm thinking of something like:

    ...
    <param id="1" inout="out" type="STRUCT" typename="MY_OBJ_TYP" classname="MyBean">
    ...
    <outparam id="1">
      <bean classname="MyBean">
        <field name="capacity">3</field>
      </bean>
    </outparam>

    where the returned object would be treated as a JavaBean.

     
    • Douglas Kvidera

      Douglas Kvidera - 2006-05-12

      Since the class name is only used to create an entry in the type map and there might be nested UDTs, it might make more sense to use:

      <connection>
        ...
        <typemap>
          <typedef typename="MY_OBJ_TYP" classname="MyBean" />
          <typedef typename="MY_SUB_OBJ_TYPE" classname="MySubBean">
        <typemap>
      </connection>

      instead of <param ... classname="MyBean">.

      The classname attribute of the bean element probably isn't needed either.  So we might have:

      <outparam id="1" type="STRUCT">
        <bean>
          <field name="capacity">3</field>
          <field name="subBean">
            <bean><field name="width">11</field></bean>
          </field>
        </bean>
      </outparam>

       
    • Sujit Pal

      Sujit Pal - 2006-05-13

      Hi Douglas,

      This would be a great feature. The only database I have access to which supports UDTs is PostgreSQL, but I dont know UDTs well enough to say for sure how hard this is going to be to support in a generic manner.

      Since you seem to have given this more thought than I have, would you be interested in writing a StructType.java to support STRUCTS in your database and contribute it to SQLUnit?

      If you are interested, check out the "writing your own type" section of the documentation to see how the StructType.java will interface with SQLUnit.

      TIA
      -sujit

       
    • Douglas Kvidera

      Douglas Kvidera - 2006-05-15

      I've got Oracle stored procs to test that return STRUCTs containing ARRAYs of more STRUCTs (Don't ask; I didn't write them).

      I'll see how far I get this week on handling just basic structs.  I'm changing the <bean> tag to <struct> but am open to whatever words you think are best.

      -doug

       
      • Sujit Pal

        Sujit Pal - 2006-05-17

        Hi David,

        Yes, the <struct> sounds better than <bean> in that it specifies the kind of data that is to follow. Thanks in advance for taking this on.

        -sujit

         
    • Sujit Pal

      Sujit Pal - 2006-06-10

      I applied the patch that you sent me manually (for some reason I was unable to patch the code directly, not sure why). The change was to replace tcs with tcs.hashCode() right?

      So I've (finally) got past the CVS change. Since sourceforge changed servers, I had to do a fresh checkout from the other server. I will reply to your email about the other fixes you were sending on Monday (I dont have the message right now).

      -sujit

       
      • Douglas Kvidera

        Douglas Kvidera - 2006-06-12

        I haven't sent you any patches yet.  Must have been someone else.

        -doug

         
        • Sujit Pal

          Sujit Pal - 2006-06-12

          Hi Doug,

          Yes, thanks for catching that, it was lenggi in the developer's forum. I found this out later. In any case, I was able to get the new cvs repository to work, so I will be able to apply your patch now. Sorry about the delay.

          Regarding your question in the email, I would suggest doing this. At the root of your sqlunit code, run:
          cvs diff -up > /path/to/patchfile.patch

          Then send me the patchfile as an attachment. You can click on the Patches link, it should allow you to upload a patch file.

          I will then be able to apply your patch like so:
          patch -p0 <patchfile.patch

          Sending me individual files or a cvs diff works too, but it would be more time consuming for me to manually apply the patches.

          Thanks
          -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.