db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert S. Sfeir" <rob...@codepuccino.com>
Subject [PATCH] PlatformDefaultImpl in RC5 throwing ClassCastException
Date Tue, 03 Feb 2004 13:57:12 GMT
:-\

I guess no comments from the Oracle coders out there...  Can we then 
include this fix somehow so I don't have to keep 'fixing' my nightly 
builds, and certainly not 1.0?  This bug only affect Oracle impls.  
Tested it with Postgres and MySQL, ran JUnit tests and they all pass.  
Tested it with my app on various DBs, and things work as expected, no 
more ClassCastException.

again the change is from:
PlatformDefaultImpl line 255

public void setObjectForStatement(PreparedStatement ps, int index, 
Object value, int sqlType)
           throws SQLException
   {
       if ((value instanceof String) && (sqlType == Types.LONGVARCHAR))
       {
           String s = (String) value;
           ps.setCharacterStream(index, new StringReader(s), s.length());
       }
       else
       {
           ps.setObject(index, value, sqlType);
       }
   }

to:

public void setObjectForStatement(PreparedStatement ps, int index, 
Object value, int sqlType)
           throws SQLException
   {
       if ((value instanceof String) && (sqlType == Types.LONGVARCHAR))
       {
           String s = (String) value;
           ps.setCharacterStream(index, new StringReader(s), s.length());
       }
      else if ((value instanceof String)) // setString() if value is 
String, not Object
      {
          ps.setString( index, value.toString());
      }
      else
       {
           ps.setObject(index, value, sqlType);
       }
   }


Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message