public static Blob toBlob ( Connection conn , Object value ) throws PageException , SQLException { if ( value instanceof Blob ) return ( Blob ) value ; // Java >= 1.6 if ( SystemUtil . JAVA_VERSION >= SystemUtil . JAVA_VERSION_6 ) { try { Blob blob = conn . createBlob ( ) ; blob . setBytes ( 1 , Caster . toBinary ( value ) ) ; return blob ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; return BlobImpl . toBlob ( value ) ; } } // Java < 1.6 if ( isOracle ( conn ) ) { Blob blob = OracleBlob . createBlob ( conn , Caster . toBinary ( value ) , null ) ; if ( blob != null ) return blob ; } return BlobImpl . toBlob ( value ) ; }
create a blog Object