return null; final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current;
return null; final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current;
return null; final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current;
return null; final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current;
return null; final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current;
return null; final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current;
/** * Combine a CLOB. * This method is called from the script. * * @param conn a connection * @param id the lob id * @return a reader for the combined data */ public static Reader combineClob(Connection conn, int id) throws SQLException, IOException { ResultSet rs = getLobStream(conn, "CDATA", id); Writer out = FileUtils.openFileWriter(TEMP_LOB_FILENAME, false); while (rs.next()) { Reader in = new BufferedReader(rs.getCharacterStream(1)); IOUtils.copyAndCloseInput(in, out); } out.close(); deleteLobStream(conn, id); return IOUtils.getReader(openAutoCloseInput()); }
/** * Combine a BLOB. * This method is called from the script. * When calling with id -1, the file is deleted. * * @param conn a connection * @param id the lob id * @return a stream for the combined data */ public static InputStream combineBlob(Connection conn, int id) throws SQLException, IOException { if (id < 0) { FileUtils.delete(TEMP_LOB_FILENAME); return null; } ResultSet rs = getLobStream(conn, "BDATA", id); OutputStream out = FileUtils.openFileOutputStream(TEMP_LOB_FILENAME, false); while (rs.next()) { InputStream in = rs.getBinaryStream(1); IOUtils.copyAndCloseInput(in, out); } out.close(); deleteLobStream(conn, id); return openAutoCloseInput(); }