CopyOut

class CopyOut(stream: PgStream) : CopyOperation

A COPY ... TO STDOUT in progress: call readFromCopy until it hands back null.

The mirror of CopyIn and single-use for the same reason — the connection is in copy mode until the transfer ends, and it ends when the server says so. Chunk boundaries are the server's, so a chunk is a protocol message rather than a row; draining to null is what returns the connection to normal use, and abandoning the handle before that leaves it in copy mode.

Constructors

Link copied to clipboard
internal constructor(stream: PgStream)

Properties

Link copied to clipboard
open override var isActive: Boolean

Whether the transfer is still in progress, and with it whether the connection is still in copy mode and unusable for ordinary queries.

Functions

Link copied to clipboard
open override fun cancelCopy()

Abandons the transfer and returns the connection to a usable state.

Link copied to clipboard
open override fun close()

Cancels the transfer if it is still running, so use { } cannot leave a connection in copy mode.

Link copied to clipboard

Reads a chunk of data from the server.