* 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
| 4770 | * error message buffer, since we dare not try to expand conn->errorMessage! |
| 4771 | */ |
| 4772 | int |
| 4773 | PQrequestCancel(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 | /* |
no test coverage detected