PostgreSQL Source Code: src/interfaces/libpq/libpq-events.h Source File

PostgreSQL Source Code git master
libpq-events.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * libpq-events.h
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.
7 *
8 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
10 *
11 * src/interfaces/libpq/libpq-events.h
12 *
13 *-------------------------------------------------------------------------
14 */
15
16#ifndef LIBPQ_EVENTS_H
17#define LIBPQ_EVENTS_H
18
19#include "libpq-fe.h"
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif
25
26/* Callback Event Ids */
27 typedef enum
28{
29 PGEVT_REGISTER,
30 PGEVT_CONNRESET,
31 PGEVT_CONNDESTROY,
32 PGEVT_RESULTCREATE,
33 PGEVT_RESULTCOPY,
34 PGEVT_RESULTDESTROY
35 } PGEventId;
36
37 typedef struct
38{
39 PGconn *conn;
40} PGEventRegister;
41
42 typedef struct
43{
44 PGconn *conn;
45} PGEventConnReset;
46
47 typedef struct
48{
49 PGconn *conn;
50} PGEventConnDestroy;
51
52 typedef struct
53{
54 PGconn *conn;
55 PGresult *result;
56} PGEventResultCreate;
57
58 typedef struct
59{
60 const PGresult *src;
61 PGresult *dest;
62} PGEventResultCopy;
63
64 typedef struct
65{
66 PGresult *result;
67} PGEventResultDestroy;
68
69 typedef int (*PGEventProc) (PGEventId evtId, void *evtInfo, void *passThrough);
70
71/* Registers an event proc with the given PGconn. */
72extern int PQregisterEventProc(PGconn *conn, PGEventProc proc,
73 const char *name, void *passThrough);
74
75/* Sets the PGconn instance data for the provided proc to data. */
76extern int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data);
77
78/* Gets the PGconn instance data for the provided proc. */
79extern void *PQinstanceData(const PGconn *conn, PGEventProc proc);
80
81/* Sets the PGresult instance data for the provided proc to data. */
82extern int PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data);
83
84/* Gets the PGresult instance data for the provided proc. */
85extern void *PQresultInstanceData(const PGresult *result, PGEventProc proc);
86
87/* Fires RESULTCREATE events for an application-created PGresult. */
88extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* LIBPQ_EVENTS_H */
PGEventId
Definition: libpq-events.h:28
@ PGEVT_RESULTDESTROY
Definition: libpq-events.h:34
@ PGEVT_RESULTCREATE
Definition: libpq-events.h:32
@ PGEVT_CONNDESTROY
Definition: libpq-events.h:31
@ PGEVT_RESULTCOPY
Definition: libpq-events.h:33
@ PGEVT_CONNRESET
Definition: libpq-events.h:30
@ PGEVT_REGISTER
Definition: libpq-events.h:29
int PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data)
Definition: libpq-events.c:142
int PQfireResultCreateEvents(PGconn *conn, PGresult *res)
Definition: libpq-events.c:185
int PQregisterEventProc(PGconn *conn, PGEventProc proc, const char *name, void *passThrough)
Definition: libpq-events.c:40
int(* PGEventProc)(PGEventId evtId, void *evtInfo, void *passThrough)
Definition: libpq-events.h:69
void * PQresultInstanceData(const PGresult *result, PGEventProc proc)
Definition: libpq-events.c:165
int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data)
Definition: libpq-events.c:98
void * PQinstanceData(const PGconn *conn, PGEventProc proc)
Definition: libpq-events.c:121
const void * data
PGconn * conn
Definition: streamutil.c:52
PGconn * conn
Definition: libpq-events.h:44
PGconn * conn
Definition: libpq-events.h:39
const PGresult * src
Definition: libpq-events.h:60
PGresult * dest
Definition: libpq-events.h:61
PGresult * result
Definition: libpq-events.h:55
PGresult * result
Definition: libpq-events.h:66
const char * name

AltStyle によって変換されたページ (->オリジナル) /