codekingpro/portable-devtools
114k
1/*-------------------------------------------------------------------------2 *3 * cmdtag.h4 * Declarations for commandtag names and enumeration.5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/tcop/cmdtag.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef CMDTAG_H14#define CMDTAG_H15 16/* buffer size required for command completion tags */17#define COMPLETION_TAG_BUFSIZE 6418 19#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \20 tag,21 22typedef enum CommandTag23{24#include "tcop/cmdtaglist.h"25 COMMAND_TAG_NEXTTAG26} CommandTag;27 28#undef PG_CMDTAG29 30typedef struct QueryCompletion31{32 CommandTag commandTag;33 uint64 nprocessed;34} QueryCompletion;35 36 37static inline void38SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag,39 uint64 nprocessed)40{41 qc->commandTag = commandTag;42 qc->nprocessed = nprocessed;43}44 45static inline void46CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src)47{48 dst->commandTag = src->commandTag;49 dst->nprocessed = src->nprocessed;50}51 52 53extern void InitializeQueryCompletion(QueryCompletion *qc);54extern const char *GetCommandTagName(CommandTag commandTag);55extern const char *GetCommandTagNameAndLen(CommandTag commandTag, Size *len);56extern bool command_tag_display_rowcount(CommandTag commandTag);57extern bool command_tag_event_trigger_ok(CommandTag commandTag);58extern bool command_tag_table_rewrite_ok(CommandTag commandTag);59extern CommandTag GetCommandTagEnum(const char *commandname);60extern Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc,61 bool nameonly);62 63#endif /* CMDTAG_H */64 