db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/platforms PlatformOracleImpl.java
Date Fri, 09 May 2003 18:54:14 GMT
thma        2003/05/09 11:54:14

  Modified:    src/java/org/apache/ojb/broker/platforms
                        PlatformOracleImpl.java
  Log:
  Adding Per-Olofs CLOB patch for Oracle thin driver
  
  Revision  Changes    Path
  1.13      +24 -1     db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java
  
  Index: PlatformOracleImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PlatformOracleImpl.java	2 Apr 2003 07:45:33 -0000	1.12
  +++ PlatformOracleImpl.java	9 May 2003 18:54:14 -0000	1.13
  @@ -58,6 +58,9 @@
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   import java.io.ByteArrayInputStream;
  +import java.io.InputStreamReader;
  +import java.io.Reader;
  +import java.io.StringReader;
   import java.lang.reflect.Field;
   import java.security.AccessController;
   import java.security.PrivilegedAction;
  @@ -125,6 +128,26 @@
               // workaround: Oracle thin driver problem when expecting long
               ps.setLong(index, ((Integer) value).intValue());
           }
  +        
  +        else if (sqlType == Types.CLOB)
  +        {
  +            Reader reader = null;
  +            int length = 0;
  +            if (value instanceof String)
  +            {
  +                reader = new StringReader((String) value);
  +                length = (((String) value)).length();
  +            }
  +            else if (value instanceof byte[])
  +            {
  +                byte buf[] = (byte[]) value;
  +                ByteArrayInputStream inputStream = new ByteArrayInputStream(buf);
  +                reader = new InputStreamReader(inputStream);
  +            }
  +
  +            ps.setCharacterStream(index, reader, length);
  +        }
  +        
           else
           {
               super.setObjectForStatement(ps, index, value, sqlType);
  
  
  

Mime
View raw message