Package org.postgresql.copy
Interface CopyIn
-
- All Superinterfaces:
CopyOperation
- All Known Subinterfaces:
CopyDual
- All Known Implementing Classes:
CopyDualImpl
,CopyInImpl
,PGCopyOutputStream
public interface CopyIn extends CopyOperation
Copy bulk data from client into a PostgreSQL table very fast.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
endCopy()
Finishes copy operation successfully.void
flushCopy()
Force any buffered output to be sent over the network to the backend.void
writeToCopy(byte[] buf, int off, int siz)
Writes specified part of given byte array to an open and writable copy operation.void
writeToCopy(ByteStreamWriter from)
Writes a ByteStreamWriter to an open and writable copy operation.-
Methods inherited from interface org.postgresql.copy.CopyOperation
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, isActive
-
-
-
-
Method Detail
-
writeToCopy
void writeToCopy(byte[] buf, int off, int siz) throws java.sql.SQLException
Writes specified part of given byte array to an open and writable copy operation.- Parameters:
buf
- array of bytes to writeoff
- offset of first byte to write (normally zero)siz
- number of bytes to write (normally buf.length)- Throws:
java.sql.SQLException
- if the operation fails
-
writeToCopy
void writeToCopy(ByteStreamWriter from) throws java.sql.SQLException
Writes a ByteStreamWriter to an open and writable copy operation.- Parameters:
from
- the source of bytes, e.g. a ByteBufferByteStreamWriter- Throws:
java.sql.SQLException
- if the operation fails
-
flushCopy
void flushCopy() throws java.sql.SQLException
Force any buffered output to be sent over the network to the backend. In general this is a useless operation as it will get pushed over in due time or when endCopy is called. Some specific modified server versions (Truviso) want this data sooner. If you are unsure if you need to use this method, don't.- Throws:
java.sql.SQLException
- if the operation fails.
-
endCopy
long endCopy() throws java.sql.SQLException
Finishes copy operation successfully.- Returns:
- number of updated rows for server 8.2 or newer (see getHandledRowCount())
- Throws:
java.sql.SQLException
- if the operation fails.
-
-