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

Function putVariable

src/bin/pgbench/pgbench.c:1649–1668  ·  view source on GitHub ↗

Assign a string value to a variable, creating it if need be */ Returns false on failure (bad name) */

Source from the content-addressed store, hash-verified

1647/* Assign a string value to a variable, creating it if need be */
1648/* Returns false on failure (bad name) */
1649static bool
1650putVariable(CState *st, const char *context, char *name, const char *value)
1651{
1652 Variable *var;
1653 char *val;
1654
1655 var = lookupCreateVariable(st, context, name);
1656 if (!var)
1657 return false;
1658
1659 /* dup then free, in case value is pointing at this variable */
1660 val = pg_strdup(value);
1661
1662 if (var->svalue)
1663 free(var->svalue);
1664 var->svalue = val;
1665 var->value.type = PGBT_NO_VALUE;
1666
1667 return true;
1668}
1669
1670/* Assign a value to a variable, creating it if need be */
1671/* Returns false on failure (bad name) */

Callers 2

readCommandResponseFunction · 0.85
mainFunction · 0.85

Calls 2

lookupCreateVariableFunction · 0.85
pg_strdupFunction · 0.85

Tested by

no test coverage detected