Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*-------------------------------------------------------------------------
 *
 * cmdtag.h
 *    Declarations for commandtag names and enumeration.
 *
 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/tcop/cmdtag.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef CMDTAG_H
#define CMDTAG_H
 
/* buffer size required for command completion tags */
#define COMPLETION_TAG_BUFSIZE  64
 
#define PG_CMDTAG(tag, name, evtrgok, rwrok, rowcnt) \
    tag,
 
typedef enum CommandTag
{
#include "tcop/cmdtaglist.h"
} CommandTag;
 
#undef PG_CMDTAG
 
typedef struct QueryCompletion
{
    CommandTag  commandTag;
    uint64      nprocessed;
    /* [PG_CUSTOM: 1C_DML_EXPLAIN] Число реально обработанных DML-строк передаётся в EXPLAIN/completion tag для 1С. */
    bool        preserve_nprocessed;
} QueryCompletion;
 
 
static inline void
SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag,
                   uint64 nprocessed)
{
    qc->commandTag = commandTag;
    qc->nprocessed = nprocessed;
    /* [PG_CUSTOM: 1C_DML_EXPLAIN] Число реально обработанных DML-строк передаётся в EXPLAIN/completion tag для 1С. */
    qc->preserve_nprocessed = false;
}
 
static inline void
CopyQueryCompletion(QueryCompletion *dst, const QueryCompletion *src)
{
    dst->commandTag = src->commandTag;
    dst->nprocessed = src->nprocessed;
    /* [PG_CUSTOM: 1C_DML_EXPLAIN] BEGIN: Число реально обработанных DML-строк передаётся в EXPLAIN/completion tag для 1С. */
    dst->preserve_nprocessed = src->preserve_nprocessed;
}
 
static inline void
SetQueryCompletionPreserveNprocessed(QueryCompletion *qc,
                                     CommandTag commandTag,
                                     uint64 nprocessed)
{
    SetQueryCompletion(qc, commandTag, nprocessed);
    qc->preserve_nprocessed = true;
    /* [PG_CUSTOM: 1C_DML_EXPLAIN] END */
}
 
 
extern void InitializeQueryCompletion(QueryCompletion *qc);
extern const char *GetCommandTagName(CommandTag commandTag);
extern const char *GetCommandTagNameAndLen(CommandTag commandTag, Size *len);
extern bool command_tag_display_rowcount(CommandTag commandTag);
extern bool command_tag_event_trigger_ok(CommandTag commandTag);
extern bool command_tag_table_rewrite_ok(CommandTag commandTag);
extern CommandTag GetCommandTagEnum(const char *commandname);
extern Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc,
                                       bool nameonly);
 
#endif                          /* CMDTAG_H */