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

Function assignVariables

src/bin/pgbench/pgbench.c:1756–1790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1754}
1755
1756static char *
1757assignVariables(CState *st, char *sql)
1758{
1759 char *p,
1760 *name,
1761 *val;
1762
1763 p = sql;
1764 while ((p = strchr(p, ':')) != NULL)
1765 {
1766 int eaten;
1767
1768 name = parseVariable(p, &eaten);
1769 if (name == NULL)
1770 {
1771 while (*p == ':')
1772 {
1773 p++;
1774 }
1775 continue;
1776 }
1777
1778 val = getVariable(st, name);
1779 free(name);
1780 if (val == NULL)
1781 {
1782 p++;
1783 continue;
1784 }
1785
1786 p = replaceVariable(&sql, p, eaten, val);
1787 }
1788
1789 return sql;
1790}
1791
1792static void
1793getQueryParams(CState *st, const Command *command, const char **params)

Callers 1

sendCommandFunction · 0.85

Calls 3

parseVariableFunction · 0.85
getVariableFunction · 0.85
replaceVariableFunction · 0.85

Tested by

no test coverage detected