@Override public void setClobAsCharacterStream( PreparedStatement ps, int paramIndex, @Nullable Reader characterStream, int contentLength) throws SQLException { if (characterStream != null) { Clob clob = ps.getConnection().createClob(); try { FileCopyUtils.copy(characterStream, clob.setCharacterStream(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(characterStream != null ? "Copied character stream into temporary CLOB with length " + contentLength : "Set CLOB to null"); } }
@Override public java.io.Writer clob_setCharacterStream(ClobProxy clob, long pos) throws SQLException { if (this.pos < filterSize) { return nextFilter().clob_setCharacterStream(this, clob, pos); } return clob.getRawClob().setCharacterStream(pos); }
/** * Sets the clob parameter for the prepared statement. * * @param ps * @param i * @param o * @param cls * @throws SQLException */ private static void setClob(PreparedStatement ps, int i, Object o, Class<?> cls) throws SQLException { final Reader r; if (o instanceof String) r = new StringReader((String) o); else if (o instanceof Reader) r = (Reader) o; else throw new RuntimeException( "cannot insert parameter of type " + cls + " into clob column " + i); Clob c = ps.getConnection().createClob(); Writer w = c.setCharacterStream(1); copy(r, w); ps.setClob(i, c); }
@Override public java.io.Writer clob_setCharacterStream(ClobProxy clob, long pos) throws SQLException { if (this.pos < filterSize) { return nextFilter().clob_setCharacterStream(this, clob, pos); } return clob.getRawClob().setCharacterStream(pos); }
/** * {@inheritDoc} */ @Override public Writer setCharacterStream(long pos) throws SQLException { return this.clob.setCharacterStream(pos); }
/** * {@inheritDoc} */ @Override public Writer setCharacterStream(long pos) throws SQLException { return this.clob.setCharacterStream(pos); }
/** * {@inheritDoc} */ @Override public Writer setCharacterStream(long pos) throws SQLException { return this.clob.setCharacterStream(pos); }
Clob myClob = this.con.createClob(); Writer clobWriter = myClob.setCharacterStream(1);
/** * @see java.sql.Clob#setCharacterStream(long) */ public Writer setCharacterStream(long pos) throws SQLException { return this.reference.setCharacterStream(pos); }
@Override public Writer call() throws SQLException { return clob.setCharacterStream(pos); } });
/** * @see java.sql.Clob#setCharacterStream(long) */ public Writer setCharacterStream(long pos) throws SQLException { return this.reference.setCharacterStream(pos); }
/** * Invoke the JDK 1.4 <code>setCharacterStream</code> method on the given * CLOB object. */ public void putChars(Clob clob, char[] data) throws SQLException { Writer writer = clob.setCharacterStream(1L); try { writer.write(data); writer.flush(); } catch (IOException ioe) { throw new SQLException(ioe.toString()); } }
public Writer setCharacterStream(long pos) throws SQLException { return getWrappedClob().setCharacterStream(pos); }
java.sql.Connection con; javax.xml.bind.Marshaller marshaller; Clob xmlClob = con.createClob(); try { try (Writer xmlClobWriter = xmlClob.setCharacterStream(1)) { m.marshal(jaxbObject, xmlClobWriter); } // xmlClobWriter.close(); try (PreparedStatement stmt = con.prepareStatement("INSERT INTO table (xml) values(?)")) { stmt.setClob(1, xmlClob); stmt.executeUpdate(); } } finally { xmlClob.free(); }
public Writer openWriter(long pos) throws PersistException { try { return getInternalClobForPersist().setCharacterStream(pos); } catch (SQLException e) { throw mRepo.toPersistException(e); } }
public Writer openWriter(long pos) throws PersistException { try { return getInternalClobForPersist().setCharacterStream(pos); } catch (SQLException e) { throw mRepo.toPersistException(e); } }
@Override public void setClob(int parameterIndex, Reader reader) throws SQLException { checkClosed(); Clob clob = connection.createClob(); try { CharStreams.copy(reader, clob.setCharacterStream(1)); } catch (IOException e) { throw new SQLException(e); } set(parameterIndex, clob, JDBCType.CLOB); }
@Override public void setClob(int parameterIndex, Reader reader) throws SQLException { checkClosed(); Clob clob = connection.createClob(); try { CharStreams.copy(reader, clob.setCharacterStream(1)); } catch (IOException e) { throw new SQLException(e); } set(parameterIndex, clob, Types.CLOB); }
@Override public void updateClob(int columnIndex, Reader x) throws SQLException { checkClosed(); checkUpdate(); Clob clob = statement.connection.createClob(); try { CharStreams.copy(x, clob.setCharacterStream(1)); } catch (IOException e) { throw new SQLException(e); } set(columnIndex, clob, null); }
@Override public void updateClob(int columnIndex, Reader x) throws SQLException { checkClosed(); checkUpdate(); Clob clob = statement.connection.createClob(); try { CharStreams.copy(x, clob.setCharacterStream(1)); } catch (IOException e) { throw new SQLException(e); } set(columnIndex, clob); }