Class CopyOutImpl
- All Implemented Interfaces:
CopyOperation,CopyOut
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleCopydata(byte[] data) Consume received copy data.byte @Nullable []Blocks wait for a row of data to be received from server on an active copy operation.byte @Nullable []readFromCopy(boolean block) Wait for a row of data to be received from server on an active copy operation.Methods inherited from class org.postgresql.core.v3.CopyOperationImpl
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, getQueryExecutor, handleCommandStatus, isActiveMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.postgresql.copy.CopyOperation
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, isActive
-
Constructor Details
-
CopyOutImpl
public CopyOutImpl()
-
-
Method Details
-
readFromCopy
Description copied from interface:CopyOutBlocks wait for a row of data to be received from server on an active copy operation.- Specified by:
readFromCopyin interfaceCopyOut- Returns:
- byte array received from server, null if server complete copy operation
- Throws:
SQLException- if something goes wrong for example socket timeout
-
readFromCopy
Description copied from interface:CopyOutWait for a row of data to be received from server on an active copy operation.- Specified by:
readFromCopyin interfaceCopyOut- Parameters:
block-trueif need wait data from server otherwisefalseand will read pending message from server- Returns:
- byte array received from server, if pending message from server absent and use no blocking mode return null
- Throws:
SQLException- if something goes wrong for example socket timeout
-
handleCopydata
protected void handleCopydata(byte[] data) Description copied from class:CopyOperationImplConsume received copy data.- Specified by:
handleCopydatain classCopyOperationImpl- Parameters:
data- data that was receive by copy protocol
-