PQflush
Description
Flushes any queued output data to the server.
Prototype
int PQflush(PGconn* conn);
Parameter
Keyword |
Description |
---|---|
conn |
Points to the object pointer that contains the connection information. |
Return Value
int indicates the operation result. If the operation is successful (or the send queue is empty), 0 is returned. If the operation fails, -1 is returned. If all data in the send queue fails to be sent, 1 is returned. (This case occurs only when the connection is non-blocking.) The failure cause is stored in conn->error_message.
Precautions
Call PQflush after sending any command or data over a non-blocking connection. If 1 is returned, wait for the socket to become read- or write-ready. If the socket becomes write-ready, call PQflush again. If the socket becomes read-ready, call PQconsumeInput and then call PQflush again. Repeat the operation until the value 0 is returned for PQflush. (It is necessary to check for read-ready and drain the input using PQconsumeInput. This is because the server can block trying to send us data, for example, notification messages, and will not read our data until we read it.) Once PQflush returns 0, wait for the socket to be read-ready and then read the response as described above.
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