Top Description Fields Constructors Methods
org.postgresql.core.v3

public Class CopyOutImpl

extends CopyOperationImpl
implements CopyOut
Class Inheritance
All Implemented Interfaces
org.postgresql.copy.CopyOut, org.postgresql.copy.CopyOperation
Imports
org.postgresql.copy.CopyOut, org.checkerframework.checker.nullness.qual.Nullable, java.sql.SQLException

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.

Field Summary

Modifier and TypeField and Description
private @Nullable byte[]
Inherited from org.postgresql.core.v3.CopyOperationImpl:
fieldFormatshandledRowCountqueryExecutorrowFormat

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
handleCopydata(byte[]
data that was receive by copy protocol
data
)

Implements abstract org.postgresql.core.v3.CopyOperationImpl.handleCopydata.

Consume received copy data.

public @Nullable byte[]
readFromCopy()

Implements org.postgresql.copy.CopyOut.readFromCopy.

Blocks wait for a row of data to be received from server on an active copy operation.

public @Nullable byte[]
readFromCopy(boolean
true if need wait data from server otherwise false and will read pending message from server
block
)

Implements org.postgresql.copy.CopyOut.readFromCopy.

Wait for a row of data to be received from server on an active copy operation.

Inherited from org.postgresql.core.v3.CopyOperationImpl:
cancelCopygetFieldCountgetFieldFormatgetFormatgetHandledRowCountgetQueryExecutorhandleCommandStatusinitisActive

Field Detail

currentDataRowback to summary
private @Nullable byte[] currentDataRow

Constructor Detail

CopyOutImplback to summary
public CopyOutImpl()

Method Detail

handleCopydataback to summary
protected void handleCopydata(byte[] data)

Implements abstract org.postgresql.core.v3.CopyOperationImpl.handleCopydata.

Doc from org.postgresql.core.v3.CopyOperationImpl.handleCopydata.

Consume received copy data.

Parameters
data:byte[]

data that was receive by copy protocol

Annotations
@Override
readFromCopyback to summary
public @Nullable byte[] readFromCopy() throws SQLException

Implements org.postgresql.copy.CopyOut.readFromCopy.

Doc from org.postgresql.copy.CopyOut.readFromCopy.

Blocks wait for a row of data to be received from server on an active copy operation.

Returns:@Nullable byte[]

byte array received from server, null if server complete copy operation

Annotations
@Override
Exceptions
SQLException:
if something goes wrong for example socket timeout
readFromCopyback to summary
public @Nullable byte[] readFromCopy(boolean block) throws SQLException

Implements org.postgresql.copy.CopyOut.readFromCopy.

Doc from org.postgresql.copy.CopyOut.readFromCopy.

Wait for a row of data to be received from server on an active copy operation.

Parameters
block:boolean

true if need wait data from server otherwise false and will read pending message from server

Returns:@Nullable byte[]

byte array received from server, if pending message from server absent and use no blocking mode return null

Annotations
@Override
Exceptions
SQLException:
if something goes wrong for example socket timeout