⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex7.c

📁 Linux下的操作oracle数据库的连接库
💻 C
字号:
/* $Id: ex7.c,v 1.6 2004/01/03 16:48:19 kpoitschke Exp $ */#include <stdio.h>#include <stdlib.h>#include "examples.h"int do_select(sqlo_db_handle_t dbh, double min_income){  sqlo_stmt_handle_t sth;       /* statement handle */  int status;                   /* status of sqlo calls */  unsigned int i,j;                      /* loop counter */  const char ** v;              /* values */  const char ** col_names;      /* column names */  CONST unsigned int *nl;       /* column name lengths */  CONST unsigned short *vl;     /* value lengths */  unsigned int nc;              /* number of columns */  sth = reopen_cursor(dbh, min_income); /* see example of sqlo_reopen (ex6.c) */  /* get the output column names */  status = sqlo_ocol_names2(sth, &nc, &col_names);  if (0 > status) {    error_exit(dbh, "sqlo_ocol_names2");  }  /* get the output column name lengths */  nl = sqlo_ocol_name_lens(sth, NULL);  printf("Employees with SAL > %-8.2f:\n", min_income);  /* print the header */  for (i = 0; i < nc; ++i)    printf("%-*s ", nl[i], col_names[i]);  printf("\n");  for (i = 0; i < nc; ++i) {    for (j = 0; j < nl[i]; ++j) {      putchar('-');    }    putchar('+');  }  putchar('\n');  /* fetch the data */  while ( SQLO_SUCCESS == (status = (sqlo_fetch(sth, 1)))) {        /* get one record */    v = sqlo_values(sth, NULL, 1);    /* get the length of the data items */    vl = sqlo_value_lens(sth, NULL);    /* print the column values */    for (i = 0; i < nc; ++i)      printf("%-*s ", (vl[i] > nl[i] ? vl[i] : nl[i]), v[i]);    printf("\n");  }  if (0 > status) {    error_exit(dbh, "sqlo_fetch");  }  if ( SQLO_SUCCESS != sqlo_close(sth))    error_exit(dbh, "sqlo_close");  return 1;}/* $Id: ex7.c,v 1.6 2004/01/03 16:48:19 kpoitschke Exp $ */

⌨️ 快捷键说明

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