PQstatus
Description
Returns the connection status.
Prototype
ConnStatusType PQstatus(const PGconn *conn);
Parameters
Keyword |
Description |
---|---|
conn |
Points to the object pointer that contains the connection information. |
Return Values
ConnStatusType indicates the connection status. The enumerated values are as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
CONNECTION_STARTED Waiting for the connection to be established. CONNECTION_MADE Connection succeeded; waiting to send CONNECTION_AWAITING_RESPONSE Waiting for a response from the server. CONNECTION_AUTH_OK Authentication received; waiting for backend startup to complete. CONNECTION_SSL_STARTUP Negotiating SSL encryption. CONNECTION_SETENV Negotiating environment-driven parameter settings. CONNECTION_OK Normal connection. CONNECTION_BAD Failed connection. |
Precautions
The connection status can be one of the preceding values. After the asynchronous connection procedure is complete, only two of them, CONNECTION_OK and CONNECTION_BAD, can return. CONNECTION_OK indicates that the connection to the database is normal. CONNECTION_BAD indicates that the connection to the database fails. Generally, the normal state remains until PQfinish is called. However, a communication failure may cause the connection status to become to CONNECTION_BAD before the connection procedure is complete. In this case, the application can attempt to call PQreset to restore the communication.
Examples
For details, see Examples.
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