PostgreSQL Source Code  git master
cmdtag.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * cmdtag.h
4  * Declarations for commandtag names and enumeration.
5  *
6  * Portions Copyright (c) 1996-2024, 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"
27 
28 #undef PG_CMDTAG
29 
30 typedef struct QueryCompletion
31 {
33  uint64 nprocessed;
35 
36 
37 static inline void
39  uint64 nprocessed)
40 {
41  qc->commandTag = commandTag;
42  qc->nprocessed = nprocessed;
43 }
44 
45 static inline void
47 {
48  dst->commandTag = src->commandTag;
49  dst->nprocessed = src->nprocessed;
50 }
51 
52 
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 */
size_t Size
Definition: c.h:605
void InitializeQueryCompletion(QueryCompletion *qc)
Definition: cmdtag.c:40
const char * GetCommandTagNameAndLen(CommandTag commandTag, Size *len)
Definition: cmdtag.c:53
struct QueryCompletion QueryCompletion
static void SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag, uint64 nprocessed)
Definition: cmdtag.h:38
static void CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src)
Definition: cmdtag.h:46
CommandTag GetCommandTagEnum(const char *commandname)
Definition: cmdtag.c:83
bool command_tag_event_trigger_ok(CommandTag commandTag)
Definition: cmdtag.c:66
CommandTag
Definition: cmdtag.h:23
@ COMMAND_TAG_NEXTTAG
Definition: cmdtag.h:25
bool command_tag_table_rewrite_ok(CommandTag commandTag)
Definition: cmdtag.c:72
bool command_tag_display_rowcount(CommandTag commandTag)
Definition: cmdtag.c:60
Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc, bool nameonly)
Definition: cmdtag.c:121
const char * GetCommandTagName(CommandTag commandTag)
Definition: cmdtag.c:47
const void size_t len
uint64 nprocessed
Definition: cmdtag.h:33
CommandTag commandTag
Definition: cmdtag.h:32