COPY FROM STDIN operation.
Anticipated flow: CopyManager.copyIn() ->QueryExecutor.startCopy() - sends given query to server ->processCopyResults(): - receives CopyInResponse from Server - creates new CopyInImpl ->initCopy(): - receives copy metadata from server ->CopyInImpl.init() ->lock() connection for this operation - if query fails an exception is thrown - if query returns wrong CopyOperation, copyIn() cancels it before throwing exception <-return: new CopyInImpl holding lock on connection repeat CopyIn.writeToCopy() for all data ->CopyInImpl.writeToCopy() ->QueryExecutorImpl.writeToCopy() - sends given data ->processCopyResults() - parameterized not to block, just peek for new messages from server - on ErrorResponse, waits until protocol is restored and unlocks connection CopyIn.endCopy() ->CopyInImpl.endCopy() ->QueryExecutorImpl.endCopy() - sends CopyDone - processCopyResults() - on CommandComplete ->CopyOperationImpl.handleCommandComplete() - sets updatedRowCount when applicable - on ReadyForQuery unlock() connection for use by other operations <-return: CopyInImpl.getUpdatedRowCount()
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public void | flushCopy()
Implements org. Force any buffered output to be sent over the network to the backend. |
| protected void | handleCopydata(byte[]
data that was receive by copy protocol data)Implements abstract org. Consume received copy data. |
| public void | writeToCopy(byte[]
array of bytes to write data, int offset of first byte to write (normally zero) off, int number of bytes to write (normally buf.length) siz)Implements org. Writes specified part of given byte array to an open and writable copy operation. |
| public void | writeToCopy(ByteStreamWriter
the source of bytes, e.g. a ByteBufferByteStreamWriter from)Implements org. Writes a ByteStreamWriter to an open and writable copy operation. |
| CopyInImpl | back to summary |
|---|---|
| public CopyInImpl() | |
| endCopy | back to summary |
|---|---|
| public long endCopy() throws SQLException Implements org. Doc from org. Finishes copy operation successfully.
| |
| flushCopy | back to summary |
|---|---|
| public void flushCopy() throws SQLException Implements org. Doc from org. 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.
| |
| handleCopydata | back to summary |
|---|---|
| protected void handleCopydata(byte[] data) throws PSQLException Implements abstract org. Doc from org. Consume received copy data.
| |
| writeToCopy | back to summary |
|---|---|
| public void writeToCopy(byte[] data, int off, int siz) throws SQLException Implements org. Doc from org. Writes specified part of given byte array to an open and writable copy operation.
| |
| writeToCopy | back to summary |
|---|---|
| public void writeToCopy(ByteStreamWriter from) throws SQLException Implements org. Doc from org. Writes a ByteStreamWriter to an open and writable copy operation.
| |