NCBI C++ ToolKit
token1.c
Go to the documentation of this file.

Go to the SVN repository for this file.

1 done = 0;
2 
3  /* see what "result" tokens we have. a "result" in ct-lib terms also */
4  /* includes row data. Some result types always get reported back to */
5  /* the calling program, others are only reported back if the relevant */
6  /* config flag is set. */
7 
8 while (!done) {
9 
10  tdsret = tds_process_tokens(tds, &res_type, NULL, TDS_TOKEN_RESULTS);
11 
12  switch (tdsret) {
13 
14  case TDS_SUCCESS:
15 
16  cmd->curr_result_type = res_type;
17 
18  switch (res_type) {
20  case TDS_ROWFMT_RESULT:
21  if (context->config.cs_expose_formats) {
22  done = 1;
23  retcode = CS_SUCCEED;
24  *result_type = res_type;
25  }
26  break;
27 
28  case TDS_COMPUTE_RESULT:
29  /* we've hit a compute data row. We have to get hold of this */
30  /* data now, as it's necessary to tie this data back to its */
31  /* result format...the user may call ct_res_info() & friends */
32  /* after getting back a compute "result". */
33 
34  tdsret = tds_process_row_tokens(tds, &rowtype);
35 
36  if (tdsret == TDS_SUCCESS) {
37  if (rowtype == TDS_COMP_ROW) {
38  cmd->row_prefetched = 1;
39  retcode = CS_SUCCEED;
40  } else {
41  /* this couldn't really happen, but... */
42  retcode = CS_FAIL;
43  }
44  } else
45  retcode = CS_FAIL;
46  done = 1;
47  *result_type = res_type;
48  break;
49 
50  case TDS_DONE_RESULT:
53 
54  /* there's a distinction in ct-library */
55  /* depending on whether a command returned */
56  /* results or not... */
57 
58  if (tds->res_info)
59  *result_type = CS_CMD_DONE;
60  else
61  *result_type = CS_CMD_SUCCEED;
62 
63  retcode = CS_SUCCEED;
64  done = 1;
65  break;
66 
67 
68  default:
69  retcode = CS_SUCCEED;
70  *result_type = res_type;
71  done = 1;
72  break;
73  }
74  break;
75 
77  done = 1;
78  retcode = CS_END_RESULTS;
79  break;
80  case TDS_FAIL:
81  done = 1;
82  retcode = CS_FAIL;
83  break;
84  }
85 }
static TDSSOCKET * tds
Definition: collations.c:37
#define CS_CMD_DONE
Definition: cspublic.h:436
#define CS_CMD_SUCCEED
Definition: cspublic.h:437
#define CS_FAIL
Definition: cspublic.h:41
#define CS_SUCCEED
Definition: cspublic.h:40
#define CS_END_RESULTS
Definition: cspublic.h:56
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
#define NULL
Definition: ncbistd.hpp:225
#define tds_process_tokens
int row_prefetched
Definition: ctlib.h:229
int curr_result_type
Definition: ctlib.h:230
TDSRESULTINFO * res_info
Definition: tds.h:1264
#define TDS_FAIL
Definition: tds.h:204
#define TDS_DONEPROC_RESULT
Definition: tds.h:228
#define TDS_ROWFMT_RESULT
Definition: tds.h:224
@ TDS_TOKEN_RESULTS
Definition: tds.h:261
#define TDS_DONE_RESULT
Definition: tds.h:227
#define TDS_NO_MORE_RESULTS
Definition: tds.h:202
#define TDS_COMPUTEFMT_RESULT
Definition: tds.h:225
#define TDS_COMPUTE_RESULT
Definition: tds.h:220
#define TDS_SUCCESS
Definition: tds.h:203
#define TDS_DONEINPROC_RESULT
Definition: tds.h:229
done
Definition: token1.c:1
Modified on Tue Dec 05 02:06:10 2023 by modify_doxy.py rev. 669887