#include <stdio.h>
#include <stdlib.h>
#include "examples.h"
sqlo_stmt_handle_t do_select2(sqlo_db_handle_t dbh, double min_salary)
{
sqlo_stmt_handle_t sth;
int status;
char name[64];
short name_rlen;
short name_ind;
short sal_ind;
double salary = min_salary;
sth = prepare_cursor(dbh, &salary);
if (SQLO_SUCCESS !=
(sqlo_define_by_pos(sth, 1, SQLOT_STR, name, sizeof(name), &name_ind, &name_rlen, 0)) ||
(sqlo_define_by_pos(sth, 2, SQLOT_FLT, &salary, sizeof(salary), &sal_ind, 0, 0))) {
error_exit(dbh, "sqlo_define_by_pos");
}
status = sqlo_execute(sth, 0);
if ( 0 > status)
error_exit(dbh, "sqlo_execute");
while ( SQLO_SUCCESS == (status = sqlo_fetch(sth, 1))) {
printf("Name=%-8s Salary=%6.2f\n", name, salary);
}
if (status != SQLO_NO_DATA)
error_exit(dbh, "sqlo_fetch");
return sth;
}