MCPcopy Create free account
hub / github.com/apache/cloudberry / GetCommandTagEnum

Function GetCommandTagEnum

src/backend/tcop/cmdtag.c:73–98  ·  view source on GitHub ↗

* Search CommandTag by name * * Returns CommandTag, or CMDTAG_UNKNOWN if not recognized */

Source from the content-addressed store, hash-verified

71 * Returns CommandTag, or CMDTAG_UNKNOWN if not recognized
72 */
73CommandTag
74GetCommandTagEnum(const char *commandname)
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}

Callers 5

SendFtsResponseFunction · 0.85
validate_ddl_tagsFunction · 0.85

Calls 1

pg_strcasecmpFunction · 0.85

Tested by

no test coverage detected