Listing 1. Client Process Code Fragment

res = BSQLQueryDB (s, "select - from phonebook");
if (res != NULL) {
  fprintf (stdout, " --> '%s'\n", res->errcode);
  if (!res->resultcode) {
     BSQLFreeResult (res);
     exit_nicely (s);
  }
  fprintf (stdout, 
     "\nDisplaying Results of Select\n\n");
  for (n=0L; n<BSQLnfields(res); n++)
     fprintf (stdout, "%-20s ", 
        BSQLFieldName (res, n));
  fprintf (stdout, "\n");

  for (j=0L; j<70L; j++)
   fprintf (stdout, "-");

  for (i=0L; i<BSQLntuples(res); i++) {
   fprintf (stdout, "\n");
   for (n=0L; n<BSQLnfields(res); n++)
      fprintf (stdout, "%-20s ", 
         BSQLFieldValue (res, i, n));
  }
  fprintf (stdout, "\n\n");
  BSQLFreeResult (res);
}