MCPcopy Create free account
hub / github.com/apache/cloudberry / PQresetPoll

Function PQresetPoll

src/interfaces/libpq/fe-connect.c:4469–4505  ·  view source on GitHub ↗

* PQresetPoll: * resets the connection to the backend * closes the existing connection and makes a new one */

Source from the content-addressed store, hash-verified

4467 * closes the existing connection and makes a new one
4468 */
4469PostgresPollingStatusType
4470PQresetPoll(PGconn *conn)
4471{
4472 if (conn)
4473 {
4474 PostgresPollingStatusType status = PQconnectPoll(conn);
4475
4476 if (status == PGRES_POLLING_OK)
4477 {
4478 /*
4479 * Notify event procs of successful reset. We treat an event proc
4480 * failure as disabling the connection ... good idea?
4481 */
4482 int i;
4483
4484 for (i = 0; i < conn->nEvents; i++)
4485 {
4486 PGEventConnReset evt;
4487
4488 evt.conn = conn;
4489 if (!conn->events[i].proc(PGEVT_CONNRESET, &evt,
4490 conn->events[i].passThrough))
4491 {
4492 conn->status = CONNECTION_BAD;
4493 appendPQExpBuffer(&conn->errorMessage,
4494 libpq_gettext("PGEventProc \"%s\" failed during PGEVT_CONNRESET event\n"),
4495 conn->events[i].name);
4496 return PGRES_POLLING_FAILED;
4497 }
4498 }
4499 }
4500
4501 return status;
4502 }
4503
4504 return PGRES_POLLING_FAILED;
4505}
4506
4507/*
4508 * PQgetCancel: get a PGcancel structure corresponding to a connection.

Callers

nothing calls this directly

Calls 3

PQconnectPollFunction · 0.85
appendPQExpBufferFunction · 0.85
libpq_gettextFunction · 0.85

Tested by

no test coverage detected