PostgreSQL Source Code  git master
cmdtag.h File Reference
#include "tcop/cmdtaglist.h"
Include dependency graph for cmdtag.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  QueryCompletion
 

Macros

#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt)   tag,
 

Typedefs

typedef enum CommandTag CommandTag
 
typedef struct QueryCompletion QueryCompletion
 

Enumerations

enum  CommandTag { COMMAND_TAG_NEXTTAG }
 

Functions

static void SetQueryCompletion (QueryCompletion *qc, CommandTag commandTag, uint64 nprocessed)
 
static void CopyQueryCompletion (QueryCompletion *dst, const QueryCompletion *src)
 
void InitializeQueryCompletion (QueryCompletion *qc)
 
const char * GetCommandTagName (CommandTag commandTag)
 
bool command_tag_display_rowcount (CommandTag commandTag)
 
bool command_tag_event_trigger_ok (CommandTag commandTag)
 
bool command_tag_table_rewrite_ok (CommandTag commandTag)
 
CommandTag GetCommandTagEnum (const char *tagname)
 

Macro Definition Documentation

◆ PG_CMDTAG

#define PG_CMDTAG (   tag,
  name,
  evtrgok,
  rwrok,
  rowcnt 
)    tag,

Definition at line 17 of file cmdtag.h.

Typedef Documentation

◆ CommandTag

typedef enum CommandTag CommandTag

◆ QueryCompletion

Enumeration Type Documentation

◆ CommandTag

enum CommandTag
Enumerator
COMMAND_TAG_NEXTTAG 

Definition at line 20 of file cmdtag.h.

Function Documentation

◆ command_tag_display_rowcount()

bool command_tag_display_rowcount ( CommandTag  commandTag)

Definition at line 51 of file cmdtag.c.

References CommandTagBehavior::display_rowcount.

Referenced by CopyQueryCompletion(), and EndCommand().

52 {
53  return tag_behavior[commandTag].display_rowcount;
54 }
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31
const bool display_rowcount
Definition: cmdtag.c:25

◆ command_tag_event_trigger_ok()

bool command_tag_event_trigger_ok ( CommandTag  commandTag)

Definition at line 57 of file cmdtag.c.

References CommandTagBehavior::event_trigger_ok.

Referenced by CopyQueryCompletion(), EventTriggerCommonSetup(), and validate_ddl_tags().

58 {
59  return tag_behavior[commandTag].event_trigger_ok;
60 }
const bool event_trigger_ok
Definition: cmdtag.c:23
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31

◆ command_tag_table_rewrite_ok()

bool command_tag_table_rewrite_ok ( CommandTag  commandTag)

Definition at line 63 of file cmdtag.c.

References CommandTagBehavior::table_rewrite_ok.

Referenced by CopyQueryCompletion(), EventTriggerCommonSetup(), and validate_table_rewrite_tags().

64 {
65  return tag_behavior[commandTag].table_rewrite_ok;
66 }
const bool table_rewrite_ok
Definition: cmdtag.c:24
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31

◆ CopyQueryCompletion()

static void CopyQueryCompletion ( QueryCompletion dst,
const QueryCompletion src 
)
inlinestatic

◆ GetCommandTagEnum()

CommandTag GetCommandTagEnum ( const char *  tagname)

Definition at line 74 of file cmdtag.c.

References lengthof, CommandTagBehavior::name, pg_strcasecmp(), and tag_behavior.

Referenced by CopyQueryCompletion(), DecodeTextArrayToBitmapset(), validate_ddl_tags(), and validate_table_rewrite_tags().

75 {
76  const CommandTagBehavior *base,
77  *last,
78  *position;
79  int result;
80 
81  if (commandname == NULL || *commandname == '\0')
82  return CMDTAG_UNKNOWN;
83 
84  base = tag_behavior;
85  last = tag_behavior + lengthof(tag_behavior) - 1;
86  while (last >= base)
87  {
88  position = base + ((last - base) >> 1);
89  result = pg_strcasecmp(commandname, position->name);
90  if (result == 0)
91  return (CommandTag) (position - tag_behavior);
92  else if (result < 0)
93  last = position - 1;
94  else
95  base = position + 1;
96  }
97  return CMDTAG_UNKNOWN;
98 }
CommandTag
Definition: cmdtag.h:20
const char * name
Definition: cmdtag.c:22
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
#define lengthof(array)
Definition: c.h:668
const CommandTagBehavior tag_behavior[COMMAND_TAG_NEXTTAG]
Definition: cmdtag.c:31

◆ GetCommandTagName()

const char* GetCommandTagName ( CommandTag  commandTag)

◆ InitializeQueryCompletion()

void InitializeQueryCompletion ( QueryCompletion qc)

Definition at line 38 of file cmdtag.c.

References QueryCompletion::commandTag, and QueryCompletion::nprocessed.

Referenced by _SPI_execute_plan(), CopyQueryCompletion(), FillPortalStore(), and PortalRun().

39 {
40  qc->commandTag = CMDTAG_UNKNOWN;
41  qc->nprocessed = 0;
42 }
uint64 nprocessed
Definition: cmdtag.h:31
CommandTag commandTag
Definition: cmdtag.h:30

◆ SetQueryCompletion()

static void SetQueryCompletion ( QueryCompletion qc,
CommandTag  commandTag,
uint64  nprocessed 
)
inlinestatic