Utility Functions and C Language Reference > Utility Functions: C Language (lr_) > Alphabetical Listing > lr_db_getValue

lr_db_getValue

Retrieves a value from a dataset.

C Language

int lr_db_getValue( "StepName=<step_name>", "DatasetName=<dataset_name>", "Column=<column>", "Row=<row>", "OutParam=<output_parm>", LAST );
Example: lr_db_getValue Database Functions

Arguments

Name Comments
StepName The name of the step, as it appears in the test tree. Any text can be used.
DatasetName Logical name for the dataset specified in lr_db_executeSQLStatement.
Column The name of the column in the dataset from which to retrieve the value.
Row Sets the dataset cursor to the specifed row before fetching data. One of:
  • The row number (1-based)

  • current - does not move the cursor

  • next - sets the cursor to the next row

OutParam The name of the parameter that will contain the value.
LAST This delimiter marks the end of the argument list.

The lr_db_getValue function retrieves a value from the dataset created by an lr_db_executeSQLStatement.

This function is supported only under the Windows operating system.

When this function reaches the last row of the dataset, the row is undefined. If Row=next is specified the next time lr_db_getValue is called, the script continues to the first record without issuing any errors.

This function does not support the print or output of binary data. Binary values retrieved from the dataset appear as <binary_data>.

Return Values

This function returns LR_PASS on success, LR_FAIL on failure, and -1 when either the dataset cursor is at the last record of the dataset or the first time the function is called.

Parameterization

All string arguments (char type) can be parameterized using standard parameterization.