public long endCopy() throws SQLException { if (at > 0) { op.writeToCopy(copyBuffer, 0, at); } op.endCopy(); return getHandledRowCount(); }
public int read(byte[] buf, int off, int siz) throws IOException { checkClosed(); int got = 0; boolean didReadSomething = false; while (got < siz && (didReadSomething = gotBuf())) { buf[off + got++] = this.buf[at++]; } return got == 0 && !didReadSomething ? -1 : got; }
/** * Use COPY FROM STDIN for very fast copying from an InputStream into a database table. * * @param sql COPY FROM STDIN statement * @param from a CSV file or such * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage issues * @throws IOException upon input stream or database connection failure */ public long copyIn(final String sql, InputStream from) throws SQLException, IOException { return copyIn(sql, from, DEFAULT_BUFFER_SIZE); }
public void cancelCopy() throws SQLException { op.cancelCopy(); }
public long getHandledRowCount() { return op.getHandledRowCount(); } }
public int available() throws IOException { checkClosed(); return (buf != null ? len - at : 0); }
public int read(byte[] buf) throws IOException { return read(buf, 0, buf.length); }
public int getFieldCount() { return op.getFieldCount(); }
public int getFieldFormat(int field) { return op.getFieldFormat(field); }
public int getFieldFormat(int field) { return op.getFieldFormat(field); }
public int getFormat() { return op.getFormat(); }
@Override public boolean isClosed() { return closeFlag || !copyDual.isActive(); }
@Override public byte[] readFromCopy(boolean block) throws SQLException { return readFromCopy(); }
/** * Use COPY FROM STDIN for very fast copying from a Reader into a database table. * * @param sql COPY FROM STDIN statement * @param from a CSV file or such * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage issues * @throws IOException upon reader or database connection failure */ public long copyIn(final String sql, Reader from) throws SQLException, IOException { return copyIn(sql, from, DEFAULT_BUFFER_SIZE); }
public long endCopy() throws SQLException { if(at > 0) { op.writeToCopy(copyBuffer, 0, at); } op.endCopy(); return getHandledRowCount(); }
public int read() throws IOException { checkClosed(); return gotBuf() ? buf[at++] : -1; }
public int available() throws IOException { checkClosed(); return ( buf != null ? len - at : 0 ); }
/** * Use COPY FROM STDIN for very fast copying from an InputStream into a database table. * @param sql COPY FROM STDIN statement * @param from a CSV file or such * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage issues * @throws IOException upon input stream or database connection failure */ public long copyIn(final String sql, InputStream from) throws SQLException, IOException { return copyIn(sql, from, DEFAULT_BUFFER_SIZE); }
public int read(byte[] buf, int off, int siz) throws IOException { checkClosed(); int got = 0; while( got < siz && gotBuf() ) { buf[off+got++] = this.buf[at++]; } return got; }
/** * Use COPY FROM STDIN for very fast copying from a Reader into a database table. * @param sql COPY FROM STDIN statement * @param from a CSV file or such * @return number of rows updated for server 8.2 or newer; -1 for older * @throws SQLException on database usage issues * @throws IOException upon reader or database connection failure */ public long copyIn(final String sql, Reader from) throws SQLException, IOException { return copyIn(sql, from, DEFAULT_BUFFER_SIZE); }