|
Example: lr_eval_string- In the following example, lr_eval_string replaces the parameter row_cnt with its current value. This value is sent to the LoadRunner output window or Application Management agent log file using lr_output_message.
- lrd_stmt(Csr1, "select count(*) from employee", -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);
- lr_output_message("value : %s", lr_eval_string("The row count is: {row_cnt}"));
复制代码 Example: lr_save_string
- In the following example, lr_save_string assigns 777 to a parameter emp_id. This parameter is then used in another query.
- lrd_stmt(Csr1, "select id from employees where name='John'", ...);
- lrd_bind_col(Csr1,1,&ID_D1,...);
- lrd_exec(Csr1, ...);
- lrd_fetch(Csr1, 1, ...);
- lr_save_string("777", "emp_id");
- lrd_stmt(Csr1,"select salary from payment where id ='{emp_id}'",...);
- lrd_exec(Csr1, 0, 0, 0, 0, 0);
复制代码
[ 本帖最后由 cebio 于 2009-11-29 21:47 编辑 ] |
|