Menu

How to handle less-than sign in test specs?

Sujit Pal
2003-10-09
2003-10-11
  • Sujit Pal

    Sujit Pal - 2003-10-09

    -- posted by Wadhwa Sahib S --
    I however have another question
    if you dont mind answering.In a situation where i have a string output that
    contains a "less than sign"(<),the test file does not get validated as a valid
    xml file.Is there a solution to this.For example in the following case:

    <col id="2" name="reason" type="VARCHAR2">Count < 12000</col>

    the string "Count < 12000" causes a problem in the well formedness of the angle
    brackets.
    Any ideas will be appreciated.
    Thanks.
    Sahib Singh

     
    • Sujit Pal

      Sujit Pal - 2003-10-09

      You can use &lt; for < sign, so in your example:
      <col id="2" name="reason" type="VARCHAR2">Count &lt; 12000</col>
      Although VARCHAR2 is not supported. I know its an Oracle specific data type, but I think the closest analog in JDBC world is VARCHAR. Somebody who is more familiar with Oracle please correct me if I am wrong.

      - sujit

       
    • Sujit Pal

      Sujit Pal - 2003-10-11

      Thanks Sujit.The &lt; thing worked.
      Regarding VARCHAR2,i am confused.I wrote a java program that does the following:

      1.Executes a stored procedure in oracle and returns the resultset
      2.Parses the resultset to generate an XML file compatible with SQLUnit test case.

      Now, the getColumnType function in ResultSetMetaData returns "12" when it encounters a VARCHAR2 in my resultset.When i do the getColumnTypeName it returns
      me VARCHAR2.But the java.sql.Types does not have VARCHAR2 listed in its list.Rather VARCHAR is the one which has value 12.So what exactly is going on behind the scenes, i am unable to understand.Any ideas?

      Sahib Singh

       
    • Sujit Pal

      Sujit Pal - 2003-10-11

      Thanks for the analysis. So basically your analysis points to the fact that Oracle's VARCHAR2 can be served with JDBC (and hence SQLUnit) VARCHAR. So use VARCHAR as your data type.

      I will be creating a special OracleExtensions class to handle REF CURSORS as you asked, so it wont be too much of a deal for me to check for VARCHAR2 and internally use VARCHAR, so if using VARCHAR instead of VARCHAR2 is a big deal for you, let me know and I can put it into SQLUnit.

      -sujit

       

Log in to post a comment.

Monday.com Logo