private boolean gotBuf() throws IOException { if(at >= len) { try { buf = op.readFromCopy(); } catch(SQLException sqle) { throw new IOException(GT.tr("Copying from database failed: {0}", sqle)); } if(buf == null) { at = -1; return false; } else { at = 0; len = buf.length; return true; } } return buf != null; }
private boolean gotBuf() throws IOException { if (at >= len) { try { buf = op.readFromCopy(); } catch (SQLException sqle) { throw new IOException(GT.tr("Copying from database failed: {0}", sqle)); } if (buf == null) { at = -1; return false; } else { at = 0; len = buf.length; return true; } } return buf != null; }
CopyOut cp = copyOut(sql); try { while ((buf = cp.readFromCopy()) != null) { to.write(buf); while ((buf = cp.readFromCopy()) != null) {
/** * Pass results of a COPY TO STDOUT query from database into an OutputStream. * @param sql COPY TO STDOUT statement * @param to the stream to write the results to (row by row) * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage errors * @throws IOException upon output stream or database connection failure */ public long copyOut(final String sql, OutputStream to) throws SQLException, IOException { byte[] buf; CopyOut cp = copyOut(sql); try { while( (buf = cp.readFromCopy()) != null ) { to.write(buf); } return cp.getHandledRowCount(); } finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } }
CopyOut cp = copyOut(sql); try { while ((buf = cp.readFromCopy()) != null) { to.write(encoding.decode(buf)); while ((buf = cp.readFromCopy()) != null) {
/** * Pass results of a COPY TO STDOUT query from database into a Writer. * @param sql COPY TO STDOUT statement * @param to the stream to write the results to (row by row) * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage errors * @throws IOException upon writer or database connection failure */ public long copyOut(final String sql, Writer to) throws SQLException, IOException { byte[] buf; CopyOut cp = copyOut(sql); try { while ( (buf = cp.readFromCopy()) != null ) { to.write(encoding.decode(buf)); } return cp.getHandledRowCount(); } finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } }
private boolean gotBuf() throws IOException { if(at >= len) { try { buf = op.readFromCopy(); } catch(SQLException sqle) { throw new IOException(GT.tr("Copying from database failed: {0}", sqle)); } if(buf == null) { at = -1; return false; } else { at = 0; len = buf.length; return true; } } return buf != null; }
private boolean gotBuf() throws IOException { if(at >= len) { try { buf = op.readFromCopy(); } catch(SQLException sqle) { throw new IOException(GT.tr("Copying from database failed: {0}", sqle)); } if(buf == null) { at = -1; return false; } else { at = 0; len = buf.length; return true; } } return buf != null; }
/** * Pass results of a COPY TO STDOUT query from database into an OutputStream. * @param sql COPY TO STDOUT statement * @param to the stream to write the results to (row by row) * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage errors * @throws IOException upon output stream or database connection failure */ public long copyOut(final String sql, OutputStream to) throws SQLException, IOException { byte[] buf; CopyOut cp = copyOut(sql); try { while( (buf = cp.readFromCopy()) != null ) { to.write(buf); } return cp.getHandledRowCount(); } finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } }
/** * Pass results of a COPY TO STDOUT query from database into an OutputStream. * @param sql COPY TO STDOUT statement * @param to the stream to write the results to (row by row) * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage errors * @throws IOException upon output stream or database connection failure */ public long copyOut(final String sql, OutputStream to) throws SQLException, IOException { byte[] buf; CopyOut cp = copyOut(sql); try { while( (buf = cp.readFromCopy()) != null ) { to.write(buf); } return cp.getHandledRowCount(); } finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } }
/** * Pass results of a COPY TO STDOUT query from database into a Writer. * @param sql COPY TO STDOUT statement * @param to the stream to write the results to (row by row) * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage errors * @throws IOException upon writer or database connection failure */ public long copyOut(final String sql, Writer to) throws SQLException, IOException { byte[] buf; CopyOut cp = copyOut(sql); try { while ( (buf = cp.readFromCopy()) != null ) { to.write(encoding.decode(buf)); } return cp.getHandledRowCount(); } finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } }
/** * Pass results of a COPY TO STDOUT query from database into a Writer. * @param sql COPY TO STDOUT statement * @param to the stream to write the results to (row by row) * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage errors * @throws IOException upon writer or database connection failure */ public long copyOut(final String sql, Writer to) throws SQLException, IOException { byte[] buf; CopyOut cp = copyOut(sql); try { while ( (buf = cp.readFromCopy()) != null ) { to.write(encoding.decode(buf)); } return cp.getHandledRowCount(); } finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } }