Age Owner TLA Line data Source code
1 : /*-------------------------------------------------------------------------
2 : *
3 : * cmdtag.h
4 : * Declarations for commandtag names and enumeration.
5 : *
6 : * Portions Copyright (c) 1996-2023, 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 : /* buffer size required for command completion tags */
17 : #define COMPLETION_TAG_BUFSIZE 64
18 :
19 : #define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \
20 : tag,
21 :
22 : typedef enum CommandTag
23 : {
24 : #include "tcop/cmdtaglist.h"
25 : COMMAND_TAG_NEXTTAG
26 : } CommandTag;
27 :
28 : #undef PG_CMDTAG
29 :
30 : typedef struct QueryCompletion
31 : {
32 : CommandTag commandTag;
33 : uint64 nprocessed;
34 : } QueryCompletion;
35 :
36 :
37 : static inline void
1133 alvherre 38 GIC 58228 : SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag,
39 : uint64 nprocessed)
1133 alvherre 40 ECB : {
1133 alvherre 41 GIC 58228 : qc->commandTag = commandTag;
42 58228 : qc->nprocessed = nprocessed;
1133 alvherre 43 CBC 58228 : }
1133 alvherre 44 ECB :
45 : static inline void
1133 alvherre 46 GIC 435068 : CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src)
47 : {
1133 alvherre 48 CBC 435068 : dst->commandTag = src->commandTag;
1133 alvherre 49 GIC 435068 : dst->nprocessed = src->nprocessed;
1133 alvherre 50 CBC 435068 : }
1133 alvherre 51 ECB :
52 :
53 : extern void InitializeQueryCompletion(QueryCompletion *qc);
54 : extern const char *GetCommandTagName(CommandTag commandTag);
55 : extern const char *GetCommandTagNameAndLen(CommandTag commandTag, Size *len);
56 : extern bool command_tag_display_rowcount(CommandTag commandTag);
57 : extern bool command_tag_event_trigger_ok(CommandTag commandTag);
58 : extern bool command_tag_table_rewrite_ok(CommandTag commandTag);
59 : extern CommandTag GetCommandTagEnum(const char *commandname);
60 : extern Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc,
61 : bool nameonly);
62 :
63 : #endif /* CMDTAG_H */
|