From e2b7d0c65c611ae3044eb3a49ada71aa22cbca80 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 19 Sep 2008 16:40:40 +0000 Subject: Improve the recently-added libpq events code to provide more consistent guarantees about whether event procedures will receive DESTROY events. They no longer need to defend themselves against getting a DESTROY without a successful prior CREATE. Andrew Chernow --- doc/src/sgml/libpq.sgml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 2db369e906d..c5da033a330 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,4 +1,4 @@ - + <application>libpq</application> - C Library @@ -4914,7 +4914,9 @@ typedef struct PGconn that should be in the CONNECTION_OK status; guaranteed if one calls PQregisterEventProc right after obtaining a good - PGconn. + PGconn. When returning a failure code, all + cleanup must be performed as no PGEVT_CONNDESTROY + event will be sent. @@ -4944,7 +4946,10 @@ typedef struct PGEventConnReset *. Although the contained PGconn was just reset, all event data remains unchanged. This event should be used to reset/reload/requery any - associated instanceData. + associated instanceData. Note that even if the + event procedure fails to process PGEVT_CONNRESET, it will + still receive a PGEVT_CONNDESTROY event when the connection + is closed. @@ -5003,7 +5008,9 @@ typedef struct instanceData that needs to be associated with the result. If the event procedure fails, the result will be cleared and the failure will be propagated. The event procedure must not try to - PQclear the result object for itself. + PQclear the result object for itself. When returning a + failure code, all cleanup must be performed as no + PGEVT_RESULTDESTROY event will be sent. @@ -5014,7 +5021,10 @@ typedef struct The result copy event is fired in response to PQcopyResult. This event will only be fired after - the copy is complete. + the copy is complete. Only event procedures that have + successfully handled the PGEVT_RESULTCREATE + or PGEVT_RESULTCOPY event for the source result + will receive PGEVT_RESULTCOPY events. typedef struct @@ -5032,7 +5042,10 @@ typedef struct can be used to provide a deep copy of instanceData, since PQcopyResult cannot do that. If the event procedure fails, the entire copy operation will fail and the - dest result will be cleared. + dest result will be cleared. When returning a + failure code, all cleanup must be performed as no + PGEVT_RESULTDESTROY event will be sent for the + destination result. -- cgit v1.2.3