Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type
In directory sc8-pr-cvs1:/tmp/cvs-serv27891/sf/hibernate/type
Modified Files:
BinaryType.java BlobType.java ClobType.java
Log Message:
added createClob(), createBlob() for streams
Index: BinaryType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BinaryType.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BinaryType.java 19 Jan 2003 11:47:08 -0000 1.4
--- BinaryType.java 25 Jan 2003 09:35:52 -0000 1.5
***************
*** 2,13 ****
package net.sf.hibernate.type;
! import net.sf.hibernate.Environment;
! import net.sf.hibernate.HibernateException;
!
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
! import java.io.*;
public class BinaryType extends MutableType {
--- 2,16 ----
package net.sf.hibernate.type;
! import java.io.ByteArrayInputStream;
! import java.io.ByteArrayOutputStream;
! import java.io.IOException;
! import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
!
! import net.sf.hibernate.Environment;
! import net.sf.hibernate.HibernateException;
public class BinaryType extends MutableType {
Index: BlobType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BlobType.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** BlobType.java 19 Jan 2003 11:47:08 -0000 1.5
--- BlobType.java 25 Jan 2003 09:35:52 -0000 1.6
***************
*** 1,4 ****
//$Id$
-
package net.sf.hibernate.type;
--- 1,3 ----
***************
*** 16,20 ****
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if (value instanceof BlobImpl) {
! st.setBytes(index, ( (BlobImpl) value ).toBytes() );
}
else {
--- 15,20 ----
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if (value instanceof BlobImpl) {
! BlobImpl blob = (BlobImpl) value;
! st.setBinaryStream( index, blob.getBinaryStream(), (int) blob.length() );
}
else {
***************
*** 28,32 ****
public int sqlType() {
! return Types.VARBINARY; //TODO: Types.BLOB
}
--- 28,32 ----
public int sqlType() {
! return Types.BLOB;
}
Index: ClobType.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ClobType.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ClobType.java 19 Jan 2003 11:47:08 -0000 1.5
--- ClobType.java 25 Jan 2003 09:35:52 -0000 1.6
***************
*** 1,4 ****
//$Id$
-
package net.sf.hibernate.type;
--- 1,3 ----
***************
*** 16,20 ****
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if (value instanceof ClobImpl) {
! st.setString( index, ( (ClobImpl) value ).toString() );
}
else {
--- 15,20 ----
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if (value instanceof ClobImpl) {
! ClobImpl clob = (ClobImpl) value;
! st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() );
}
else {
***************
*** 28,32 ****
public int sqlType() {
! return Types.VARCHAR; //TODO: Types.CLOB
}
--- 28,32 ----
public int sqlType() {
! return Types.CLOB;
}
|