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

Function GetVariable

src/bin/psql/variables.c:70–92  ·  view source on GitHub ↗

* Get string value of variable, or NULL if it's not defined. * * Note: result is valid until variable is next assigned to. */

Source from the content-addressed store, hash-verified

68 * Note: result is valid until variable is next assigned to.
69 */
70const char *
71GetVariable(VariableSpace space, const char *name)
72{
73 struct _variable *current;
74
75 if (!space)
76 return NULL;
77
78 for (current = space->next; current; current = current->next)
79 {
80 int cmp = strcmp(current->name, name);
81
82 if (cmp == 0)
83 {
84 /* this is correct answer when value is NULL, too */
85 return current->value;
86 }
87 if (cmp > 0)
88 break; /* it's not there */
89 }
90
91 return NULL;
92}
93
94/*
95 * Try to interpret "value" as a boolean value, and if successful,

Callers 3

initializeInputFunction · 0.85
psql_get_variableFunction · 0.85
get_promptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected