background image
<< the next available number | To use the newly assigned value of the placeholder >>
<< the next available number | To use the newly assigned value of the placeholder >>

To enable the script to run

Creating Vuser Scripts
Chapter 10, page 184
Database Vuser Scripts · Correlating Database Statements
In
If you repeat the recorded query in its current form, the script would attempt to
insert the new employee with the same employee number, 5. The script would fail,
since the
empno
column has a Unique constraint.
To enable the script to run, you need to replace the constant with a variable. This
variable, saved dynamically during script execution, is used for the next query. Now,
when you get the row count during execution, using
select count(*)
,
the current row
count is returned, not the count generated during execution. You save the variable
dynamically by adding lrd_save_col before the fetch statement.
The following changes, indicated in bold, were made to the sample script:
/* Retrieve the number of records in the employees table */
lrd_stmt(Csr1, "select count(*) from employees", -1, 1 /*Deferred*/, 2 /*Ora
V7*/, 0);
lrd_bind_col(Csr1, 1, &COUNT_D1, 0, 0);
lrd_exec(Csr1, 0, 0, 0, 0, 0);
lrd_save_col(Csr1, 1, 1, 0, "row_cnt");
lrd_fetch(Csr1, 1, 1, 0, PrintRow2, 0);