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, ...);

 

ID_D1

0

777

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