home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / SQLFRONT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  23.9 KB  |  798 lines

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