From 311bcfc6b3acdd6fd152798c7f287ddf74fa2a98 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 16 Apr 2024 21:46:48 +0200 Subject: Adding upstream version 15.4. Signed-off-by: Daniel Baumann --- doc/src/sgml/html/libpq-cancel.html | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 doc/src/sgml/html/libpq-cancel.html (limited to 'doc/src/sgml/html/libpq-cancel.html') diff --git a/doc/src/sgml/html/libpq-cancel.html b/doc/src/sgml/html/libpq-cancel.html new file mode 100644 index 0000000..6dd1d01 --- /dev/null +++ b/doc/src/sgml/html/libpq-cancel.html @@ -0,0 +1,74 @@ + +34.7. Canceling Queries in Progress

34.7. Canceling Queries in Progress

+ A client application can request cancellation of a command that is + still being processed by the server, using the functions described in + this section. + +

PQgetCancel

+ Creates a data structure containing the information needed to cancel + a command issued through a particular database connection. +

+PGcancel *PQgetCancel(PGconn *conn);
+

+

+ PQgetCancel creates a + PGcancel object + given a PGconn connection object. It will return + NULL if the given conn is NULL or an invalid + connection. The PGcancel object is an opaque + structure that is not meant to be accessed directly by the + application; it can only be passed to PQcancel + or PQfreeCancel. +

PQfreeCancel

+ Frees a data structure created by PQgetCancel. +

+void PQfreeCancel(PGcancel *cancel);
+

+

+ PQfreeCancel frees a data object previously created + by PQgetCancel. +

PQcancel

+ Requests that the server abandon processing of the current command. +

+int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize);
+

+

+ The return value is 1 if the cancel request was successfully + dispatched and 0 if not. If not, errbuf is filled + with an explanatory error message. errbuf + must be a char array of size errbufsize (the + recommended size is 256 bytes). +

+ Successful dispatch is no guarantee that the request will have + any effect, however. If the cancellation is effective, the current + command will terminate early and return an error result. If the + cancellation fails (say, because the server was already done + processing the command), then there will be no visible result at + all. +

+ PQcancel can safely be invoked from a signal + handler, if the errbuf is a local variable in the + signal handler. The PGcancel object is read-only + as far as PQcancel is concerned, so it can + also be invoked from a thread that is separate from the one + manipulating the PGconn object. +

+ +

PQrequestCancel

+ PQrequestCancel is a deprecated variant of + PQcancel. +

+int PQrequestCancel(PGconn *conn);
+

+

+ Requests that the server abandon processing of the current + command. It operates directly on the + PGconn object, and in case of failure stores the + error message in the PGconn object (whence it can + be retrieved by PQerrorMessage). Although + the functionality is the same, this approach is not safe within + multiple-thread programs or signal handlers, since it is possible + that overwriting the PGconn's error message will + mess up the operation currently in progress on the connection. +

+

\ No newline at end of file -- cgit v1.2.3