Skip to content

ext/pgsql: pg_cancel_query internal update. #11081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -3470,12 +3470,22 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
PQconsumeInput(pgsql);
RETVAL_LONG(PQisBusy(pgsql));
break;
case PHP_PG_ASYNC_REQUEST_CANCEL:
RETVAL_LONG(PQrequestCancel(pgsql));
case PHP_PG_ASYNC_REQUEST_CANCEL: {
PGcancel *c;
char err[256];
int rc;

c = PQgetCancel(pgsql);
RETVAL_LONG((rc = PQcancel(c, err, sizeof(err))));
if (rc < 0) {
zend_error(E_WARNING, "cannot cancel the query: %s", err);
}
while ((pgsql_result = PQgetResult(pgsql))) {
PQclear(pgsql_result);
}
PQfreeCancel(c);
break;
}
EMPTY_SWITCH_DEFAULT_CASE()
}
if (PQsetnonblocking(pgsql, 0)) {
Expand Down