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

Function PQrequestCancel

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

* PQrequestCancel: old, not thread-safe function for requesting query cancel * * Returns true if able to send the cancel request, false if not. * * On failure, the error message is saved in conn->errorMessage; this means * that this can't be used when there might be other active operations on * the connection object. * * NOTE: error messages will be cut off at the current size of the * er

Source from the content-addressed store, hash-verified

4770 * error message buffer, since we dare not try to expand conn->errorMessage!
4771 */
4772int
4773PQrequestCancel(PGconn *conn)
4774{
4775 int r;
4776
4777 /* Check we have an open connection */
4778 if (!conn)
4779 return false;
4780
4781 if (conn->sock == PGINVALID_SOCKET)
4782 {
4783 strlcpy(conn->errorMessage.data,
4784 "PQrequestCancel() -- connection is not open\n",
4785 conn->errorMessage.maxlen);
4786 conn->errorMessage.len = strlen(conn->errorMessage.data);
4787
4788 return false;
4789 }
4790
4791 r = internal_cancel(&conn->raddr, conn->be_pid, conn->be_key,
4792 conn->errorMessage.data, conn->errorMessage.maxlen,
4793 false);
4794
4795 if (!r)
4796 conn->errorMessage.len = strlen(conn->errorMessage.data);
4797
4798 return r;
4799}
4800
4801
4802/*

Callers 2

cdbCopyGetDataFunction · 0.85
cdbCopyEndInternalFunction · 0.85

Calls 2

strlcpyFunction · 0.85
internal_cancelFunction · 0.85

Tested by

no test coverage detected