Method

PgsqlConnectionquery

Declaration

DexFuture*
pgsql_connection_query (
  PgsqlConnection* self,
  const char* sql,
  PgsqlParams* params
)

Description

Executes a SQL query on the connection.

This function executes sql with the provided params (if any) and returns a DexFuture that resolves to a PgsqlResult containing the query results.

The sql parameter should contain a valid SQL statement. If the query uses parameter placeholders (e.g., $1, $2), they should be provided via params using a PgsqlParams object.

COPY operations (COPY IN, COPY OUT, COPY BOTH) are not supported through this function and will result in an error. Use specialized APIs for COPY operations instead.

Parameters

sql

Type: const char*

The SQL query string to execute.

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

Type: PgsqlParams

Parameters for the query, or NULL for no parameters.

The argument can be NULL.
The data is owned by the caller of the method.

Return value

Type: DexFuture

A DexFuture that resolves to a PgsqlResult or rejects with error.

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