home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a523 / 13.ddi / SQLCA.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-15  |  3.2 KB  |  103 lines

  1. /* Copyright (c) 1985,1986 by Oracle Corporation. */
  2.  
  3. /*
  4. NAME
  5.   SQLCA : SQL Communications Area.
  6. FUNCTION
  7.   Contains no code. Oracle fills in the SQLCA with status info
  8.   during the execution of a SQL stmt.
  9. NOTES
  10.   If the symbol SQLCA_STORAGE_CLASS is defined, then the SQLCA
  11.   will be defined to have this storage class. For example:
  12.  
  13.     #define SQLCA_STORAGE_CLASS extern
  14.  
  15.   will define the SQLCA as an extern.
  16.  
  17.   If the symbol SQLCA_INIT is defined, then the SQLCA will be
  18.   statically initialized. Although this is not necessary in order
  19.   to use the SQLCA, it is a good pgming practice not to have
  20.   unitialized variables. However, some C compilers/OS's don't
  21.   allow automatic variables to be init'd in this manner. Therefore,
  22.   if you are INCLUDE'ing the SQLCA in a place where it would be
  23.   an automatic AND your C compiler/OS doesn't allow this style
  24.   of initialization, then SQLCA_INIT should be left undefined --
  25.   all others can define SQLCA_INIT if they wish.
  26.  
  27.   New rules for defining SQLCA_INIT, SQLCA_STORAGE_CLASS, and DLL in OS/2:
  28.   Users should not define SQLCA_STORAGE_CLASS if defining DLL.
  29.   SQLCA_STORAGE_CLASS is primarily used for single-threaded programs
  30.   and for internal development.
  31.  
  32. MODIFIED
  33.   Okamura    08/15/89 - OS/2: users must define SQLMT for multi-threaded case
  34.   Okamura    06/23/89 - OS/2: modify for multi-threaded case
  35.   Clare      12/06/84 - Ch SQLCA to not be an extern.
  36.   Clare      10/21/85 - Add initialization.
  37.   Bradbury   01/05/86 - Only initialize when SQLCA_INIT set
  38.   Clare      06/12/86 - Add SQLCA_STORAGE_CLASS option.
  39. */
  40.  
  41. #ifndef SQLCA
  42. #define SQLCA 1
  43.  
  44. struct   sqlca
  45.          {
  46.          /* ub1 */ char    sqlcaid[8];
  47.          /* b4  */ long    sqlabc;
  48.          /* b4  */ long    sqlcode;
  49.          struct
  50.            {
  51.            /* ub2 */ unsigned short sqlerrml;
  52.            /* ub1 */ char           sqlerrmc[70];
  53.            } sqlerrm;
  54.          /* ub1 */ char    sqlerrp[8];
  55.          /* b4  */ long    sqlerrd[6];
  56.          /* ub1 */ char    sqlwarn[8];
  57.          /* ub1 */ char    sqlext[8];
  58.          };
  59.  
  60. #ifdef SQLMT
  61.    extern struct sqlca *sqlcamt();             /* For multi-threaded version */
  62. #  define sqlca (*sqlcamt())
  63. #else /* SQLMT */
  64.  
  65. #ifdef SQLCA_STORAGE_CLASS
  66.   SQLCA_STORAGE_CLASS struct sqlca sqlca
  67. # ifdef  SQLCA_INIT
  68.          = {
  69.          {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '},
  70.          sizeof(struct sqlca),
  71.          0,
  72.          { 0, {0}},
  73.          {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '},
  74.          {0, 0, 0, 0, 0, 0},
  75.          {0, 0, 0, 0, 0, 0, 0, 0},
  76.          {0, 0, 0, 0, 0, 0, 0, 0}
  77.          }
  78. # endif /* SQLCA_INIT */
  79.          ;
  80.  
  81. #else /* SQLCA_STORAGE_CLASS */
  82.    struct sqlca sqlca                         /* For single-threaded version */
  83.  
  84. #  ifdef  SQLCA_INIT
  85.          = {
  86.          {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '},
  87.          sizeof(struct sqlca),
  88.          0,
  89.          { 0, {0}},
  90.          {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '},
  91.          {0, 0, 0, 0, 0, 0},
  92.          {0, 0, 0, 0, 0, 0, 0, 0},
  93.          {0, 0, 0, 0, 0, 0, 0, 0}
  94.          }
  95. #  endif /* SQLCA_INIT */
  96.          ;
  97. #endif /* SQLCA_STORAGE_CLASS */
  98.  
  99. #endif /* SQLMT */
  100.  
  101. /* end SQLCA */
  102. #endif /* SQLCA */
  103.