Method

PgsqlConnectioncopy_out

Declaration

DexFuture*
pgsql_connection_copy_out (
  PgsqlConnection* self,
  const char* sql,
  GOutputStream* output_stream
)

Description

Executes a COPY TO STDOUT operation on the connection.

This function sends the provided SQL statement, which must be a valid COPY ... TO STDOUT statement (including COPY (SELECT ...) TO STDOUT variants). It then reads data from the server and writes it to output_stream until the COPY operation completes.

Parameters

sql

Type: const char*

The COPY TO STDOUT SQL statement.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
output_stream

Type: GOutputStream

A GOutputStream to write data to.

The data is owned by the caller of the method.

Return value

Type: DexFuture

A DexFuture that resolves when the COPY operation completes successfully, or rejects with error.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.