| 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.3 Event Support Functions
PQregisterEventProc-
Registers an event callback procedure with libpq.
int PQregisterEventProc(PGconn *conn, PGEventProc proc, const char *name, void *passThrough);An event procedure must be registered once on eachPGconnyou want to receive events about. There is no limit, other than memory, on the number of event procedures that can be registered with a connection. The function returns a non-zero value if it succeeds and zero if it fails. Theprocargument will be called when a libpq event is fired. Its memory address is also used to lookupinstanceData. Thenameargument is used to refer to the event procedure in error messages. This value cannot beNULLor a zero-length string. The name string is copied into thePGconn, so what is passed need not be long-lived. ThepassThroughpointer is passed to theprocwhenever an event occurs. This argument can beNULL. PQsetInstanceData-
Sets the connection
conn'sinstanceDatafor procedureproctodata. This returns non-zero for success and zero for failure. (Failure is only possible ifprochas not been properly registered inconn.)int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data);
PQinstanceData-
Returns the
connection
conn'sinstanceDataassociated with procedureproc, orNULLif there is none.void *PQinstanceData(const PGconn *conn, PGEventProc proc);
PQresultSetInstanceData-
Sets the result's
instanceDataforproctodata. This returns non-zero for success and zero for failure. (Failure is only possible ifprochas not been properly registered in the result.)int PQresultSetInstanceData(PGresult *res, PGEventProc proc, void *data);
PQresultInstanceData-
Returns the result's
instanceDataassociated withproc, orNULLif there is none.void *PQresultInstanceData(const PGresult *res, PGEventProc proc);
| ISBN 9781906966065 | The PostgreSQL 9.0 Reference Manual - Volume 2 - Programming Guide | See the print edition |