Updated on 2024-05-07 GMT+08:00

PQsendQuery

Description

Commits a command to the server without waiting for the result. If the query is successful, 1 is returned. Otherwise, 0 is returned.

Prototype

int PQsendQuery(PGconn*conn, const char* query);

Parameters

Table 1 PQsendQuery parameters

Keyword

Description

conn

Points to the object pointer that contains the connection information.

query

Query string to be executed.

Return Values

int indicates the execution result. 1 indicates successful execution and 0 indicates an execution failure. The failure cause is stored in conn->errorMessage.

Precautions

After PQsendQuery is successfully called, call PQgetResult one or more times to obtain the results. PQsendQuery cannot be called again (on the same connection) until PQgetResult returns a null pointer, indicating that the command execution is complete.