ex11.c

来自「Linux下的操作oracle数据库的连接库」· C语言 代码 · 共 39 行

C
39
字号
/* $Id: ex11.c,v 1.4 2002/08/24 12:54:47 kpoitschke Exp $ */#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;       /* statement handle */  int status;                   /* return code of sqlo_... */  char name[64];                /* output variable for NAME */  short name_rlen;              /* returned length of NAME */  short name_ind;               /* NULL indicator for NAME */  short sal_ind;                /* NULL indicator for SALARY */  double salary = min_salary;   /* input variable for SALARY */  sth = prepare_cursor(dbh, &salary); /* see ex10.c */  /* define output */  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;}/* $Id: ex11.c,v 1.4 2002/08/24 12:54:47 kpoitschke Exp $ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?