| The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide
by The PostgreSQL Global Development Group Paperback (6"x9"), 478 pages ISBN 9781906966065 RRP £14.95 ($19.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
1.12.2 Event Callback Procedure
PGEventProc-
PGEventProcis a typedef for a pointer to an event procedure, that is, the user callback function that receives events from libpq. The signature of an event procedure must beint eventproc(PGEventId evtId, void *evtInfo, void *passThrough)
TheevtIdparameter indicates whichPGEVTevent occurred. TheevtInfopointer must be cast to the appropriate structure type to obtain further information about the event. ThepassThroughparameter is the pointer provided toPQregisterEventProcwhen the event procedure was registered. The function should return a non-zero value if it succeeds and zero if it fails. A particular event procedure can be registered only once in anyPGconn. This is because the address of the procedure is used as a lookup key to identify the associated instance data.Caution: On Windows, functions can have two different addresses: one visible from outside a DLL and another visible from inside the DLL. One should be careful that only one of these addresses is used with libpq's event-procedure functions, else confusion will result. The simplest rule for writing code that will work is to ensure that event procedures are declared
static. If the procedure's address must be available outside its own source file, expose a separate function to return the address.
| ISBN 9781906966065 | The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide | See the print edition |