@Override public void setClobAsAsciiStream( PreparedStatement ps, int paramIndex, @Nullable InputStream asciiStream, int contentLength) throws SQLException { if (asciiStream != null) { Clob clob = ps.getConnection().createClob(); try { FileCopyUtils.copy(asciiStream, clob.setAsciiStream(1)); } catch (IOException ex) { throw new DataAccessResourceFailureException("Could not copy into LOB stream", ex); } this.temporaryClobs.add(clob); ps.setClob(paramIndex, clob); } else { ps.setClob(paramIndex, (Clob) null); } if (logger.isDebugEnabled()) { logger.debug(asciiStream != null ? "Copied ASCII stream into temporary CLOB with length " + contentLength : "Set CLOB to null"); } }
@Override public void setClobAsAsciiStream(PreparedStatement ps, int paramIndex, InputStream asciiStream, int contentLength) throws SQLException { if (asciiStream != null) { Clob clob = ps.getConnection().createClob(); OutputStream out = clob.setAsciiStream(1); final int BUFFER_SIZE = 4096; try { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = asciiStream.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } out.flush(); } catch (Exception e) { throw new SQLException("setClob error", e); } finally { JdbcUtils.close(asciiStream); JdbcUtils.close(out); } ps.setClob(paramIndex, clob); } else { ps.setClob(paramIndex, (Clob) null); } }
@Override public java.io.OutputStream clob_setAsciiStream(ClobProxy clob, long pos) throws SQLException { if (this.pos < filterSize) { return nextFilter().clob_setAsciiStream(this, clob, pos); } return clob.getRawClob().setAsciiStream(pos); }
@Override public Clob mergeClob(Clob original, Clob target, SharedSessionContractImplementor session) { if ( original != target ) { try { // the CLOB just read during the load phase of merge final OutputStream connectedStream = target.setAsciiStream( 1L ); // the CLOB from the detached state final InputStream detachedStream = original.getAsciiStream(); StreamCopier.copy( detachedStream, connectedStream ); return target; } catch (SQLException e ) { throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" ); } } else { return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeClob( original, target, session ); } }
@Override public void setClobAsAsciiStream(PreparedStatement ps, int paramIndex, InputStream asciiStream, int contentLength) throws SQLException { if (asciiStream != null) { Clob clob = ps.getConnection().createClob(); OutputStream out = clob.setAsciiStream(1); final int BUFFER_SIZE = 4096; try { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = asciiStream.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } out.flush(); } catch (Exception e) { throw new SQLException("setClob error", e); } finally { JdbcUtils.close(asciiStream); JdbcUtils.close(out); } ps.setClob(paramIndex, clob); } else { ps.setClob(paramIndex, (Clob) null); } }
@Override public java.io.OutputStream clob_setAsciiStream(ClobProxy clob, long pos) throws SQLException { if (this.pos < filterSize) { return nextFilter().clob_setAsciiStream(this, clob, pos); } return clob.getRawClob().setAsciiStream(pos); }
/** * @see java.sql.Clob#setAsciiStream(long) */ public OutputStream setAsciiStream(long pos) throws SQLException { return this.reference.setAsciiStream(pos); }
/** * @see java.sql.Clob#setAsciiStream(long) */ public OutputStream setAsciiStream(long pos) throws SQLException { return this.reference.setAsciiStream(pos); }
/** * {@inheritDoc} */ @Override public OutputStream setAsciiStream(long pos) throws SQLException { return this.clob.setAsciiStream(pos); }
/** * {@inheritDoc} */ @Override public OutputStream setAsciiStream(long pos) throws SQLException { return this.clob.setAsciiStream(pos); }
@Override public OutputStream call() throws SQLException { return clob.setAsciiStream(pos); } });
/** * {@inheritDoc} */ @Override public OutputStream setAsciiStream(long pos) throws SQLException { return this.clob.setAsciiStream(pos); }
public OutputStream setAsciiStream(long pos) throws SQLException { return getWrappedClob().setAsciiStream(pos) ; }
public OutputStream setAsciiStream(long pos) throws SQLException { return getWrappedClob().setAsciiStream(pos); }
public OutputStream setAsciiStream(long pos) throws SQLException { return getWrappedClob().setAsciiStream(pos); }
public void setClobAsAsciiStream( PreparedStatement ps, int paramIndex, InputStream asciiStream, int contentLength) throws SQLException { Clob clob = ps.getConnection().createClob(); try { FileCopyUtils.copy(asciiStream, clob.setAsciiStream(1)); } catch (IOException ex) { throw new DataAccessResourceFailureException("Could not copy into LOB stream", ex); } this.temporaryClobs.add(clob); ps.setClob(paramIndex, clob); if (logger.isDebugEnabled()) { logger.debug(asciiStream != null ? "Copied ASCII stream into temporary CLOB with length " + contentLength : "Set CLOB to null"); } }
@Override public void setClobAsAsciiStream( PreparedStatement ps, int paramIndex, @Nullable InputStream asciiStream, int contentLength) throws SQLException { if (asciiStream != null) { Clob clob = ps.getConnection().createClob(); try { FileCopyUtils.copy(asciiStream, clob.setAsciiStream(1)); } catch (IOException ex) { throw new DataAccessResourceFailureException("Could not copy into LOB stream", ex); } this.temporaryClobs.add(clob); ps.setClob(paramIndex, clob); } else { ps.setClob(paramIndex, (Clob) null); } if (logger.isDebugEnabled()) { logger.debug(asciiStream != null ? "Copied ASCII stream into temporary CLOB with length " + contentLength : "Set CLOB to null"); } }
@Override public Clob mergeClob(Clob original, Clob target, SessionImplementor session) { if ( original != target ) { try { OutputStream connectedStream = target.setAsciiStream( 1L ); // the CLOB just read during the load phase of merge InputStream detachedStream = original.getAsciiStream(); // the CLOB from the detached state StreamCopier.copy( detachedStream, connectedStream ); return target; } catch (SQLException e ) { throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" ); } } else { return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeClob( original, target, session ); } }
@Override public Clob mergeClob(Clob original, Clob target, SessionImplementor session) { if ( original != target ) { try { OutputStream connectedStream = target.setAsciiStream( 1L ); // the CLOB just read during the load phase of merge InputStream detachedStream = original.getAsciiStream(); // the CLOB from the detached state StreamCopier.copy( detachedStream, connectedStream ); return target; } catch (SQLException e ) { throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" ); } } else { return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeClob( original, target, session ); } }
@Override public Clob mergeClob(Clob original, Clob target, SharedSessionContractImplementor session) { if ( original != target ) { try { // the CLOB just read during the load phase of merge final OutputStream connectedStream = target.setAsciiStream( 1L ); // the CLOB from the detached state final InputStream detachedStream = original.getAsciiStream(); StreamCopier.copy( detachedStream, connectedStream ); return target; } catch (SQLException e ) { throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" ); } } else { return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeClob( original, target, session ); } }