1 /*-------------------------------------------------------------------------
2 *
3 * cmdtag.h
4 * Declarations for commandtag names and enumeration.
5 *
6 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * src/include/tcop/cmdtag.h
10 *
11 *-------------------------------------------------------------------------
12 */
13 #ifndef CMDTAG_H
14 #define CMDTAG_H
15
16
17 #define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \
18 tag,
19
20 typedef enum CommandTag
21 {
22 #include "tcop/cmdtaglist.h"
23 COMMAND_TAG_NEXTTAG
24 } CommandTag;
25
26 #undef PG_CMDTAG
27
28 typedef struct QueryCompletion
29 {
30 CommandTag commandTag;
31 uint64 nprocessed;
32 } QueryCompletion;
33
34
35 static inline void
SetQueryCompletion(QueryCompletion * qc,CommandTag commandTag,uint64 nprocessed)36 SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag,
37 uint64 nprocessed)
38 {
39 qc->commandTag = commandTag;
40 qc->nprocessed = nprocessed;
41 }
42
43 static inline void
CopyQueryCompletion(QueryCompletion * dst,const QueryCompletion * src)44 CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src)
45 {
46 dst->commandTag = src->commandTag;
47 dst->nprocessed = src->nprocessed;
48 }
49
50
51 extern void InitializeQueryCompletion(QueryCompletion *qc);
52 extern const char *GetCommandTagName(CommandTag commandTag);
53 extern bool command_tag_display_rowcount(CommandTag commandTag);
54 extern bool command_tag_event_trigger_ok(CommandTag commandTag);
55 extern bool command_tag_table_rewrite_ok(CommandTag commandTag);
56 extern CommandTag GetCommandTagEnum(const char *tagname);
57
58 #endif /* CMDTAG_H */
59