PQexec
Function
PQexec is used to submit a command to the server and wait for the result.
Prototype
PGresult *PQexec(PGconn *conn, const char *command);
Parameter
Keyword |
Parameter Description |
---|---|
conn |
Points to the object pointer that contains the connection information. |
command |
Query string to be executed. |
Return Value
PGresult indicates the object pointer that contains the query result.
Precautions
The PQresultStatus function should be called to check the return value for any errors (including the value of a null pointer, in which PGRES_FATAL_ERROR will be returned). The PQerrorMessage function can be called to obtain more information about such errors.
The command string can contain multiple SQL commands separated by semicolons (;). Multiple queries sent in a PQexec call are processed in one transaction, unless there are specific BEGIN/COMMIT commands in the query string to divide the string into multiple transactions. Note that the returned PGresult structure describes only the result of the last command executed from the string. If a command fails, the string processing stops and the returned PGresult describes the error condition.
Example
For details, see Example.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot