public class CopyOutImpl extends CopyOperationImpl implements CopyOut
Anticipated flow of a COPY TO STDOUT operation:
CopyManager.copyOut() ->QueryExecutor.startCopy() - sends given query to server ->processCopyResults(): - receives CopyOutResponse from Server - creates new CopyOutImpl ->initCopy(): - receives copy metadata from server ->CopyOutImpl.init() ->lock() connection for this operation - if query fails an exception is thrown - if query returns wrong CopyOperation, copyOut() cancels it before throwing exception <-returned: new CopyOutImpl holding lock on connection repeat CopyOut.readFromCopy() until null ->CopyOutImpl.readFromCopy() ->QueryExecutorImpl.readFromCopy() ->processCopyResults() - on copydata row from server ->CopyOutImpl.handleCopydata() stores reference to byte array - on CopyDone, CommandComplete, ReadyForQuery ->unlock() connection for use by other operations <-returned: byte array of data received from server or null at end.
Constructor and Description |
---|
CopyOutImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
handleCopydata(byte[] data)
Consume received copy data.
|
byte[] |
readFromCopy()
Blocks wait for a row of data to be received from server on an active copy operation.
|
byte[] |
readFromCopy(boolean block)
Wait for a row of data to be received from server on an active copy operation.
|
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, getQueryExecutor, handleCommandStatus, isActive
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, isActive
public byte[] readFromCopy() throws SQLException
CopyOut
readFromCopy
in interface CopyOut
SQLException
- if something goes wrong for example socket timeoutpublic byte[] readFromCopy(boolean block) throws SQLException
CopyOut
readFromCopy
in interface CopyOut
block
- true
if need wait data from server otherwise false
and will read
pending message from serverSQLException
- if something goes wrong for example socket timeoutprotected void handleCopydata(byte[] data)
CopyOperationImpl
handleCopydata
in class CopyOperationImpl
data
- data that was receive by copy protocolCopyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.