home *** CD-ROM | disk | FTP | other *** search
/ WinWares 1 / WINWARES.ISO / database / gupta / sqloms.c / sqloms.c
Encoding:
C/C++ Source or Header  |  1993-12-11  |  1.6 KB  |  62 lines

  1. /*----------------------------------------------------------------*/
  2. /*                                  */
  3. /*  Example of sqloms() : Set Output Message Size          */
  4. /*                                  */
  5. /*----------------------------------------------------------------*/
  6.  
  7. #include "sql.h"
  8. #include "stdio.h"
  9.  
  10. /* error defines */
  11. #define APIERROR    1
  12.  
  13. #define apierr(a) error(a,__LINE__, APIERROR)
  14.  
  15.       SQLTCUR   cur = 0;        /* SQLBASE cursor number        */
  16.       SQLTRCD   rcd = 0;        /* SQLBASE return code            */
  17.  
  18.       main()
  19. {
  20.  
  21.       SQLTDAL   insize=500;
  22.       SQLTDAL   outsize=500;
  23.       
  24. static      char        dbnam[] = "demox";    /* database name            */
  25.  
  26.   /* CONNECT TO THE DATABASE */
  27.  
  28.   cur = 0;
  29.   if (rcd = sqlcnc(&cur, dbnam, 0))    /* perform connect operation        */
  30.           apierr("SQLCNC");
  31.  
  32.   if (rcd = sqlims(cur,insize))
  33.           apierr("SQLIMS");
  34.   else
  35.       printf("Input Message Size set to = %d \n", insize);
  36.   
  37.   if (rcd = sqloms(cur,outsize))
  38.           apierr("SQLOMS");
  39.   else
  40.       printf("Output Message Size set to = %d \n", outsize);
  41.   
  42.   /* DISCONNECT FROM THE DATABASE */
  43.  
  44.   if (rcd = sqldis(cur))        /* failure on disconnect?        */
  45.           apierr("SQLDIS");
  46. }
  47.  
  48. /*
  49.   ERROR - prints an error message for the utility
  50. */
  51.       error(what, line, type)
  52.       char*     what;        /* description of what happened     */
  53.       int        line;        /* line number where error occured  */
  54.       int        type;        /* type of error            */
  55.   {
  56.       char        msg[200];        /* error message buffer         */
  57.  
  58.       sqlerr(rcd, msg);           /* get the error message        */
  59.       printf("\nError: %s at line %d: %s, Error # %d\n", what, line, msg,rcd);
  60.   }
  61.  
  62.