Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 2.23 KB

File metadata and controls

53 lines (43 loc) · 2.23 KB

putVariableInt

Location

src/bin/pgbench/pgbench.c:1871-1888

Overview

Assigns an integer value to a pgbench variable, creating the variable if it doesn't already exist.

Definition

static bool putVariableInt(Variables *variables, const char *context, char *name, int64 value)

Detailed Description

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.

Parameters

  • variables: Pointer to the Variables structure containing all pgbench variables
  • context: String specifying the context/scope where the variable should be created or found
  • name: Name of the variable to set (will be created if it doesn't exist)
  • value: 64-bit integer value to assign to the variable

Dependencies

Notes and Other Information

  • 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

Simplified Source

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);
}