Top Fields Constructors Methods
org.postgresql.core.v3

public Class CopyDualImpl

extends CopyOperationImpl
implements CopyDual
Class Inheritance
All Implemented Interfaces
org.postgresql.copy.CopyDual, org.postgresql.copy.CopyOut, org.postgresql.copy.CopyOperation, org.postgresql.copy.CopyIn
Imports
org.postgresql.copy.CopyDual, org.postgresql.util.ByteStreamWriter, .PSQLException, org.checkerframework.checker.nullness.qual.Nullable, java.sql.SQLException, java.util.ArrayDeque, .Queue

Field Summary

Modifier and TypeField and Description
private final Queue<byte[]>
Inherited from org.postgresql.core.v3.CopyOperationImpl:
fieldFormatshandledRowCountqueryExecutorrowFormat

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public long
endCopy()

Implements org.postgresql.copy.CopyIn.endCopy.

Finishes copy operation successfully.

public void
flushCopy()

Implements org.postgresql.copy.CopyIn.flushCopy.

Force any buffered output to be sent over the network to the backend.

public void
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.

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.postgresql.copy.CopyIn.writeToCopy.

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.postgresql.copy.CopyIn.writeToCopy.

Writes a ByteStreamWriter to an open and writable copy operation.

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

Field Detail

receivedback to summary
private final Queue<byte[]> received

Constructor Detail

CopyDualImplback to summary
public CopyDualImpl()

Method Detail

endCopyback to summary
public long endCopy() throws SQLException

Implements org.postgresql.copy.CopyIn.endCopy.

Doc from org.postgresql.copy.CopyIn.endCopy.

Finishes copy operation successfully.

Returns:long

number of updated rows for server 8.2 or newer (see getHandledRowCount())

Annotations
@Override
Exceptions
SQLException:
if the operation fails.
flushCopyback to summary
public void flushCopy() throws SQLException

Implements org.postgresql.copy.CopyIn.flushCopy.

Doc from org.postgresql.copy.CopyIn.flushCopy.

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.

Annotations
@Override
Exceptions
SQLException:
if the operation fails.
handleCommandStatusback to summary
public void handleCommandStatus(String status) throws PSQLException

Overrides org.postgresql.core.v3.CopyOperationImpl.handleCommandStatus.

Annotations
@Override
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
writeToCopyback to summary
public void writeToCopy(byte[] data, int off, int siz) throws SQLException

Implements org.postgresql.copy.CopyIn.writeToCopy.

Doc from org.postgresql.copy.CopyIn.writeToCopy.

Writes specified part of given byte array to an open and writable copy operation.

Parameters
data:byte[]

array of bytes to write

off:int

offset of first byte to write (normally zero)

siz:int

number of bytes to write (normally buf.length)

Annotations
@Override
Exceptions
SQLException:
if the operation fails
writeToCopyback to summary
public void writeToCopy(ByteStreamWriter from) throws SQLException

Implements org.postgresql.copy.CopyIn.writeToCopy.

Doc from org.postgresql.copy.CopyIn.writeToCopy.

Writes a ByteStreamWriter to an open and writable copy operation.

Parameters
from:ByteStreamWriter

the source of bytes, e.g. a ByteBufferByteStreamWriter

Annotations
@Override
Exceptions
SQLException:
if the operation fails