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

Go to the SVN repository for this file.

1 #include <config.h>
2 
3 #include <stdio.h>
4 
5 #if HAVE_STDLIB_H
6 #include <stdlib.h>
7 #endif /* HAVE_STDLIB_H */
8 
9 #if HAVE_STRING_H
10 #include <string.h>
11 #endif /* HAVE_STRING_H */
12 
13 #include <ctpublic.h>
14 #include "common.h"
15 
16 #include <common/test_assert.h>
17 
18 #define MAX(X,Y) (((X) > (Y)) ? (X) : (Y))
19 #define MIN(X,Y) (((X) < (Y)) ? (X) : (Y))
20 
21 static char software_version[] = "$Id: rpc_ct_setparam.c 94026 2021-06-15 18:41:00Z ucko $";
23 
29 
30 typedef struct _ex_column_data
31 {
33  CS_CHAR *value;
35 }
37 
38 /* Testing: array binding of result set */
39 int
40 main(int argc, char *argv[])
41 {
42  CS_CONTEXT *ctx;
44  CS_COMMAND *cmd;
45  int verbose = 0;
46 
47  CS_RETCODE ret;
48 
49  CS_INT datalength;
50  CS_SMALLINT nullind;
51  CS_SMALLINT notnullind;
52 
53  CS_CHAR cmdbuf[4096];
54 
55  CS_DATAFMT datafmt;
56  CS_DATAFMT srcfmt;
57  CS_DATAFMT destfmt;
58  CS_INT intvar;
59  CS_SMALLINT smallintvar;
60  CS_FLOAT floatvar;
61  CS_MONEY moneyvar;
62  CS_BINARY binaryvar;
63  char moneystring[10];
64  char rpc_name[15];
65  CS_INT destlen;
66 
67 
68 
69  fprintf(stdout, "%s: submit a stored procedure using ct_setparam \n", __FILE__);
70  if (verbose) {
71  fprintf(stdout, "Trying login\n");
72  }
73  ret = try_ctlogin(&ctx, &conn, &cmd, verbose);
74  if (ret != CS_SUCCEED) {
75  fprintf(stderr, "Login failed\n");
76  return 1;
77  }
78 
80 
82 
83  /* do not test error */
84  ret = run_command(cmd, "IF EXISTS(SELECT * FROM SYSOBJECTS WHERE name = 'sample_rpc' AND type = 'P') DROP PROCEDURE sample_rpc");
85 
86  strcpy(cmdbuf, "create proc sample_rpc (@intparam int, \
87  @sintparam smallint output, @floatparam float output, \
88  @moneyparam money output, \
89  @dateparam datetime output, @charparam char(20) output, \
90  @binaryparam varbinary(2000) output) \
91  as ");
92 
93  strcat(cmdbuf, "select @intparam, @sintparam, @floatparam, @moneyparam, \
94  @dateparam, @charparam, @binaryparam \
95  select @sintparam = @sintparam + @intparam \
96  select @floatparam = @floatparam + @intparam \
97  select @moneyparam = @moneyparam + convert(money, @intparam) \
98  select @dateparam = getdate() \
99  select @charparam = \'The char parameters\' \
100  select @binaryparam = @binaryparam \
101  print \'This is the message printed out by sample_rpc.\'");
102 
103  ret = run_command(cmd, cmdbuf);
104 
105  if (ret != CS_SUCCEED) {
106  fprintf(stderr, "create proc failed\n");
107  return 1;
108  }
109 
110  /*
111  * Assign values to the variables used for parameter passing.
112  */
113 
114  intvar = 2;
115  smallintvar = 234;
116  floatvar = 0.12;
117  binaryvar = (CS_BINARY) 0xff;
118  strcpy(rpc_name, "sample_rpc");
119  strcpy(moneystring, "300.90");
120 
121  /*
122  * Clear and setup the CS_DATAFMT structures used to convert datatypes.
123  */
124 
125  memset(&srcfmt, 0, sizeof(CS_DATAFMT));
126  srcfmt.datatype = CS_CHAR_TYPE;
127  srcfmt.maxlength = (CS_INT) strlen(moneystring);
128  srcfmt.precision = 5;
129  srcfmt.scale = 2;
130  srcfmt.locale = NULL;
131 
132  memset(&destfmt, 0, sizeof(CS_DATAFMT));
133  destfmt.datatype = CS_MONEY_TYPE;
134  destfmt.maxlength = sizeof(CS_MONEY);
135  destfmt.precision = 5;
136  destfmt.scale = 2;
137  destfmt.locale = NULL;
138 
139  /*
140  * Convert the string representing the money value
141  * to a CS_MONEY variable. Since this routine does not have the
142  * context handle, we use the property functions to get it.
143  */
145  fprintf(stderr, "ct_cmd_props() failed");
146  return 1;
147  }
149  fprintf(stderr, "ct_con_props() failed");
150  return 1;
151  }
152  ret = cs_convert(ctx, &srcfmt, (CS_VOID *) moneystring, &destfmt, &moneyvar, &destlen);
153  if (ret != CS_SUCCEED) {
154  fprintf(stderr, "cs_convert() failed");
155  return 1;
156  }
157 
158  /*
159  * Send the RPC command for our stored procedure.
160  */
161  if ((ret = ct_command(cmd, CS_RPC_CMD, rpc_name, CS_NULLTERM, CS_NO_RECOMPILE)) != CS_SUCCEED) {
162  fprintf(stderr, "ct_command(CS_RPC_CMD) failed");
163  return 1;
164  }
165 
166  nullind = -1;
167  notnullind = 0;
168  /*
169  * Clear and setup the CS_DATAFMT structure, then pass
170  * each of the parameters for the RPC.
171  */
172  memset(&datafmt, 0, sizeof(datafmt));
173  strcpy(datafmt.name, "@intparam");
174  datafmt.namelen = CS_NULLTERM;
175  datafmt.datatype = CS_INT_TYPE;
176  datafmt.maxlength = CS_UNUSED;
177  datafmt.status = CS_INPUTVALUE;
178  datafmt.locale = NULL;
179 
180  datalength = CS_SIZEOF(CS_INT);
181 
182  if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & intvar, &datalength, &notnullind)) != CS_SUCCEED) {
183  fprintf(stderr, "ct_setparam(int) failed");
184  return 1;
185  }
186 
187  strcpy(datafmt.name, "@sintparam");
188  datafmt.namelen = CS_NULLTERM;
189  datafmt.datatype = CS_SMALLINT_TYPE;
190  datafmt.maxlength = 255;
191  datafmt.status = CS_RETURN;
192  datafmt.locale = NULL;
193 
194  datalength = CS_SIZEOF(CS_SMALLINT);
195 
196  if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & smallintvar, &datalength, &notnullind)) != CS_SUCCEED) {
197  fprintf(stderr, "ct_setparam(smallint) failed");
198  return 1;
199  }
200 
201  strcpy(datafmt.name, "@floatparam");
202  datafmt.namelen = CS_NULLTERM;
203  datafmt.datatype = CS_FLOAT_TYPE;
204  datafmt.maxlength = 255;
205  datafmt.status = CS_RETURN;
206  datafmt.locale = NULL;
207 
208  datalength = CS_SIZEOF(CS_FLOAT);
209 
210  if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & floatvar, &datalength, &notnullind)) != CS_SUCCEED) {
211  fprintf(stderr, "ct_setparam(float) failed");
212  return 1;
213  }
214 
215 
216  strcpy(datafmt.name, "@moneyparam");
217  datafmt.namelen = CS_NULLTERM;
218  datafmt.datatype = CS_MONEY_TYPE;
219  datafmt.maxlength = 255;
220  datafmt.status = CS_RETURN;
221  datafmt.locale = NULL;
222 
223  datalength = CS_SIZEOF(CS_MONEY);
224 
225  if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & moneyvar, &datalength, &notnullind)) != CS_SUCCEED) {
226  fprintf(stderr, "ct_setparam(money) failed");
227  return 1;
228  }
229 
230  strcpy(datafmt.name, "@dateparam");
231  datafmt.namelen = CS_NULLTERM;
232  datafmt.datatype = CS_DATETIME4_TYPE;
233  datafmt.maxlength = 255;
234  datafmt.status = CS_RETURN;
235  datafmt.locale = NULL;
236 
237  /*
238  * The datetime variable is filled in by the RPC so pass NULL for
239  * the data, 0 for data length, and -1 for the indicator arguments.
240  */
241 
242  datalength = 0;
243 
244  if ((ret = ct_setparam(cmd, &datafmt, NULL, &datalength, &nullind)) != CS_SUCCEED) {
245  fprintf(stderr, "ct_setparam(datetime4) failed");
246  return 1;
247  }
248  strcpy(datafmt.name, "@charparam");
249  datafmt.namelen = CS_NULLTERM;
250  datafmt.datatype = CS_CHAR_TYPE;
251  datafmt.maxlength = 60;
252  datafmt.status = CS_RETURN;
253  datafmt.locale = NULL;
254 
255 
256  datalength = 0;
257 
258  /*
259  * The character string variable is filled in by the RPC so pass NULL
260  * for the data 0 for data length, and -1 for the indicator arguments.
261  */
262  if ((ret = ct_setparam(cmd, &datafmt, NULL, &datalength, &nullind)) != CS_SUCCEED) {
263  fprintf(stderr, "ct_setparam(char) failed");
264  return 1;
265  }
266 
267  strcpy(datafmt.name, "@binaryparam");
268  datafmt.namelen = CS_NULLTERM;
269  datafmt.datatype = CS_LONGBINARY_TYPE;
270  datafmt.maxlength = 2000;
271  datafmt.status = CS_RETURN;
272  datafmt.locale = NULL;
273 
274  datalength = CS_SIZEOF(CS_BINARY);
275  nullind = -1;
276 
277  if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & binaryvar, &datalength, &notnullind)) != CS_SUCCEED) {
278  fprintf(stderr, "ct_setparam(binary) failed");
279  return 1;
280  }
281 
282  /*
283  * Send the command to the server
284  */
285  if (ct_send(cmd) != CS_SUCCEED) {
286  fprintf(stderr, "ct_send(RPC) failed");
287  return 1;
288  }
289 
290  ret = ex_display_results(cmd);
291  if (ret != CS_SUCCEED) {
292  fprintf(stderr, "ex_display_results failed\n");
293  return 1;
294  }
295 
296  intvar = 3;
297 
298  if (ct_send(cmd) != CS_SUCCEED) {
299  fprintf(stderr, "ct_send(RPC) failed");
300  return 1;
301  }
302 
303  ret = ex_display_results(cmd);
304  if (ret != CS_SUCCEED) {
305  fprintf(stderr, "ex_display_results failed\n");
306  return 1;
307  }
308 
309  run_command(cmd, "DROP PROCEDURE sample_rpc");
310 
311  if (verbose) {
312  fprintf(stdout, "Trying logout\n");
313  }
314  ret = try_ctlogout(ctx, conn, cmd, verbose);
315  if (ret != CS_SUCCEED) {
316  fprintf(stderr, "Logout failed\n");
317  return 1;
318  }
319 
320  return 0;
321 }
322 
323 static CS_INT
325 {
326 
327 CS_RETCODE ret;
328 CS_INT res_type;
329 CS_INT num_cols;
330 EX_COLUMN_DATA *coldata;
331 CS_DATAFMT *outdatafmt;
332 CS_INT row_count = 0;
333 CS_INT rows_read;
334 CS_INT disp_len;
335 CS_SMALLINT msg_id;
336 int i, j;
337 
338  /*
339  * Process the results of the RPC.
340  */
341  while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) {
342  switch ((int) res_type) {
343  case CS_ROW_RESULT:
344  case CS_PARAM_RESULT:
345  case CS_STATUS_RESULT:
346  /*
347  * Print the result header based on the result type.
348  */
349  switch ((int) res_type) {
350  case CS_ROW_RESULT:
351  fprintf(stdout, "\nROW RESULTS\n");
352  break;
353 
354  case CS_PARAM_RESULT:
355  fprintf(stdout, "\nPARAMETER RESULTS\n");
356  break;
357 
358  case CS_STATUS_RESULT:
359  fprintf(stdout, "\nSTATUS RESULTS\n");
360  break;
361  }
362  fflush(stdout);
363 
364  /*
365  * All three of these result types are fetchable.
366  * Since the result model for rpcs and rows have
367  * been unified in the New Client-Library, we
368  * will use the same routine to display them
369  */
370 
371  /*
372  * Find out how many columns there are in this result set.
373  */
374  ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL);
375  if (ret != CS_SUCCEED) {
376  fprintf(stderr, "ct_res_info(CS_NUMDATA) failed");
377  return 1;
378  }
379 
380  /*
381  * Make sure we have at least one column
382  */
383  if (num_cols <= 0) {
384  fprintf(stderr, "ct_res_info(CS_NUMDATA) returned zero columns");
385  return 1;
386  }
387 
388  /*
389  * Our program variable, called 'coldata', is an array of
390  * EX_COLUMN_DATA structures. Each array element represents
391  * one column. Each array element will re-used for each row.
392  *
393  * First, allocate memory for the data element to process.
394  */
395  coldata = (EX_COLUMN_DATA *) malloc(num_cols * sizeof(EX_COLUMN_DATA));
396  if (coldata == NULL) {
397  fprintf(stderr, "malloc coldata failed \n");
398  return 1;
399  }
400 
401  outdatafmt = (CS_DATAFMT *) malloc(num_cols * sizeof(CS_DATAFMT));
402  if (outdatafmt == NULL) {
403  free(coldata);
404  fprintf(stderr, "malloc outdatafmt failed \n");
405  return 1;
406  }
407 
408  for (i = 0; i < num_cols; i++) {
409  ret = ct_describe(cmd, (i + 1), &outdatafmt[i]);
410  if (ret != CS_SUCCEED) {
411  fprintf(stderr, "ct_describe failed \n");
412  break;
413  }
414 
415  outdatafmt[i].maxlength = ex_display_dlen(&outdatafmt[i]) + 1;
416  outdatafmt[i].datatype = CS_CHAR_TYPE;
417  outdatafmt[i].format = CS_FMT_NULLTERM;
418 
419  coldata[i].value = (CS_CHAR *) malloc(outdatafmt[i].maxlength);
420  coldata[i].value[0] = 0;
421  if (coldata[i].value == NULL) {
422  fprintf(stderr, "malloc coldata.value failed \n");
423  break;
424  }
425 
426  ret = ct_bind(cmd, (i + 1), &outdatafmt[i], coldata[i].value, &coldata[i].valuelen,
427  & coldata[i].indicator);
428  if (ret != CS_SUCCEED) {
429  free(coldata[i].value);
430  fprintf(stderr, "ct_bind failed \n");
431  break;
432  }
433  }
434  if (ret != CS_SUCCEED) {
435  for (j = 0; j < i; j++) {
436  free(coldata[j].value);
437  }
438  free(coldata);
439  free(outdatafmt);
440  return 1;
441  }
442 
443  ex_display_header(num_cols, outdatafmt);
444 
445  while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED,
446  &rows_read)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) {
447  /*
448  * Increment our row count by the number of rows just fetched.
449  */
450  row_count = row_count + rows_read;
451 
452  /*
453  * Check if we hit a recoverable error.
454  */
455  if (ret == CS_ROW_FAIL) {
456  fprintf(stdout, "Error on row %d.\n", row_count);
457  fflush(stdout);
458  }
459 
460  /*
461  * We have a row. Loop through the columns displaying the
462  * column values.
463  */
464  for (i = 0; i < num_cols; i++) {
465  /*
466  * Display the column value
467  */
468  fprintf(stdout, "%s", coldata[i].value);
469  fflush(stdout);
470 
471  /*
472  * If not last column, Print out spaces between this
473  * column and next one.
474  */
475  if (i != num_cols - 1) {
476  disp_len = ex_display_dlen(&outdatafmt[i]);
477  disp_len -= coldata[i].valuelen - 1;
478  for (j = 0; j < disp_len; j++) {
479  fputc(' ', stdout);
480  }
481  }
482  }
483  fprintf(stdout, "\n");
484  fflush(stdout);
485  }
486 
487  /*
488  * Free allocated space.
489  */
490  for (i = 0; i < num_cols; i++) {
491  free(coldata[i].value);
492  }
493  free(coldata);
494  free(outdatafmt);
495 
496  /*
497  * We're done processing rows. Let's check the final return
498  * value of ct_fetch().
499  */
500  switch ((int) ret) {
501  case CS_END_DATA:
502  /*
503  * Everything went fine.
504  */
505  fprintf(stdout, "All done processing rows.\n");
506  fflush(stdout);
507  break;
508 
509  case CS_FAIL:
510  /*
511  * Something terrible happened.
512  */
513  fprintf(stderr, "ct_fetch returned CS_FAIL\n");
514  return 1;
515  break;
516 
517  default:
518  /*
519  * We got an unexpected return value.
520  */
521  fprintf(stderr, "ct_fetch returned %d\n", ret);
522  return 1;
523  break;
524 
525  }
526  break;
527 
528  case CS_MSG_RESULT:
529  ret = ct_res_info(cmd, CS_MSGTYPE, (CS_VOID *) & msg_id, CS_UNUSED, NULL);
530  if (ret != CS_SUCCEED) {
531  fprintf(stderr, "ct_res_info(msg_id) failed");
532  return 1;
533  }
534  fprintf(stdout, "ct_result returned CS_MSG_RESULT where msg id = %d.\n", msg_id);
535  fflush(stdout);
536  break;
537 
538  case CS_CMD_SUCCEED:
539  /*
540  * This means no rows were returned.
541  */
542  break;
543 
544  case CS_CMD_DONE:
545  /*
546  * Done with result set.
547  */
548  break;
549 
550  case CS_CMD_FAIL:
551  /*
552  * The server encountered an error while
553  * processing our command.
554  */
555  fprintf(stderr, "ct_results returned CS_CMD_FAIL.");
556  break;
557 
558  default:
559  /*
560  * We got something unexpected.
561  */
562  fprintf(stderr, "ct_results returned unexpected result type.");
563  return CS_FAIL;
564  }
565  }
566 
567  /*
568  * We're done processing results. Let's check the
569  * return value of ct_results() to see if everything
570  * went ok.
571  */
572  switch ((int) ret) {
573  case CS_END_RESULTS:
574  /*
575  * Everything went fine.
576  */
577  break;
578 
579  case CS_FAIL:
580  /*
581  * Something failed happened.
582  */
583  fprintf(stderr, "ct_results failed.");
584  break;
585 
586  default:
587  /*
588  * We got an unexpected return value.
589  */
590  fprintf(stderr, "ct_results returned unexpected result type.");
591  break;
592  }
593 
594  return CS_SUCCEED;
595 
596 
597 
598 }
599 
600 static CS_INT
602 {
603 CS_INT len;
604 
605  switch ((int) column->datatype) {
606  case CS_CHAR_TYPE:
607  case CS_VARCHAR_TYPE:
608  case CS_TEXT_TYPE:
609  case CS_IMAGE_TYPE:
610  len = MIN(column->maxlength, 1024);
611  break;
612 
613  case CS_BINARY_TYPE:
614  case CS_VARBINARY_TYPE:
615  len = MIN((2 * column->maxlength) + 2, 1024);
616  break;
617 
618  case CS_BIT_TYPE:
619  case CS_TINYINT_TYPE:
620  len = 3;
621  break;
622 
623  case CS_SMALLINT_TYPE:
624  len = 6;
625  break;
626 
627  case CS_INT_TYPE:
628  len = 11;
629  break;
630 
631  case CS_REAL_TYPE:
632  case CS_FLOAT_TYPE:
633  len = 20;
634  break;
635 
636  case CS_MONEY_TYPE:
637  case CS_MONEY4_TYPE:
638  len = 24;
639  break;
640 
641  case CS_DATETIME_TYPE:
642  case CS_DATETIME4_TYPE:
643  len = 30;
644  break;
645 
646  case CS_NUMERIC_TYPE:
647  case CS_DECIMAL_TYPE:
648  len = (CS_MAX_PREC + 2);
649  break;
650 
651  default:
652  len = 12;
653  break;
654  }
655 
656  return MAX((CS_INT) (strlen(column->name) + 1), len);
657 }
658 
659 static CS_RETCODE
661 {
662 CS_INT i;
663 CS_INT l;
664 CS_INT j;
665 CS_INT disp_len;
666 
667  fputc('\n', stdout);
668  for (i = 0; i < numcols; i++) {
669  disp_len = ex_display_dlen(&columns[i]);
670  fprintf(stdout, "%s", columns[i].name);
671  fflush(stdout);
672  l = disp_len - (CS_INT) strlen(columns[i].name);
673  for (j = 0; j < l; j++) {
674  fputc(' ', stdout);
675  fflush(stdout);
676  }
677  }
678  fputc('\n', stdout);
679  fflush(stdout);
680  for (i = 0; i < numcols; i++) {
681  disp_len = ex_display_dlen(&columns[i]);
682  l = disp_len - 1;
683  for (j = 0; j < l; j++) {
684  fputc('-', stdout);
685  }
686  fputc(' ', stdout);
687  }
688  fputc('\n', stdout);
689 
690  return CS_SUCCEED;
691 }
692 
695 {
696  fprintf(stdout, "\nOpen Client Message:\n");
697  fprintf(stdout, "Message number: LAYER = (%ld) ORIGIN = (%ld) ", (long) CS_LAYER(errmsg->msgnumber), (long) CS_ORIGIN(errmsg->msgnumber));
698  fprintf(stdout, "SEVERITY = (%ld) NUMBER = (%ld)\n", (long) CS_SEVERITY(errmsg->msgnumber), (long) CS_NUMBER(errmsg->msgnumber));
699  fprintf(stdout, "Message String: %s\n", errmsg->msgstring);
700  if (errmsg->osstringlen > 0) {
701  fprintf(stdout, "Operating System Error: %s\n", errmsg->osstring);
702  }
703  fflush(stdout);
704 
705  return CS_SUCCEED;
706 }
707 
710 {
711  fprintf(stdout, "\nServer message:\n");
712  fprintf(stdout, "Message number: %ld, Severity %ld, ", (long) srvmsg->msgnumber, (long) srvmsg->severity);
713  fprintf(stdout, "State %ld, Line %ld\n", (long) srvmsg->state, (long) srvmsg->line);
714 
715  if (srvmsg->svrnlen > 0) {
716  fprintf(stdout, "Server '%s'\n", srvmsg->svrname);
717  }
718 
719  if (srvmsg->proclen > 0) {
720  fprintf(stdout, " Procedure '%s'\n", srvmsg->proc);
721  }
722 
723  fprintf(stdout, "Message String: %s\n", srvmsg->text);
724  fflush(stdout);
725 
726  return CS_SUCCEED;
727 }
#define CS_SERVERMSG_CB
Definition: cspublic.h:411
#define CS_CMD_DONE
Definition: cspublic.h:436
#define CS_CLIENTMSG_CB
Definition: cspublic.h:412
#define CS_SMALLINT_TYPE
Definition: cspublic.h:557
#define CS_CMD_SUCCEED
Definition: cspublic.h:437
#define CS_BINARY_TYPE
Definition: cspublic.h:551
#define CS_FAIL
Definition: cspublic.h:41
#define CS_INPUTVALUE
Definition: cspublic.h:293
#define CS_DATETIME4_TYPE
Definition: cspublic.h:563
#define CS_PARAM_RESULT
Definition: cspublic.h:540
#define CS_FLOAT_TYPE
Definition: cspublic.h:560
#define CS_LONGBINARY_TYPE
Definition: cspublic.h:553
#define CS_MSGTYPE
Definition: cspublic.h:474
#define CS_RETURN
Definition: cspublic.h:295
#define CS_MSG_RESULT
Definition: cspublic.h:545
#define CS_BIT_TYPE
Definition: cspublic.h:561
#define CS_RPC_CMD
Definition: cspublic.h:442
#define CS_REAL_TYPE
Definition: cspublic.h:559
#define CS_NUMBER(x)
Definition: cspublic.h:66
#define CS_STATUS_RESULT
Definition: cspublic.h:542
#define CS_CHAR_TYPE
Definition: cspublic.h:550
#define CS_PARENT_HANDLE
Definition: cspublic.h:228
#define CS_MONEY4_TYPE
Definition: cspublic.h:565
#define CS_DATETIME_TYPE
Definition: cspublic.h:562
#define CS_INT_TYPE
Definition: cspublic.h:558
#define CS_LAYER(x)
Definition: cspublic.h:63
#define CS_TINYINT_TYPE
Definition: cspublic.h:556
#define CS_SIZEOF(x)
Definition: cspublic.h:61
#define CS_UNUSED
Definition: cspublic.h:425
#define CS_DECIMAL_TYPE
Definition: cspublic.h:567
#define CS_END_DATA
Definition: cspublic.h:55
#define CS_MONEY_TYPE
Definition: cspublic.h:564
#define CS_VARCHAR_TYPE
Definition: cspublic.h:568
#define CS_SET
Definition: cspublic.h:429
#define CS_ROW_RESULT
Definition: cspublic.h:541
#define CS_TEXT_TYPE
Definition: cspublic.h:554
#define CS_SEVERITY(x)
Definition: cspublic.h:65
#define CS_ROW_FAIL
Definition: cspublic.h:54
#define CS_SUCCEED
Definition: cspublic.h:40
#define CS_CMD_FAIL
Definition: cspublic.h:438
#define CS_VARBINARY_TYPE
Definition: cspublic.h:569
@ CS_NO_RECOMPILE
Definition: cspublic.h:383
#define CS_NULLTERM
Definition: cspublic.h:422
#define CS_ORIGIN(x)
Definition: cspublic.h:64
#define CS_END_RESULTS
Definition: cspublic.h:56
#define CS_NUMDATA
Definition: cspublic.h:472
#define CS_IMAGE_TYPE
Definition: cspublic.h:555
#define CS_FMT_NULLTERM
Definition: cspublic.h:400
CS_RETCODE cs_convert(CS_CONTEXT *ctx, CS_DATAFMT *srcfmt, CS_VOID *srcdata, CS_DATAFMT *destfmt, CS_VOID *destdata, CS_INT *resultlen)
Definition: cs.c:494
#define CS_GET
Definition: cspublic.h:428
#define CS_NUMERIC_TYPE
Definition: cspublic.h:566
Int4 CS_INT
Definition: cstypes.h:41
double CS_FLOAT
Definition: cstypes.h:51
Int2 CS_SMALLINT
Definition: cstypes.h:45
void CS_VOID
Definition: cstypes.h:53
#define CS_MAX_PREC
Definition: cstypes.h:67
CS_INT CS_RETCODE
Definition: cstypes.h:63
unsigned char CS_BINARY
Definition: cstypes.h:59
char CS_CHAR
Definition: cstypes.h:48
struct _cs_money CS_MONEY
CS_RETCODE try_ctlogin(CS_CONTEXT **ctx, CS_CONNECTION **conn, CS_COMMAND **cmd, int verbose)
Definition: common.c:194
CS_RETCODE run_command(CS_COMMAND *cmd, const char *sql)
Definition: common.c:330
CS_RETCODE try_ctlogout(CS_CONTEXT *ctx, CS_CONNECTION *conn, CS_COMMAND *cmd, int verbose)
Definition: common.c:308
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static CS_CONNECTION * conn
Definition: ct_dynamic.c:25
#define strcat(s, k)
int main(int argc, char *argv[])
static CS_INT ex_display_dlen(CS_DATAFMT *column)
struct _ex_column_data EX_COLUMN_DATA
static void * no_unused_var_warn[]
CS_RETCODE ex_clientmsg_cb(CS_CONTEXT *context, CS_CONNECTION *connection, CS_CLIENTMSG *errmsg)
static CS_RETCODE ex_display_header(CS_INT numcols, CS_DATAFMT columns[])
static char software_version[]
static CS_INT ex_display_results(CS_COMMAND *cmd)
#define MIN(X, Y)
CS_RETCODE ex_servermsg_cb(CS_CONTEXT *context, CS_CONNECTION *connection, CS_SERVERMSG *errmsg)
#define MAX(X, Y)
CS_CONTEXT * ctx
Definition: t0006.c:12
CS_RETCODE ct_command(CS_COMMAND *cmd, CS_INT type, const CS_VOID *buffer, CS_INT buflen, CS_INT option)
Definition: ct.c:760
CS_RETCODE ct_results(CS_COMMAND *cmd, CS_INT *result_type)
Definition: ct.c:1172
CS_RETCODE ct_res_info(CS_COMMAND *cmd, CS_INT type, CS_VOID *buffer, CS_INT buflen, CS_INT *out_len)
Definition: ct.c:2491
CS_RETCODE ct_callback(CS_CONTEXT *ctx, CS_CONNECTION *con, CS_INT action, CS_INT type, CS_VOID *func)
Definition: ct.c:306
CS_RETCODE ct_fetch(CS_COMMAND *cmd, CS_INT type, CS_INT offset, CS_INT option, CS_INT *rows_read)
Definition: ct.c:1589
CS_RETCODE ct_cmd_props(CS_COMMAND *cmd, CS_INT action, CS_INT property, CS_VOID *buffer, CS_INT buflen, CS_INT *outlen)
Definition: ct.c:2661
CS_RETCODE ct_send(CS_COMMAND *cmd)
Definition: ct.c:913
CS_RETCODE ct_bind(CS_COMMAND *cmd, CS_INT item, CS_DATAFMT *datafmt, CS_VOID *buffer, CS_INT *copied, CS_SMALLINT *indicator)
Definition: ct.c:1531
CS_RETCODE ct_con_props(CS_CONNECTION *con, CS_INT action, CS_INT property, CS_VOID *buffer, CS_INT buflen, CS_INT *out_len)
Definition: ct.c:351
CS_RETCODE ct_describe(CS_COMMAND *cmd, CS_INT item, CS_DATAFMT *datafmt)
Definition: ct.c:2424
CS_RETCODE ct_setparam(CS_COMMAND *cmd, CS_DATAFMT *datafmt, CS_VOID *data, CS_INT *datalen, CS_SMALLINT *indicator)
Definition: ct.c:3491
static const char * column
Definition: stats.c:23
static const column_t columns[]
Definition: utf8_2.c:22
#define NULL
Definition: ncbistd.hpp:225
int i
int len
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
true_type verbose
Definition: processing.cpp:890
CS_MSGNUM msgnumber
Definition: cstypes.h:187
CS_CHAR msgstring[1024]
Definition: cstypes.h:188
CS_INT osstringlen
Definition: cstypes.h:192
CS_CHAR osstring[1024]
Definition: cstypes.h:191
CS_INT format
Definition: cstypes.h:126
CS_INT maxlength
Definition: cstypes.h:127
CS_LOCALE * locale
Definition: cstypes.h:133
CS_INT precision
Definition: cstypes.h:129
CS_CHAR name[132]
Definition: cstypes.h:123
CS_INT datatype
Definition: cstypes.h:125
CS_INT scale
Definition: cstypes.h:128
CS_INT namelen
Definition: cstypes.h:124
CS_INT status
Definition: cstypes.h:130
CS_MSGNUM msgnumber
Definition: cstypes.h:200
CS_INT line
Definition: cstypes.h:209
CS_CHAR text[1024]
Definition: cstypes.h:203
CS_CHAR proc[132]
Definition: cstypes.h:207
CS_INT svrnlen
Definition: cstypes.h:206
CS_INT severity
Definition: cstypes.h:202
CS_INT proclen
Definition: cstypes.h:208
CS_CHAR svrname[132]
Definition: cstypes.h:205
CS_INT state
Definition: cstypes.h:201
CS_SMALLINT indicator
Definition: rpc_ct_param.c:31
CS_CHAR * value
Definition: rpc_ct_param.c:32
static CS_CONTEXT * context
Definition: will_convert.c:21
void free(voidpf ptr)
voidp malloc(uInt size)
Modified on Thu May 02 14:26:06 2024 by modify_doxy.py rev. 669887