home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a025 / 11.ddi / SQLFRONT.H@ / SQLFRONT.bin
Encoding:
Text File  |  1992-09-15  |  14.3 KB  |  551 lines

  1. /* SQLFRONT.H - DB-Library header file for the Microsoft SQL Server.
  2. **         The SYBASE SQL Server database for PC networks.
  3. **
  4. ** All constant and macro definitions for DB-Library applications
  5. ** programming are contained in this file.  This file MUST be included
  6. ** before SQLDB.H and one of the following #defines made: DBMSDOS, DBMSOS2,
  7. ** DBNTWIN32 and DBMSWIN (for the appropriate operating platform). When
  8. ** compiling a WLO 1.0 application (using Windows libraries for os/2),
  9. ** use DBMSWIN.
  10. **
  11. ** Copyright (c) 1989, 1991 by Microsoft Corp.    All rights reserved.
  12. ** Copyright (c) 1989, 1991 by Sybase, Inc.  All rights reserved.
  13. **
  14. */
  15.  
  16. /* Note this has changed because Windows 3.1 defines API as 'pascal far' */
  17.  
  18. #if !defined(M_I86SM)  && !defined(DBNTWIN32)
  19. #define SQLAPI            cdecl far
  20. #else
  21. #define SQLAPI            cdecl
  22. #endif
  23.  
  24. #ifndef  API
  25. #define  API  SQLAPI
  26. #endif
  27.  
  28. /* define datatypes used by dblib for portability */
  29.  
  30. #define DBUBOOL            unsigned int
  31.  
  32. #ifndef SHORT
  33. #define SHORT            short
  34. #endif
  35.  
  36. #ifndef INT
  37. #define INT            int
  38. #endif
  39.  
  40. #ifndef UINT
  41. #define UINT            unsigned int
  42. #endif
  43.  
  44. #ifndef USHORT
  45. #define USHORT             unsigned short
  46. #endif
  47.  
  48. #ifndef ULONG
  49. #define ULONG             unsigned long
  50. #endif
  51.  
  52. #ifndef CHAR
  53. #define CHAR            char
  54. #endif
  55.  
  56. #ifndef DOUBLE
  57. #define DOUBLE            double
  58. #endif
  59.  
  60. #ifndef OS2_INCLUDED
  61. typedef unsigned char           BYTE;
  62. #endif
  63.  
  64. #if !defined(OS2_INCLUDED) && !defined(DBMSWIN) && !defined(DBNTWIN32)
  65. typedef DBUBOOL         BOOL;
  66. #endif
  67.  
  68. #ifndef TRUE
  69. #define TRUE                    1
  70. #endif
  71.  
  72. #ifndef FALSE
  73. #define FALSE                   0
  74. #endif
  75.  
  76. #define TINYBIND    1
  77. #define SMALLBIND       2
  78. #define INTBIND         3
  79. #define CHARBIND        4
  80. #define BINARYBIND    5
  81. #define BITBIND     6
  82. #define DATETIMEBIND    7
  83. #define MONEYBIND    8
  84. #define FLT8BIND    9
  85. #define STRINGBIND    10
  86. #define NTBSTRINGBIND    11
  87. #define VARYCHARBIND    12
  88. #define VARYBINBIND    13
  89.  
  90. /* These are version 4.2 additions */
  91. #define FLT4BIND    14
  92. #define SMALLMONEYBIND    15
  93. #define SMALLDATETIBIND 16
  94. #define  MAXBIND    SMALLDATETIBIND
  95. /* #define MAXBIND       VARYBINBIND    */
  96.  
  97.  
  98. #define DBSAVE          1
  99. #define DBNOSAVE        0
  100.  
  101. #define DBNOERR         -1
  102. #define DBFINDONE       0x04            /* definately done        */
  103. #define DBMORE          0x10            /* maybe more commands waiting  */
  104. #define DBMORE_ROWS     0x20            /* this command returned rows   */
  105.  
  106. #define MAXNAME                 31
  107.  
  108. /* Timestamp length */
  109. #define  DBTXTSLEN              8       /* length of text timestamp    */
  110.  
  111. /* Text pointer length */
  112. #define  DBTXPLEN               16
  113.  
  114. /* Error code returns */
  115. #define INT_EXIT                0
  116. #define INT_CONTINUE            1
  117. #define INT_CANCEL              2
  118.  
  119. /* Server buffer size */
  120. #define SERVBSIZE               512
  121. #define DBNETCOUNT        10
  122.  
  123. /* Dboptions */
  124. #define DBMAXOPTS        14
  125.  
  126. /* dboptions */
  127. #define DBBUFFER                0
  128. #define DBOFFSET                1
  129. #define DBROWCOUNT              2
  130. #define DBSTAT                  3
  131. #define DBTEXTLIMIT             4
  132. #define DBTEXTSIZE              5
  133. #define DBARITHABORT            6
  134. #define DBARITHIGNORE           7
  135. #define DBNOAUTOFREE            8
  136. #define DBNOCOUNT               9
  137. #define DBNOEXEC                10
  138. #define DBPARSEONLY             11
  139. #define DBSHOWPLAN              12
  140. #define DBSTORPROCID        13
  141.     /* The following is a version 4.2 enhancement */
  142. #define DBANSItoOEM        14    /* Windows only option */
  143.  
  144. /* Data Type Tokens. */
  145. # define SQLTEXT        0x23
  146. # define SQLARRAY        0x24
  147. # define SQLVARBINARY        0x25
  148. # define SQLINTN        0x26
  149. # define SQLVARCHAR        0x27
  150. # define SQLBINARY        0x2d
  151. # define SQLIMAGE        0x22
  152. # define SQLCHAR        0x2f
  153. # define SQLINT1        0x30
  154. # define SQLBIT         0x32
  155. # define SQLINT2        0x34
  156. # define SQLINT4        0x38
  157. # define SQLMONEY        0x3c
  158. # define SQLDATETIME        0x3d
  159. # define SQLFLT8        0x3e
  160. # define SQLFLTN        0x6d
  161. # define SQLMONEYN        0x6e
  162. # define SQLDATETIMN        0x6f
  163.  
  164. /* These are version 4.2 additions */
  165. # define SQLFLT4        0x3b
  166. # define SQLMONEY4        0x7a
  167. # define SQLDATETIM4        0x3a
  168.  
  169.  
  170. /* Data stream tokens */
  171. # define SQLCOLFMT        0xa1
  172. # define OLD_SQLCOLFMT        0x2a
  173. # define SQLPROCID        0x7c
  174. # define SQLCOLNAME        0xa0
  175. # define SQLTABNAME        0xa4
  176. # define SQLCOLINFO        0xa5
  177. # define SQLALTNAME        0xa7
  178. # define SQLALTFMT        0xa8
  179. # define SQLERROR        0xaa
  180. # define SQLINFO        0xab
  181. # define SQLRETURNVALUE     0xac
  182. # define SQLRETURNSTATUS        0x79
  183. # define SQLRETURN        0xdb
  184. # define SQLCONTROL        0xae
  185. # define SQLALTCONTROL        0xaf
  186. # define SQLROW         0xd1
  187. # define SQLALTROW        0xd3
  188. # define SQLDONE        0xfd
  189. # define SQLDONEPROC        0xfe
  190. # define SQLDONEINPROC        0xff
  191. # define SQLOFFSET        0x78
  192. # define SQLORDER               0xa9
  193. # define SQLLOGINACK        0xad    /* >>> NOTICE: change to real value */
  194.  
  195. /* Ag op tokens */
  196. # define SQLAOPCNT        0x4b
  197. # define SQLAOPSUM        0x4d
  198. # define SQLAOPAVG        0x4f
  199. # define SQLAOPMIN        0x51
  200. # define SQLAOPMAX        0x52
  201. # define SQLAOPANY        0x53
  202. # define SQLAOPNOOP        0x56
  203.  
  204. /* error numbers (dberrs) DB-Library error codes */
  205. #define SQLEMEM         10000
  206. #define SQLENULL        10001
  207. #define SQLENLOG        10002
  208. #define SQLEPWD         10003
  209. #define SQLECONN        10004
  210. #define SQLEDDNE        10005
  211. #define SQLENULLO       10006
  212. #define SQLESMSG        10007
  213. #define SQLEBTOK        10008
  214. #define SQLENSPE        10009
  215. #define SQLEREAD        10010
  216. #define SQLECNOR        10011
  217. #define SQLETSIT        10012
  218. #define SQLEPARM        10013
  219. #define SQLEAUTN        10014
  220. #define SQLECOFL        10015
  221. #define SQLERDCN        10016
  222. #define SQLEICN         10017
  223. #define SQLECLOS        10018
  224. #define SQLENTXT        10019  /* new error number/message */
  225. #define SQLEDNTI        10020
  226. #define SQLETMTD        10021
  227. #define SQLEASEC        10022
  228. #define SQLENTLL        10023
  229. #define SQLETIME        10024
  230. #define SQLEWRIT        10025
  231. #define SQLEMODE        10026
  232. #define SQLEOOB         10027
  233. #define SQLEITIM        10028
  234. #define SQLEDBPS        10029
  235. #define SQLEIOPT        10030
  236. #define SQLEASNL        10031
  237. #define SQLEASUL        10032
  238. #define SQLENPRM        10033
  239. #define SQLEDBOP        10034
  240. #define SQLENSIP        10035
  241. #define SQLECNULL       10036
  242. #define SQLESEOF    10037
  243. #define SQLERPND    10038
  244. #define SQLECSYN    10039
  245. #define SQLENONET    10040
  246. #define SQLEBTYP    10041
  247. #define SQLEABNC    10042
  248. #define SQLEABMT    10043
  249. #define SQLEABNP    10044
  250. #define SQLEBNCR    10045
  251. #define SQLEAAMT    10046
  252. #define SQLENXID    10047
  253. #define SQLEIFNB    10048
  254. #define SQLEKBCO    10049
  255. #define SQLEBBCI    10050
  256. #define SQLEKBCI    10051
  257. #define SQLEBCWE    10052
  258. #define SQLEBCNN    10053
  259. #define SQLEBCOR    10054
  260. #define SQLEBCPI    10055
  261. #define SQLEBCPN    10056
  262. #define SQLEBCPB    10057
  263. #define SQLEVDPT    10058
  264. #define SQLEBIVI    10059
  265. #define SQLEBCBC    10060
  266. #define SQLEBCFO    10061
  267. #define SQLEBCVH    10062
  268. #define SQLEBCUO    10063
  269. #define SQLEBUOE    10064
  270. #define SQLEBWEF    10065
  271. #define SQLEBTMT    10066
  272. #define SQLEBEOF    10067
  273. #define SQLEBCSI    10068
  274. #define SQLEPNUL    10069
  275. #define SQLEBSKERR    10070
  276. #define SQLEBDIO    10071
  277. #define SQLEBCNT    10072
  278. #define SQLEMDBP    10073
  279. #define SQLINIT     10074
  280. #define SQLCRSINV    10075
  281. #define SQLCRSCMD    10076
  282. #define SQLCRSNOIND    10077
  283. #define SQLCRSDIS    10078
  284. #define SQLCRSAGR    10079
  285. #define SQLCRSORD    10080
  286. #define SQLCRSMEM    10081
  287. #define SQLCRSBSKEY    10082
  288. #define SQLCRSNORES    10083
  289. #define SQLCRSVIEW    10084
  290. #define SQLCRSBUFR    10085
  291. #define SQLCRSFROWN    10086
  292. #define SQLCRSBROL    10087
  293. #define SQLCRSFRAND    10088
  294. #define SQLCRSFLAST    10089
  295. #define SQLCRSRO    10090
  296. #define SQLCRSTAB    10091
  297. #define SQLCRSUPDTAB    10092
  298. #define SQLCRSUPDNB    10093
  299. #define SQLCRSVIIND    10094
  300. #define SQLCRSNOUPD    10095
  301. #define SQLCRSOS2    10096
  302. #define SQLEBCSA        10097
  303. #define SQLEBCRO    10098
  304. #define SQLEBCNE    10099
  305. #define SQLEBCSK    10100
  306. #define SQLEUVBF    10101
  307. #define SQLEBIHC    10102
  308. #define SQLEBWFF    10103
  309.  
  310. /* The severity levels are defined here */
  311. #define    EXINFO        1    /* informational, non-error */
  312. #define    EXUSER        2    /* user error */
  313. #define    EXNONFATAL    3    /* non-fatal error */
  314. #define EXCONVERSION    4    /* Error in DB-LIBRARY data conversion. */
  315. #define EXSERVER    5    /* The Server has returned an error flag. */
  316. #define EXTIME        6    /* We have exceeded our timeout period while
  317.                  * waiting for a response from the Server -
  318.                  * the DBPROCESS is still alive.
  319.                  */
  320. #define EXPROGRAM    7    /* coding error in user program */
  321. #define    EXRESOURCE    8    /* running out of resources - the DBPROCESS
  322.                  * may be dead.
  323.                  */
  324. #define    EXCOMM        9    /* failure in communication with Server -
  325.                  * the DBPROCESS is dead.
  326.                  */
  327. #define    EXFATAL        10    /* fatal error - the DBPROCESS is dead. */
  328. #define    EXCONSISTENCY    11    /* internal software error  - notify MS
  329.                  * Technical Supprt.
  330.                  */
  331.  
  332.  
  333. /* offset identifiers */
  334. #define OFF_SELECT      0x16d
  335. #define OFF_FROM        0x14f
  336. #define OFF_ORDER       0x165
  337. #define OFF_COMPUTE     0x139
  338. #define OFF_TABLE       0x173
  339. #define OFF_PROCEDURE   0x16a
  340. #define OFF_STATEMENT   0x1cb
  341. #define OFF_PARAM       0x1c4
  342. #define OFF_EXEC    0x12c
  343.  
  344. /* print lengths for certain fixed length data types. */
  345. #define PRINT4      11
  346. #define PRINT2      6
  347. #define PRINT1      3
  348. #define PRFLT8        20
  349. #define PRMONEY     26
  350. #define PRBIT        3
  351. #define PRDATETIME    27
  352.  
  353.  
  354. #define MAXTYPES    11
  355. #define DBMAXCHAR       256     /* max length of DBVARBINARY and DBVARCHAR,etc */
  356.  
  357. #ifndef DBTYPEDEFS    /* srv.h (Open Server include) not already included*/
  358.  
  359. #define DBTYPEDEFS
  360.  
  361. /* dblib datatypes */
  362. typedef char            DBCHAR;
  363. typedef unsigned char   DBBINARY;
  364. typedef unsigned char   DBTINYINT;
  365. typedef short           DBSMALLINT;
  366. typedef unsigned short  DBUSMALLINT;
  367. typedef long            DBINT;
  368. typedef double          DBFLT8;
  369. typedef unsigned char   DBBIT;
  370. typedef unsigned char   DBBOOL;
  371.  
  372. /* These are version 4.2 additions */
  373. typedef float  DBFLT4;
  374. typedef long   DBMONEY4;
  375.  
  376. #define DBREAL    DBFLT4
  377.  
  378. typedef struct dbdatetime4
  379. {
  380.     unsigned short numdays;         /* No of days since Jan-1-1900 */
  381.     unsigned short nummins;         /* No. of minutes since midnight */
  382. }DBDATETIM4;
  383.  
  384.  
  385.  
  386. typedef struct dbvarychar
  387. {
  388.     DBSMALLINT  len;
  389.     DBCHAR      str[DBMAXCHAR];
  390. }DBVARYCHAR;
  391.  
  392. typedef struct dbvarybin
  393. {
  394.     DBSMALLINT  len;
  395.     BYTE        array[DBMAXCHAR];
  396. }DBVARYBIN;
  397.  
  398. typedef struct dbmoney
  399. {
  400.     DBINT mnyhigh;
  401.     ULONG mnylow;
  402. }DBMONEY;
  403.  
  404. typedef struct dbdatetime
  405. {
  406.     DBINT dtdays;
  407.     ULONG dttime;
  408. }DBDATETIME;
  409.  
  410. /* DBDATEREC structure used by dbdatecrack. This is a version 4.2 addition */
  411. typedef struct dbdaterec
  412. {
  413.     int     year;        /* 1753 - 9999 */
  414.     int     quarter;        /* 1 - 4 */
  415.     int     month;        /* 1 - 12 */
  416.     int     dayofyear;        /* 1 - 366 */
  417.     int     day;        /* 1 - 31 */
  418.     int     week;        /* 1 - 54 (for leap years) */
  419.     int     weekday;        /* 1 - 7  (Mon - Sun) */
  420.     int     hour;        /* 0 - 23 */
  421.     int     minute;        /* 0 - 59 */
  422.     int     second;        /* 0 - 59 */
  423.     int     millisecond;    /* 0 - 999 */
  424. } DBDATEREC;
  425.  
  426. #endif        /* end DBTYPEDEFS */
  427.  
  428. /* various datatype and return codes */
  429. #define RETCODE        INT
  430. #define STATUS          INT
  431. #define SUCCEED        1
  432. #define FAIL        0
  433.  
  434.  
  435. #define MORE_ROWS    -1
  436. #define NO_MORE_ROWS    -2
  437. #define REG_ROW         MORE_ROWS
  438. #define BUF_FULL    -3
  439.  
  440. /*
  441. **  Status code for dbresults(). Possible return values are
  442. **  SUCCEED, FAIL, and NO_MORE_RESULTS.
  443. */
  444. #define NO_MORE_RESULTS 2
  445.  
  446. /* macros for dbsetlname() */
  447. #define DBSETHOST    1
  448. #define DBSETUSER    2
  449. #define DBSETPWD    3
  450. #define DBSETAPP    4
  451. #define DBSETID         5
  452.     /* The following is a version 4.2 addition */
  453. #define DBSETLANG    6
  454.  
  455. /* standard exit and error values */
  456. #define STDEXIT        0
  457. #define ERREXIT        -1
  458.  
  459. /* The following are version 4.2 additions */
  460.  
  461. #define  DBRPCRECOMPILE     1
  462. #define  DBRPCRETURN        1
  463.  
  464.  
  465. /* Cursor related constants */
  466.  
  467. /*
  468.  ** Following flags are used in the concuropt parameter in the
  469.  ** dbcursoropen function
  470.  */
  471. #define CUR_READONLY        1    /* Read only cursor, no data modifications*/
  472. #define CUR_LOCKCC        2    /* Intent to update, all fetched data locked
  473.                  **  when dbcursorfetch is called inside a
  474.                  **  transaction block
  475.                  */
  476. #define CUR_OPTCC        3    /* Optimistic concurrency control, data
  477.                  **  modifications succeed only if the row
  478.                  **  hasn't been updated since the last fetch
  479.                  */
  480. #define CUR_OPTCCVAL        4    /* Optimistic concurrency control based on
  481.                  ** selected column values
  482.                  */
  483.  
  484.  
  485. /*
  486.  ** Following flags are used in the scrollopt parameter in the
  487.  ** dbcursoropen function
  488.  */
  489. #define CUR_FORWARD        0    /* Forward only scrolling */
  490. #define CUR_KEYSET       -1    /* Keyset driven scrolling */
  491. #define CUR_DYNAMIC        1    /* Fully dynamic */
  492. /* Any other number indicates mixed scrolling. (Keyset driven within the given
  493.  **  number, dynamic outside)
  494.  */
  495.  
  496. /*
  497.  ** Following flags define the fetchtype in the dbcursorfetch function
  498.  */
  499. #define  FETCH_FIRST    1    /* Fetch first n rows */
  500. #define  FETCH_NEXT    2    /* Fetch next n rows */
  501. #define  FETCH_PREV    3    /* Fetch previous n rows */
  502. #define  FETCH_RANDOM    4    /* Fetch n rows beginning with given row# */
  503. #define  FETCH_RELATIVE 5    /* Fetch relative to previous fetch row # */
  504. #define  FETCH_LAST    6    /* Fetch the last n rows */
  505.  
  506. /*
  507.  ** Following flags define the per row status as filled by dbcursorfetch
  508.  */
  509. #define FTC_SUCCEED    0x01    /* Fetch succeeded, (failed if not set) */
  510. #define FTC_MISSING    0x02    /* The row is missing */
  511. #define FTC_ENDOFKEYSET 0x04    /* End of the keyset reached */
  512. #define FTC_ENDOFRESULTS 0x08    /* End of results set reached */
  513.  
  514. /*
  515.  ** Following flags define the operator types for the dbcursor function
  516.  */
  517. #define CRS_UPDATE    1    /* Update operation */
  518. #define CRS_DELETE    2    /* Delete operation */
  519. #define CRS_INSERT    3    /* Insert operation */
  520. #define CRS_REFRESH    4    /* Refetch given row */
  521. #define CRS_LOCKCC    5    /* Lock given row
  522.                  ** (if only inside a transaction)
  523.                  */
  524.  
  525.  
  526. /*
  527.  ** Following value can be passed to the dbcursorbind function for NOBIND
  528.  **   type.
  529.  */
  530. #define NOBIND        -2        /* Return length and pointer to data */
  531.  
  532.  
  533. /*
  534. ** The following values are passed to dbserverenum for searching criteria,
  535. ** under all platforms except DOS were dbserverenum is not supported.
  536. */
  537.  
  538. #define NET_SEARCH        0x0001
  539. #define LOC_SEARCH        0x0002
  540.  
  541. /*
  542. ** These constansts are the possible return values from dbserverenum.
  543. */
  544.  
  545. #define ENUM_SUCCESS        0x0000
  546. #define MORE_DATA        0x0001
  547. #define NET_NOT_AVAIL        0x0002
  548. #define OUT_OF_MEMORY        0x0004
  549.  
  550.  
  551.