Menu

#100 Solution for "Error at Support.convert()"

closed
momo
None
5
2020-12-01
2008-10-15
Jaya Nagdev
No

Hi,

I am not able to install CSV on my machine hence could not download the CSV repository of jtds. Hence i am putting the change in the tracker itself as this is a very small change. Sorry for inconvience. :(

File : net.sourceforge.jtds.jdbc.Support.java
Method : static Object convert(Object callerReference, Object x, int jdbcType, String charSet)

Chnages marked with + at start of the line :

switch (jdbcType) {

case java.sql.Types.TINYINT:
case java.sql.Types.SMALLINT:
case java.sql.Types.INTEGER:
  if (x == null) {
     return INTEGER_ZERO;
  } else if (x instanceof Integer) {
     return x;
  } else if (x instanceof Byte) {
     return new Integer(((Byte)x).byteValue() & 0xFF);
  } else if (x instanceof Number) {
     return new Integer(((Number) x).intValue());
  } else if (x instanceof String) {
  • // Customization starts
  • if(((String)x).trim().equalsIgnoreCase("NULL")) {
  • return INTEGER_ZERO;
  • }
    +// Customization ends
    return new Integer(((String) x).trim());
    } else if (x instanceof Boolean) {
    return ((Boolean) x).booleanValue() ? INTEGER_ONE : INTEGER_ZERO;
    }
    break;

Discussion

  • Jaya Nagdev

    Jaya Nagdev - 2008-10-15

    How to link this tracker to a issue opened in the forum? Pl. reply. (I am new to this) - Thanks

     
  • momo

    momo - 2009-07-28

    I cannot reproduce the described problem here and the test provided by Bruce in the linked thread works flawlessly.

    If someone can reproduce that problem and has a corresponding test scenario, please let me know and I'll reopen this bug.

     

Anonymous
Anonymous

Add attachments
Cancel