1 /*-------------------------------------------------------------------------
4 * This file contains definitions that are useful to applications
5 * that invoke the libpq "events" API, but are not interesting to
6 * ordinary users of libpq.
8 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/interfaces/libpq/libpq-events.h
13 *-------------------------------------------------------------------------
16 #ifndef LIBPQ_EVENTS_H
17 #define LIBPQ_EVENTS_H
26 /* Callback Event Ids */
56 } PGEventResultCreate
;
67 } PGEventResultDestroy
;
69 typedef int (*PGEventProc
) (PGEventId evtId
, void *evtInfo
, void *passThrough
);
71 /* Registers an event proc with the given PGconn. */
72 extern int PQregisterEventProc(PGconn
*conn
, PGEventProc proc
,
73 const char *name
, void *passThrough
);
75 /* Sets the PGconn instance data for the provided proc to data. */
76 extern int PQsetInstanceData(PGconn
*conn
, PGEventProc proc
, void *data
);
78 /* Gets the PGconn instance data for the provided proc. */
79 extern void *PQinstanceData(const PGconn
*conn
, PGEventProc proc
);
81 /* Sets the PGresult instance data for the provided proc to data. */
82 extern int PQresultSetInstanceData(PGresult
*result
, PGEventProc proc
, void *data
);
84 /* Gets the PGresult instance data for the provided proc. */
85 extern void *PQresultInstanceData(const PGresult
*result
, PGEventProc proc
);
87 /* Fires RESULTCREATE events for an application-created PGresult. */
88 extern int PQfireResultCreateEvents(PGconn
*conn
, PGresult
*res
);
94 #endif /* LIBPQ_EVENTS_H */