home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / sqlfront.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  24KB  |  796 lines

  1. #ifndef _INC_SQLFRONT
  2. #define _INC_SQLFRONT
  3.  
  4. #ifdef DBNTWIN32
  5.     #ifndef _WINDOWS_
  6.         #pragma message (__FILE__ " : db-library error: windows.h must be included before sqlfront.h.")
  7.     #endif
  8. #endif
  9.  
  10. #ifdef __cplusplus
  11.     extern "C" {
  12. #endif
  13.  
  14. /*****************************************************************************
  15. *                                                                            *
  16. *     SQLFRONT.H - DB-Library header file for the Microsoft SQL Server.      *
  17. *                                                                            *
  18. *     Copyright (c) 1989 - 1995 by Microsoft Corp.  All rights reserved.     *
  19. *                                                                            *
  20. * All constant and macro definitions for DB-Library applications programming *
  21. * are contained in this file.  This file must be included before SQLDB.H and *
  22. * one of the following #defines must be made, depending on the operating     *
  23. * system: DBMSDOS, DBMSWIN or DBNTWIN32.                                     *
  24. *                                                                            *
  25. *****************************************************************************/
  26.  
  27.  
  28. /*****************************************************************************
  29. * Datatype definitions                                                       *
  30. *****************************************************************************/
  31.  
  32. // Note this has changed because Windows 3.1 defines API as 'pascal far'
  33.  
  34. #if !defined(M_I86SM) && !defined(DBNTWIN32)
  35. #define SQLAPI cdecl far
  36. #else
  37. #define SQLAPI _cdecl
  38. #endif
  39.  
  40. #ifndef  API
  41. #define  API  SQLAPI
  42. #endif
  43.  
  44. #ifndef DOUBLE
  45. typedef double DOUBLE;
  46. #endif
  47.  
  48.  
  49. /*****************************************************************************
  50. * DBPROCESS, LOGINREC and DBCURSOR                                           *
  51. *****************************************************************************/
  52.  
  53. #define DBPROCESS void   // dbprocess structure type
  54. #define LOGINREC  void   // login record type
  55. #define DBCURSOR  void   // cursor record type
  56. #define DBHANDLE  void   // generic handle
  57.  
  58. // DOS Specific
  59. #ifdef DBMSDOS
  60. typedef DBPROCESS * PDBPROCESS;
  61. typedef LOGINREC  * PLOGINREC;
  62. typedef DBCURSOR  * PDBCURSOR;
  63. typedef DBHANDLE  * PDBHANDLE;
  64. #define PTR *
  65. #endif
  66.  
  67.  
  68. // WIN 3.x Specific.  The handle pointers are near for Windows 3.x
  69. #ifdef DBMSWIN
  70. typedef DBPROCESS near * PDBPROCESS;
  71. typedef LOGINREC  near * PLOGINREC;
  72. typedef DBCURSOR  near * PDBCURSOR;
  73. typedef DBHANDLE  near * PDBHANDLE;
  74. #define PTR far *
  75. #endif
  76.  
  77.  
  78. // Windows NT Specific
  79. #ifdef DBNTWIN32
  80. typedef DBPROCESS * PDBPROCESS;
  81. typedef LOGINREC  * PLOGINREC;
  82. typedef DBCURSOR  * PDBCURSOR;
  83. typedef DBHANDLE  * PDBHANDLE;
  84. #define PTR *
  85. typedef int (SQLAPI *SQLFARPROC)();
  86. #else
  87. typedef long (far pascal *LGFARPROC)();  // Windows loadable driver fp
  88. #endif
  89.  
  90.  
  91. /*****************************************************************************
  92. * Win32 compatibility datatype definitions                                   *
  93. * Note: The following datatypes are provided for Win32 compatibility.        *
  94. * Since some of the datatypes are already defined in unrelated include files *
  95. * there may definition duplication.  Every attempt has been made to check    *
  96. * for such problems.                                                         *
  97. *****************************************************************************/
  98.  
  99. #ifndef DBNTWIN32
  100.  
  101. #ifndef SHORT
  102. typedef short SHORT;
  103. #endif
  104.  
  105. #ifndef INT
  106. typedef int INT;
  107. #endif
  108.  
  109. #ifndef UINT
  110. typedef unsigned int UINT;
  111. #endif
  112.  
  113. #ifndef USHORT
  114. typedef unsigned short USHORT;
  115. #endif
  116.  
  117. #ifndef ULONG
  118. typedef unsigned long ULONG;
  119. #endif
  120.  
  121. #ifndef CHAR
  122. typedef char CHAR;
  123. #endif
  124.  
  125. #ifndef LPINT
  126. typedef INT PTR LPINT;
  127. #endif
  128.  
  129. typedef unsigned char BYTE;
  130.  
  131. typedef       CHAR PTR LPSTR;
  132. typedef       BYTE PTR LPBYTE;
  133. typedef       void PTR LPVOID;    
  134. typedef const CHAR PTR LPCSTR;
  135.  
  136. typedef int BOOL;
  137.  
  138. #endif
  139.  
  140.  
  141. /*****************************************************************************
  142. * DB-Library datatype definitions                                            *
  143. *****************************************************************************/
  144.  
  145. #define DBMAXCHAR 256 // Max length of DBVARBINARY and DBVARCHAR, etc.
  146.  
  147. #ifndef DBTYPEDEFS    // srv.h (Open Server include) not already included
  148.  
  149. #define DBTYPEDEFS
  150.  
  151. #define RETCODE INT
  152. #define STATUS INT
  153.  
  154. // DB-Library datatypes
  155. typedef char            DBCHAR;
  156. typedef unsigned char   DBBINARY;
  157. typedef unsigned char   DBTINYINT;
  158. typedef short           DBSMALLINT;
  159. typedef unsigned short  DBUSMALLINT;
  160. typedef long            DBINT;
  161. typedef double          DBFLT8;
  162. typedef unsigned char   DBBIT;
  163. typedef unsigned char   DBBOOL;
  164. typedef float           DBFLT4;
  165. typedef long            DBMONEY4;
  166.  
  167. typedef DBFLT4 DBREAL;
  168. typedef UINT   DBUBOOL;
  169.  
  170. typedef struct dbdatetime4
  171. {
  172.     USHORT numdays;        // No of days since Jan-1-1900
  173.     USHORT nummins;        // No. of minutes since midnight
  174. } DBDATETIM4;
  175.  
  176.  
  177. typedef struct dbvarychar
  178. {
  179.     DBSMALLINT  len;
  180.     DBCHAR      str[DBMAXCHAR];
  181. } DBVARYCHAR;
  182.  
  183. typedef struct dbvarybin
  184. {
  185.     DBSMALLINT  len;
  186.     BYTE        array[DBMAXCHAR];
  187. } DBVARYBIN;
  188.  
  189. typedef struct dbmoney
  190. {
  191.     DBINT mnyhigh;
  192.     ULONG mnylow;
  193. } DBMONEY;
  194.  
  195. typedef struct dbdatetime
  196. {
  197.     DBINT dtdays;
  198.     ULONG dttime;
  199. } DBDATETIME;
  200.  
  201. // DBDATEREC structure used by dbdatecrack
  202. typedef struct dbdaterec
  203. {
  204.     INT     year;         // 1753 - 9999
  205.     INT     quarter;      // 1 - 4
  206.     INT     month;        // 1 - 12
  207.     INT     dayofyear;    // 1 - 366
  208.     INT     day;          // 1 - 31
  209.     INT     week;         // 1 - 54 (for leap years)
  210.     INT     weekday;      // 1 - 7  (Mon - Sun)
  211.     INT     hour;         // 0 - 23
  212.     INT     minute;       // 0 - 59
  213.     INT     second;       // 0 - 59
  214.     INT     millisecond;  // 0 - 999
  215. } DBDATEREC;
  216.  
  217. #define MAXNUMERICLEN 16
  218. #define MAXNUMERICDIG 38
  219.  
  220. #define DEFAULTPRECISION 18
  221. #define DEFAULTSCALE     0
  222.  
  223. typedef struct dbnumeric
  224. {
  225.     BYTE precision;
  226.     BYTE scale;
  227.     BYTE sign; // 1 = Positive, 0 = Negative
  228.     BYTE val[MAXNUMERICLEN];
  229. } DBNUMERIC;
  230.  
  231. typedef DBNUMERIC DBDECIMAL;
  232.  
  233.  
  234. // Pack the following structures on a word boundary
  235. #ifdef __BORLANDC__
  236. #pragma option -a+
  237. #else
  238.     #ifndef DBLIB_SKIP_PRAGMA_PACK   // Define this if your compiler does not support #pragma pack()
  239.     #pragma pack(2)
  240.     #endif
  241. #endif
  242.  
  243. #define MAXCOLNAMELEN 30
  244. #define MAXTABLENAME  30
  245.  
  246. typedef struct
  247. {
  248.     DBINT SizeOfStruct;
  249.     CHAR  Name[MAXCOLNAMELEN+1];
  250.     CHAR  ActualName[MAXCOLNAMELEN+1];
  251.     CHAR  TableName[MAXTABLENAME+1];
  252.     SHORT Type;
  253.     DBINT UserType;
  254.     DBINT MaxLength;
  255.     BYTE  Precision;
  256.     BYTE  Scale;
  257.     BOOL  VarLength;     // TRUE, FALSE
  258.     BYTE  Null;          // TRUE, FALSE or DBUNKNOWN
  259.     BYTE  CaseSensitive; // TRUE, FALSE or DBUNKNOWN
  260.     BYTE  Updatable;     // TRUE, FALSE or DBUNKNOWN
  261.     BOOL  Identity;      // TRUE, FALSE
  262. } DBCOL, PTR LPDBCOL;
  263.  
  264.  
  265. #define MAXSERVERNAME 30
  266. #define MAXNETLIBNAME 255
  267. #define MAXNETLIBCONNSTR 255
  268.  
  269. typedef struct
  270. {
  271.     DBINT  SizeOfStruct;
  272.     BYTE   ServerType;
  273.     USHORT ServerMajor;
  274.     USHORT ServerMinor;
  275.     USHORT ServerRevision;
  276.     CHAR   ServerName[MAXSERVERNAME+1];
  277.     CHAR   NetLibName[MAXNETLIBNAME+1];
  278.     CHAR   NetLibConnStr[MAXNETLIBCONNSTR+1];
  279. } DBPROCINFO, PTR LPDBPROCINFO;
  280.  
  281. typedef struct
  282. {
  283.     DBINT SizeOfStruct;   // Use sizeof(DBCURSORINFO)
  284.     ULONG TotCols;        // Total Columns in cursor
  285.     ULONG TotRows;        // Total Rows in cursor
  286.     ULONG CurRow;         // Current actual row in server
  287.     ULONG TotRowsFetched; // Total rows actually fetched
  288.     ULONG Type;           // See CU_...
  289.     ULONG Status;         // See CU_...
  290. } DBCURSORINFO, PTR LPDBCURSORINFO;
  291.  
  292. #define INVALID_UROWNUM ((ULONG)(-1))
  293.  
  294. // Reset default alignment
  295. #ifdef __BORLANDC__
  296. #pragma option -a-
  297. #else
  298.     #ifndef DBLIB_SKIP_PRAGMA_PACK   // Define this if your compiler does not support #pragma pack()
  299.     #pragma pack()
  300.     #endif
  301. #endif
  302.  
  303.  
  304. #endif // End DBTYPEDEFS
  305.  
  306.  
  307. /*****************************************************************************
  308. * Pointer Datatypes                                                          *
  309. *****************************************************************************/
  310.  
  311. typedef const LPINT          LPCINT;
  312. typedef const LPBYTE         LPCBYTE ;
  313. typedef       USHORT PTR     LPUSHORT;
  314. typedef const LPUSHORT       LPCUSHORT;
  315. typedef       DBINT PTR      LPDBINT;
  316. typedef const LPDBINT        LPCDBINT;
  317. typedef       DBBINARY PTR   LPDBBINARY;
  318. typedef const LPDBBINARY     LPCDBBINARY;
  319. typedef       DBDATEREC PTR  LPDBDATEREC;
  320. typedef const LPDBDATEREC    LPCDBDATEREC;
  321. typedef       DBDATETIME PTR LPDBDATETIME;
  322. typedef const LPDBDATETIME   LPCDBDATETIME;
  323.  
  324.  
  325. /*****************************************************************************
  326. * General #defines                                                           *
  327. *****************************************************************************/
  328.  
  329. #define TIMEOUT_IGNORE (ULONG)-1
  330. #define TIMEOUT_INFINITE (ULONG)0
  331. #define TIMEOUT_MAXIMUM (ULONG)1200 // 20 minutes maximum timeout value
  332.  
  333. // Used for ServerType in dbgetprocinfo
  334. #define SERVTYPE_UNKNOWN   0
  335. #define SERVTYPE_MICROSOFT 1
  336.  
  337. // Used by dbcolinfo
  338. enum CI_TYPES { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 };
  339.  
  340. // Bulk Copy Definitions (bcp)
  341. #define DB_IN    1         // Transfer from client to server
  342. #define DB_OUT    2         // Transfer from server to client
  343.  
  344. #define BCPMAXERRS   1    // bcp_control parameter
  345. #define BCPFIRST     2    // bcp_control parameter
  346. #define BCPLAST      3    // bcp_control parameter
  347. #define BCPBATCH     4    // bcp_control parameter
  348. #define BCPKEEPNULLS 5    // bcp_control parameter
  349. #define BCPABORT     6    // bcp_control parameter
  350.  
  351. #ifndef TRUE
  352. #define TRUE 1
  353. #endif
  354.  
  355. #ifndef FALSE
  356. #define FALSE 0
  357. #endif
  358.  
  359. #define TINYBIND         1
  360. #define SMALLBIND        2
  361. #define INTBIND          3
  362. #define CHARBIND         4
  363. #define BINARYBIND       5
  364. #define BITBIND          6
  365. #define DATETIMEBIND     7
  366. #define MONEYBIND        8
  367. #define FLT8BIND         9
  368. #define STRINGBIND      10
  369. #define NTBSTRINGBIND   11
  370. #define VARYCHARBIND    12
  371. #define VARYBINBIND     13
  372. #define FLT4BIND        14
  373. #define SMALLMONEYBIND  15
  374. #define SMALLDATETIBIND 16
  375. #define DECIMALBIND     17
  376. #define NUMERICBIND     18
  377. #define SRCDECIMALBIND  19
  378. #define SRCNUMERICBIND  20
  379. #define MAXBIND         SRCNUMERICBIND
  380.  
  381. #define DBSAVE          1
  382. #define DBNOSAVE        0
  383.  
  384. #define DBNOERR         -1
  385. #define DBFINDONE       0x04  // Definately done
  386. #define DBMORE          0x10  // Maybe more commands waiting
  387. #define DBMORE_ROWS     0x20  // This command returned rows
  388.  
  389. #define MAXNAME         31
  390.  
  391.  
  392. #define DBTXTSLEN       8     // Timestamp length
  393.  
  394. #define DBTXPLEN        16    // Text pointer length
  395.  
  396. // Error code returns
  397. #define INT_EXIT        0
  398. #define INT_CONTINUE    1
  399. #define INT_CANCEL      2
  400.  
  401.  
  402. // dboptions
  403. #define DBBUFFER        0
  404. #define DBOFFSET        1
  405. #define DBROWCOUNT      2
  406. #define DBSTAT          3
  407. #define DBTEXTLIMIT     4
  408. #define DBTEXTSIZE      5
  409. #define DBARITHABORT    6
  410. #define DBARITHIGNORE   7
  411. #define DBNOAUTOFREE    8
  412. #define DBNOCOUNT       9
  413. #define DBNOEXEC        10
  414. #define DBPARSEONLY     11
  415. #define DBSHOWPLAN      12
  416. #define DBSTORPROCID        13
  417.  
  418. #if defined(DBMSWIN) || defined(DBNTWIN32)
  419. #define DBANSItoOEM        14
  420. #endif
  421.  
  422. #ifdef DBNTWIN32
  423. #define DBOEMtoANSI        15
  424. #endif
  425.  
  426. #define DBCLIENTCURSORS 16
  427. #define DBSETTIME 17
  428. #define DBQUOTEDIDENT 18
  429.  
  430.  
  431. // Data Type Tokens
  432. #define SQLVOID        0x1f
  433. #define SQLTEXT        0x23
  434. #define SQLVARBINARY   0x25
  435. #define SQLINTN        0x26
  436. #define SQLVARCHAR     0x27
  437. #define SQLBINARY      0x2d
  438. #define SQLIMAGE       0x22
  439. #define SQLCHAR        0x2f
  440. #define SQLINT1        0x30
  441. #define SQLBIT         0x32
  442. #define SQLINT2        0x34
  443. #define SQLINT4        0x38
  444. #define SQLMONEY       0x3c
  445. #define SQLDATETIME    0x3d
  446. #define SQLFLT8        0x3e
  447. #define SQLFLTN        0x6d
  448. #define SQLMONEYN      0x6e
  449. #define SQLDATETIMN    0x6f
  450. #define SQLFLT4        0x3b
  451. #define SQLMONEY4      0x7a
  452. #define SQLDATETIM4    0x3a
  453. #define SQLDECIMAL     0x6a
  454. #define SQLNUMERIC     0x6c
  455.  
  456. // Data stream tokens
  457. #define SQLCOLFMT      0xa1
  458. #define OLD_SQLCOLFMT  0x2a
  459. #define SQLPROCID      0x7c
  460. #define SQLCOLNAME     0xa0
  461. #define SQLTABNAME     0xa4
  462. #define SQLCOLINFO     0xa5
  463. #define SQLALTNAME     0xa7
  464. #define SQLALTFMT      0xa8
  465. #define SQLERROR       0xaa
  466. #define SQLINFO        0xab
  467. #define SQLRETURNVALUE 0xac
  468. #define SQLRETURNSTATUS 0x79
  469. #define SQLRETURN      0xdb
  470. #define SQLCONTROL     0xae
  471. #define SQLALTCONTROL  0xaf
  472. #define SQLROW         0xd1
  473. #define SQLALTROW      0xd3
  474. #define SQLDONE        0xfd
  475. #define SQLDONEPROC    0xfe
  476. #define SQLDONEINPROC  0xff
  477. #define SQLOFFSET      0x78
  478. #define SQLORDER       0xa9
  479. #define SQLLOGINACK    0xad // NOTICE: change to real value
  480.  
  481. // Ag op tokens
  482. #define SQLAOPCNT        0x4b
  483. #define SQLAOPSUM    0x4d
  484. #define SQLAOPAVG    0x4f
  485. #define SQLAOPMIN    0x51
  486. #define SQLAOPMAX    0x52
  487. #define SQLAOPANY    0x53
  488. #define SQLAOPNOOP   0x56
  489.  
  490. // Error numbers (dberrs) DB-Library error codes
  491. #define SQLEMEM         10000
  492. #define SQLENULL        10001
  493. #define SQLENLOG        10002
  494. #define SQLEPWD         10003
  495. #define SQLECONN        10004
  496. #define SQLEDDNE        10005
  497. #define SQLENULLO       10006
  498. #define SQLESMSG        10007
  499. #define SQLEBTOK        10008
  500. #define SQLENSPE        10009
  501. #define SQLEREAD        10010
  502. #define SQLECNOR        10011
  503. #define SQLETSIT        10012
  504. #define SQLEPARM        10013
  505. #define SQLEAUTN        10014
  506. #define SQLECOFL        10015
  507. #define SQLERDCN        10016
  508. #define SQLEICN         10017
  509. #define SQLECLOS        10018
  510. #define SQLENTXT        10019
  511. #define SQLEDNTI        10020
  512. #define SQLETMTD        10021
  513. #define SQLEASEC        10022
  514. #define SQLENTLL        10023
  515. #define SQLETIME        10024
  516. #define SQLEWRIT        10025
  517. #define SQLEMODE        10026
  518. #define SQLEOOB         10027
  519. #define SQLEITIM        10028
  520. #define SQLEDBPS        10029
  521. #define SQLEIOPT        10030
  522. #define SQLEASNL        10031
  523. #define SQLEASUL        10032
  524. #define SQLENPRM        10033
  525. #define SQLEDBOP        10034
  526. #define SQLENSIP        10035
  527. #define SQLECNULL       10036
  528. #define SQLESEOF        10037
  529. #define SQLERPND        10038
  530. #define SQLECSYN        10039
  531. #define SQLENONET       10040
  532. #define SQLEBTYP        10041
  533. #define SQLEABNC        10042
  534. #define SQLEABMT        10043
  535. #define SQLEABNP        10044
  536. #define SQLEBNCR        10045
  537. #define SQLEAAMT        10046
  538. #define SQLENXID        10047
  539. #define SQLEIFNB        10048
  540. #define SQLEKBCO        10049
  541. #define SQLEBBCI        10050
  542. #define SQLEKBCI        10051
  543. #define SQLEBCWE        10052
  544. #define SQLEBCNN        10053
  545. #define SQLEBCOR        10054
  546. #define SQLEBCPI        10055
  547. #define SQLEBCPN        10056
  548. #define SQLEBCPB        10057
  549. #define SQLEVDPT        10058
  550. #define SQLEBIVI        10059
  551. #define SQLEBCBC        10060
  552. #define SQLEBCFO        10061
  553. #define SQLEBCVH        10062
  554. #define SQLEBCUO        10063
  555. #define SQLEBUOE        10064
  556. #define SQLEBWEF        10065
  557. #define SQLEBTMT        10066
  558. #define SQLEBEOF        10067
  559. #define SQLEBCSI        10068
  560. #define SQLEPNUL        10069
  561. #define SQLEBSKERR      10070
  562. #define SQLEBDIO        10071
  563. #define SQLEBCNT        10072
  564. #define SQLEMDBP        10073
  565. #define SQLINIT         10074
  566. #define SQLCRSINV       10075
  567. #define SQLCRSCMD       10076
  568. #define SQLCRSNOIND     10077
  569. #define SQLCRSDIS       10078
  570. #define SQLCRSAGR       10079
  571. #define SQLCRSORD       10080
  572. #define SQLCRSMEM       10081
  573. #define SQLCRSBSKEY     10082
  574. #define SQLCRSNORES     10083
  575. #define SQLCRSVIEW      10084
  576. #define SQLCRSBUFR      10085
  577. #define SQLCRSFROWN     10086
  578. #define SQLCRSBROL      10087
  579. #define SQLCRSFRAND     10088
  580. #define SQLCRSFLAST     10089
  581. #define SQLCRSRO        10090
  582. #define SQLCRSTAB       10091
  583. #define SQLCRSUPDTAB    10092
  584. #define SQLCRSUPDNB     10093
  585. #define SQLCRSVIIND     10094
  586. #define SQLCRSNOUPD     10095
  587. #define SQLCRSOS2       10096
  588. #define SQLEBCSA        10097
  589. #define SQLEBCRO        10098
  590. #define SQLEBCNE        10099
  591. #define SQLEBCSK        10100
  592. #define SQLEUVBF        10101
  593. #define SQLEBIHC        10102
  594. #define SQLEBWFF        10103
  595. #define SQLNUMVAL       10104
  596. #define SQLEOLDVR       10105
  597. #define SQLEBCPS    10106
  598. #define SQLEDTC     10107
  599. #define SQLENOTIMPL    10108
  600. #define SQLENONFLOAT    10109
  601. #define SQLECONNFB   10110
  602.  
  603.  
  604. // The severity levels are defined here
  605. #define EXINFO          1  // Informational, non-error
  606. #define EXUSER          2  // User error
  607. #define EXNONFATAL      3  // Non-fatal error
  608. #define EXCONVERSION    4  // Error in DB-LIBRARY data conversion
  609. #define EXSERVER        5  // The Server has returned an error flag
  610. #define EXTIME          6  // We have exceeded our timeout period while
  611.                            // waiting for a response from the Server - the
  612.                            // DBPROCESS is still alive
  613. #define EXPROGRAM       7  // Coding error in user program
  614. #define EXRESOURCE      8  // Running out of resources - the DBPROCESS may be dead
  615. #define EXCOMM          9  // Failure in communication with Server - the DBPROCESS is dead
  616. #define EXFATAL         10 // Fatal error - the DBPROCESS is dead
  617. #define EXCONSISTENCY   11 // Internal software error  - notify MS Technical Supprt
  618.  
  619. // Offset identifiers
  620. #define OFF_SELECT      0x16d
  621. #define OFF_FROM        0x14f
  622. #define OFF_ORDER       0x165
  623. #define OFF_COMPUTE     0x139
  624. #define OFF_TABLE       0x173
  625. #define OFF_PROCEDURE   0x16a
  626. #define OFF_STATEMENT   0x1cb
  627. #define OFF_PARAM       0x1c4
  628. #define OFF_EXEC        0x12c
  629.  
  630. // Print lengths for certain fixed length data types
  631. #define PRINT4     11
  632. #define PRINT2     6
  633. #define PRINT1     3
  634. #define PRFLT8     20
  635. #define PRMONEY    26
  636. #define PRBIT      3
  637. #define PRDATETIME 27
  638. #define PRDECIMAL (MAXNUMERICDIG + 2)
  639. #define PRNUMERIC (MAXNUMERICDIG + 2)
  640.  
  641. #define SUCCEED  1
  642. #define FAIL     0
  643. #define SUCCEED_ABORT 2
  644.  
  645. #define DBUNKNOWN 2
  646.  
  647. #define MORE_ROWS    -1
  648. #define NO_MORE_ROWS -2
  649. #define REG_ROW      MORE_ROWS
  650. #define BUF_FULL     -3
  651.  
  652. // Status code for dbresults(). Possible return values are
  653. // SUCCEED, FAIL, and NO_MORE_RESULTS.
  654. #define NO_MORE_RESULTS 2
  655. #define NO_MORE_RPC_RESULTS 3
  656.  
  657. // Macros for dbsetlname()
  658. #define DBSETHOST 1
  659. #define DBSETUSER 2
  660. #define DBSETPWD  3
  661. #define DBSETAPP  4
  662. #define DBSETID   5
  663. #define DBSETLANG 6
  664. #define DBSETSECURE 7
  665. #define DBVER42    8
  666. #define DBVER60    9
  667. #define DBSETLOGINTIME 10
  668. #define DBSETFALLBACK 12
  669.  
  670. // Standard exit and error values
  671. #define STDEXIT  0
  672. #define ERREXIT  -1
  673.  
  674. // dbrpcinit flags
  675. #define DBRPCRECOMPILE  0x0001
  676. #define DBRPCRESET      0x0004
  677. #define DBRPCCURSOR     0x0008
  678.  
  679. // dbrpcparam flags
  680. #define DBRPCRETURN     0x1
  681. #define DBRPCDEFAULT    0x2
  682.  
  683.  
  684. // Cursor related constants
  685.  
  686. // Following flags are used in the concuropt parameter in the dbcursoropen function
  687. #define CUR_READONLY 1 // Read only cursor, no data modifications
  688. #define CUR_LOCKCC   2 // Intent to update, all fetched data locked when
  689.                        // dbcursorfetch is called inside a transaction block
  690. #define CUR_OPTCC    3 // Optimistic concurrency control, data modifications
  691.                        // succeed only if the row hasn't been updated since
  692.                        // the last fetch.
  693. #define CUR_OPTCCVAL 4 // Optimistic concurrency control based on selected column values
  694.  
  695. // Following flags are used in the scrollopt parameter in dbcursoropen
  696. #define CUR_FORWARD 0       // Forward only scrolling
  697. #define CUR_KEYSET  -1      // Keyset driven scrolling
  698. #define CUR_DYNAMIC 1       // Fully dynamic
  699. #define CUR_INSENSITIVE -2  // Server-side cursors only
  700.  
  701. // Following flags define the fetchtype in the dbcursorfetch function
  702. #define FETCH_FIRST    1  // Fetch first n rows
  703. #define FETCH_NEXT     2  // Fetch next n rows
  704. #define FETCH_PREV     3  // Fetch previous n rows
  705. #define FETCH_RANDOM   4  // Fetch n rows beginning with given row #
  706. #define FETCH_RELATIVE 5  // Fetch relative to previous fetch row #
  707. #define FETCH_LAST     6  // Fetch the last n rows
  708.  
  709. // Following flags define the per row status as filled by dbcursorfetch and/or dbcursorfetchex
  710. #define FTC_EMPTY         0x00  // No row available
  711. #define FTC_SUCCEED       0x01  // Fetch succeeded, (failed if not set)
  712. #define FTC_MISSING       0x02  // The row is missing
  713. #define FTC_ENDOFKEYSET   0x04  // End of the keyset reached
  714. #define FTC_ENDOFRESULTS  0x08  // End of results set reached
  715.  
  716. // Following flags define the operator types for the dbcursor function
  717. #define CRS_UPDATE   1  // Update operation
  718. #define CRS_DELETE   2  // Delete operation
  719. #define CRS_INSERT   3  // Insert operation
  720. #define CRS_REFRESH  4  // Refetch given row
  721. #define CRS_LOCKCC   5  // Lock given row
  722.  
  723. // Following value can be passed to the dbcursorbind function for NOBIND type
  724. #define NOBIND -2       // Return length and pointer to data
  725.  
  726. // Following are values used by DBCURSORINFO's Type parameter
  727. #define CU_CLIENT        0x00000001
  728. #define CU_SERVER        0x00000002
  729. #define CU_KEYSET        0x00000004
  730. #define CU_MIXED         0x00000008
  731. #define CU_DYNAMIC       0x00000010
  732. #define CU_FORWARD       0x00000020
  733. #define CU_INSENSITIVE   0x00000040
  734. #define CU_READONLY      0x00000080
  735. #define CU_LOCKCC        0x00000100
  736. #define CU_OPTCC         0x00000200
  737. #define CU_OPTCCVAL      0x00000400
  738.  
  739. // Following are values used by DBCURSORINFO's Status parameter
  740. #define CU_FILLING       0x00000001
  741. #define CU_FILLED        0x00000002
  742.  
  743.  
  744. // Following are values used by dbupdatetext's type parameter
  745. #define UT_TEXTPTR      0x0001
  746. #define UT_TEXT         0x0002
  747. #define UT_MORETEXT     0x0004
  748. #define UT_DELETEONLY   0x0008
  749. #define UT_LOG          0x0010
  750.  
  751.  
  752. // The following values are passed to dbserverenum for searching criteria.
  753. #define NET_SEARCH  0x0001
  754. #define LOC_SEARCH  0x0002
  755.  
  756. // These constants are the possible return values from dbserverenum.
  757. #define ENUM_SUCCESS         0x0000
  758. #define MORE_DATA            0x0001
  759. #define NET_NOT_AVAIL        0x0002
  760. #define OUT_OF_MEMORY        0x0004
  761. #define NOT_SUPPORTED        0x0008
  762. #define ENUM_INVALID_PARAM   0x0010
  763.  
  764.  
  765. // Netlib Error problem codes.  ConnectionError() should return one of
  766. // these as the dblib-mapped problem code, so the corresponding string
  767. // is sent to the dblib app's error handler as dberrstr.  Return NE_E_NOMAP
  768. // for a generic DB-Library error string (as in prior versions of dblib).
  769.  
  770. #define NE_E_NOMAP              0   // No string; uses dblib default.
  771. #define NE_E_NOMEMORY           1   // Insufficient memory.
  772. #define NE_E_NOACCESS           2   // Access denied.
  773. #define NE_E_CONNBUSY           3   // Connection is busy.
  774. #define NE_E_CONNBROKEN         4   // Connection broken.
  775. #define NE_E_TOOMANYCONN        5   // Connection limit exceeded.
  776. #define NE_E_SERVERNOTFOUND     6   // Specified SQL server not found.
  777. #define NE_E_NETNOTSTARTED      7   // The network has not been started.
  778. #define NE_E_NORESOURCE         8   // Insufficient network resources.
  779. #define NE_E_NETBUSY            9   // Network is busy.
  780. #define NE_E_NONETACCESS        10  // Network access denied.
  781. #define NE_E_GENERAL            11  // General network error.  Check your documentation.
  782. #define NE_E_CONNMODE           12  // Incorrect connection mode.
  783. #define NE_E_NAMENOTFOUND       13  // Name not found in directory service.
  784. #define NE_E_INVALIDCONN        14  // Invalid connection.
  785. #define NE_E_NETDATAERR         15  // Error reading or writing network data.
  786. #define NE_E_TOOMANYFILES       16  // Too many open file handles.
  787. #define NE_E_CANTCONNECT          17  // SQL Server does not exist or access denied.
  788.  
  789. #define NE_MAX_NETERROR         17
  790.  
  791. #ifdef __cplusplus
  792. }
  793. #endif
  794.  
  795. #endif // _INC_SQLFRONT
  796.