src/bin/pgbench/pgbench.c:1871-1888
Assigns an integer value to a pgbench variable, creating the variable if it doesn't already exist.
static bool putVariableInt(Variables *variables, const char *context, char *name, int64 value)This function provides a convenient wrapper for assigning integer values to pgbench variables. It creates a PgBenchValue structure with the specified integer value and delegates the actual assignment to putVariableValue. This abstraction simplifies the process of storing integer values in the variable system without requiring callers to manually construct PgBenchValue structures.
variables: Pointer to the Variables structure containing all pgbench variablescontext: String specifying the context/scope where the variable should be created or foundname: Name of the variable to set (will be created if it doesn't exist)value: 64-bit integer value to assign to the variable
- Functions called/Symbols referenced:
- setIntValue
- putVariableValue
- Variables (type)
- PgBenchValue (type)
- Called from:
- runShellCommand (src/bin/pgbench/pgbench.c:3016)
- main (src/bin/pgbench/pgbench.c:7264, 7276, 7286, 7295)
- Returns false if the variable name is invalid or creation fails
- Uses setIntValue to properly initialize the PgBenchValue structure with integer type
- Part of pgbench's variable management system, providing type-specific convenience functions
- Commonly used in the main function to set various configuration and status variables
- Delegates to putVariableValue for the actual storage operation
static bool
putVariableInt(Variables *variables, const char *context, char *name,
int64 value)
{
PgBenchValue val;
// Create integer value and delegate to putVariableValue
setIntValue(&val, value);
return putVariableValue(variables, context, name, &val);
}