home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / sqlfront.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  23.9 KB  |  804 lines

  1. #ifndef _INC_SQLFRONT
  2. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  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 incorrect 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.  
  314.  
  315. #ifndef _LPCBYTE_DEFINED
  316. #define _LPCBYTE_DEFINED
  317. typedef const LPBYTE         LPCBYTE ;
  318. #endif
  319.  
  320. typedef       USHORT PTR     LPUSHORT;
  321. typedef const LPUSHORT       LPCUSHORT;
  322. typedef       DBINT PTR      LPDBINT;
  323. typedef const LPDBINT        LPCDBINT;
  324. typedef       DBBINARY PTR   LPDBBINARY;
  325. typedef const LPDBBINARY     LPCDBBINARY;
  326. typedef       DBDATEREC PTR  LPDBDATEREC;
  327. typedef const LPDBDATEREC    LPCDBDATEREC;
  328. typedef       DBDATETIME PTR LPDBDATETIME;
  329. typedef const LPDBDATETIME   LPCDBDATETIME;
  330.  
  331.  
  332. /*****************************************************************************
  333. * General #defines                                                           *
  334. *****************************************************************************/
  335.  
  336. #define TIMEOUT_IGNORE (ULONG)-1
  337. #define TIMEOUT_INFINITE (ULONG)0
  338. #define TIMEOUT_MAXIMUM (ULONG)1200 // 20 minutes maximum timeout value
  339.  
  340. // Used for ServerType in dbgetprocinfo
  341. #define SERVTYPE_UNKNOWN   0
  342. #define SERVTYPE_MICROSOFT 1
  343.  
  344. // Used by dbcolinfo
  345. enum CI_TYPES { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 };
  346.  
  347. // Bulk Copy Definitions (bcp)
  348. #define DB_IN    1         // Transfer from client to server
  349. #define DB_OUT    2         // Transfer from server to client
  350.  
  351. #define BCPMAXERRS   1    // bcp_control parameter
  352. #define BCPFIRST     2    // bcp_control parameter
  353. #define BCPLAST      3    // bcp_control parameter
  354. #define BCPBATCH     4    // bcp_control parameter
  355. #define BCPKEEPNULLS 5    // bcp_control parameter
  356. #define BCPABORT     6    // bcp_control parameter
  357.  
  358. #ifndef TRUE
  359. #define TRUE 1
  360. #endif
  361.  
  362. #ifndef FALSE
  363. #define FALSE 0
  364. #endif
  365.  
  366. #define TINYBIND         1
  367. #define SMALLBIND        2
  368. #define INTBIND          3
  369. #define CHARBIND         4
  370. #define BINARYBIND       5
  371. #define BITBIND          6
  372. #define DATETIMEBIND     7
  373. #define MONEYBIND        8
  374. #define FLT8BIND         9
  375. #define STRINGBIND      10
  376. #define NTBSTRINGBIND   11
  377. #define VARYCHARBIND    12
  378. #define VARYBINBIND     13
  379. #define FLT4BIND        14
  380. #define SMALLMONEYBIND  15
  381. #define SMALLDATETIBIND 16
  382. #define DECIMALBIND     17
  383. #define NUMERICBIND     18
  384. #define SRCDECIMALBIND  19
  385. #define SRCNUMERICBIND  20
  386. #define MAXBIND         SRCNUMERICBIND
  387.  
  388. #define DBSAVE          1
  389. #define DBNOSAVE        0
  390.  
  391. #define DBNOERR         -1
  392. #define DBFINDONE       0x04  // Definately done
  393. #define DBMORE          0x10  // Maybe more commands waiting
  394. #define DBMORE_ROWS     0x20  // This command returned rows
  395.  
  396. #define MAXNAME         31
  397.  
  398.  
  399. #define DBTXTSLEN       8     // Timestamp length
  400.  
  401. #define DBTXPLEN        16    // Text pointer length
  402.  
  403. // Error code returns
  404. #define INT_EXIT        0
  405. #define INT_CONTINUE    1
  406. #define INT_CANCEL      2
  407.  
  408.  
  409. // dboptions
  410. #define DBBUFFER        0
  411. #define DBOFFSET        1
  412. #define DBROWCOUNT      2
  413. #define DBSTAT          3
  414. #define DBTEXTLIMIT     4
  415. #define DBTEXTSIZE      5
  416. #define DBARITHABORT    6
  417. #define DBARITHIGNORE   7
  418. #define DBNOAUTOFREE    8
  419. #define DBNOCOUNT       9
  420. #define DBNOEXEC        10
  421. #define DBPARSEONLY     11
  422. #define DBSHOWPLAN      12
  423. #define DBSTORPROCID        13
  424.  
  425. #if defined(DBMSWIN) || defined(DBNTWIN32)
  426. #define DBANSItoOEM        14
  427. #endif
  428.  
  429. #ifdef DBNTWIN32
  430. #define DBOEMtoANSI        15
  431. #endif
  432.  
  433. #define DBCLIENTCURSORS 16
  434. #define DBSETTIME 17
  435. #define DBQUOTEDIDENT 18
  436.  
  437.  
  438. // Data Type Tokens
  439. #define SQLVOID        0x1f
  440. #define SQLTEXT        0x23
  441. #define SQLVARBINARY   0x25
  442. #define SQLINTN        0x26
  443. #define SQLVARCHAR     0x27
  444. #define SQLBINARY      0x2d
  445. #define SQLIMAGE       0x22
  446. #define SQLCHAR        0x2f
  447. #define SQLINT1        0x30
  448. #define SQLBIT         0x32
  449. #define SQLINT2        0x34
  450. #define SQLINT4        0x38
  451. #define SQLMONEY       0x3c
  452. #define SQLDATETIME    0x3d
  453. #define SQLFLT8        0x3e
  454. #define SQLFLTN        0x6d
  455. #define SQLMONEYN      0x6e
  456. #define SQLDATETIMN    0x6f
  457. #define SQLFLT4        0x3b
  458. #define SQLMONEY4      0x7a
  459. #define SQLDATETIM4    0x3a
  460. #define SQLDECIMAL     0x6a
  461. #define SQLNUMERIC     0x6c
  462.  
  463. // Data stream tokens
  464. #define SQLCOLFMT      0xa1
  465. #define OLD_SQLCOLFMT  0x2a
  466. #define SQLPROCID      0x7c
  467. #define SQLCOLNAME     0xa0
  468. #define SQLTABNAME     0xa4
  469. #define SQLCOLINFO     0xa5
  470. #define SQLALTNAME     0xa7
  471. #define SQLALTFMT      0xa8
  472. #define SQLERROR       0xaa
  473. #define SQLINFO        0xab
  474. #define SQLRETURNVALUE 0xac
  475. #define SQLRETURNSTATUS 0x79
  476. #define SQLRETURN      0xdb
  477. #define SQLCONTROL     0xae
  478. #define SQLALTCONTROL  0xaf
  479. #define SQLROW         0xd1
  480. #define SQLALTROW      0xd3
  481. #define SQLDONE        0xfd
  482. #define SQLDONEPROC    0xfe
  483. #define SQLDONEINPROC  0xff
  484. #define SQLOFFSET      0x78
  485. #define SQLORDER       0xa9
  486. #define SQLLOGINACK    0xad // NOTICE: change to real value
  487.  
  488. // Ag op tokens
  489. #define SQLAOPCNT        0x4b
  490. #define SQLAOPSUM    0x4d
  491. #define SQLAOPAVG    0x4f
  492. #define SQLAOPMIN    0x51
  493. #define SQLAOPMAX    0x52
  494. #define SQLAOPANY    0x53
  495. #define SQLAOPNOOP   0x56
  496.  
  497. // Error numbers (dberrs) DB-Library error codes
  498. #define SQLEMEM         10000
  499. #define SQLENULL        10001
  500. #define SQLENLOG        10002
  501. #define SQLEPWD         10003
  502. #define SQLECONN        10004
  503. #define SQLEDDNE        10005
  504. #define SQLENULLO       10006
  505. #define SQLESMSG        10007
  506. #define SQLEBTOK        10008
  507. #define SQLENSPE        10009
  508. #define SQLEREAD        10010
  509. #define SQLECNOR        10011
  510. #define SQLETSIT        10012
  511. #define SQLEPARM        10013
  512. #define SQLEAUTN        10014
  513. #define SQLECOFL        10015
  514. #define SQLERDCN        10016
  515. #define SQLEICN         10017
  516. #define SQLECLOS        10018
  517. #define SQLENTXT        10019
  518. #define SQLEDNTI        10020
  519. #define SQLETMTD        10021
  520. #define SQLEASEC        10022
  521. #define SQLENTLL        10023
  522. #define SQLETIME        10024
  523. #define SQLEWRIT        10025
  524. #define SQLEMODE        10026
  525. #define SQLEOOB         10027
  526. #define SQLEITIM        10028
  527. #define SQLEDBPS        10029
  528. #define SQLEIOPT        10030
  529. #define SQLEASNL        10031
  530. #define SQLEASUL        10032
  531. #define SQLENPRM        10033
  532. #define SQLEDBOP        10034
  533. #define SQLENSIP        10035
  534. #define SQLECNULL       10036
  535. #define SQLESEOF        10037
  536. #define SQLERPND        10038
  537. #define SQLECSYN        10039
  538. #define SQLENONET       10040
  539. #define SQLEBTYP        10041
  540. #define SQLEABNC        10042
  541. #define SQLEABMT        10043
  542. #define SQLEABNP        10044
  543. #define SQLEBNCR        10045
  544. #define SQLEAAMT        10046
  545. #define SQLENXID        10047
  546. #define SQLEIFNB        10048
  547. #define SQLEKBCO        10049
  548. #define SQLEBBCI        10050
  549. #define SQLEKBCI        10051
  550. #define SQLEBCWE        10052
  551. #define SQLEBCNN        10053
  552. #define SQLEBCOR        10054
  553. #define SQLEBCPI        10055
  554. #define SQLEBCPN        10056
  555. #define SQLEBCPB        10057
  556. #define SQLEVDPT        10058
  557. #define SQLEBIVI        10059
  558. #define SQLEBCBC        10060
  559. #define SQLEBCFO        10061
  560. #define SQLEBCVH        10062
  561. #define SQLEBCUO        10063
  562. #define SQLEBUOE        10064
  563. #define SQLEBWEF        10065
  564. #define SQLEBTMT        10066
  565. #define SQLEBEOF        10067
  566. #define SQLEBCSI        10068
  567. #define SQLEPNUL        10069
  568. #define SQLEBSKERR      10070
  569. #define SQLEBDIO        10071
  570. #define SQLEBCNT        10072
  571. #define SQLEMDBP        10073
  572. #define SQLINIT         10074
  573. #define SQLCRSINV       10075
  574. #define SQLCRSCMD       10076
  575. #define SQLCRSNOIND     10077
  576. #define SQLCRSDIS       10078
  577. #define SQLCRSAGR       10079
  578. #define SQLCRSORD       10080
  579. #define SQLCRSMEM       10081
  580. #define SQLCRSBSKEY     10082
  581. #define SQLCRSNORES     10083
  582. #define SQLCRSVIEW      10084
  583. #define SQLCRSBUFR      10085
  584. #define SQLCRSFROWN     10086
  585. #define SQLCRSBROL      10087
  586. #define SQLCRSFRAND     10088
  587. #define SQLCRSFLAST     10089
  588. #define SQLCRSRO        10090
  589. #define SQLCRSTAB       10091
  590. #define SQLCRSUPDTAB    10092
  591. #define SQLCRSUPDNB     10093
  592. #define SQLCRSVIIND     10094
  593. #define SQLCRSNOUPD     10095
  594. #define SQLCRSOS2       10096
  595. #define SQLEBCSA        10097
  596. #define SQLEBCRO        10098
  597. #define SQLEBCNE        10099
  598. #define SQLEBCSK        10100
  599. #define SQLEUVBF        10101
  600. #define SQLEBIHC        10102
  601. #define SQLEBWFF        10103
  602. #define SQLNUMVAL       10104
  603. #define SQLEOLDVR       10105
  604. #define SQLEBCPS    10106
  605. #define SQLEDTC     10107
  606. #define SQLENOTIMPL    10108
  607. #define SQLENONFLOAT    10109
  608. #define SQLECONNFB   10110
  609.  
  610.  
  611. // The severity levels are defined here
  612. #define EXINFO          1  // Informational, non-error
  613. #define EXUSER          2  // User error
  614. #define EXNONFATAL      3  // Non-fatal error
  615. #define EXCONVERSION    4  // Error in DB-LIBRARY data conversion
  616. #define EXSERVER        5  // The Server has returned an error flag
  617. #define EXTIME          6  // We have exceeded our timeout period while
  618.                            // waiting for a response from the Server - the
  619.                            // DBPROCESS is still alive
  620. #define EXPROGRAM       7  // Coding error in user program
  621. #define EXRESOURCE      8  // Running out of resources - the DBPROCESS may be dead
  622. #define EXCOMM          9  // Failure in communication with Server - the DBPROCESS is dead
  623. #define EXFATAL         10 // Fatal error - the DBPROCESS is dead
  624. #define EXCONSISTENCY   11 // Internal software error  - notify MS Technical Supprt
  625.  
  626. // Offset identifiers
  627. #define OFF_SELECT      0x16d
  628. #define OFF_FROM        0x14f
  629. #define OFF_ORDER       0x165
  630. #define OFF_COMPUTE     0x139
  631. #define OFF_TABLE       0x173
  632. #define OFF_PROCEDURE   0x16a
  633. #define OFF_STATEMENT   0x1cb
  634. #define OFF_PARAM       0x1c4
  635. #define OFF_EXEC        0x12c
  636.  
  637. // Print lengths for certain fixed length data types
  638. #define PRINT4     11
  639. #define PRINT2     6
  640. #define PRINT1     3
  641. #define PRFLT8     20
  642. #define PRMONEY    26
  643. #define PRBIT      3
  644. #define PRDATETIME 27
  645. #define PRDECIMAL (MAXNUMERICDIG + 2)
  646. #define PRNUMERIC (MAXNUMERICDIG + 2)
  647.  
  648. #define SUCCEED  1
  649. #define FAIL     0
  650. #define SUCCEED_ABORT 2
  651.  
  652. #define DBUNKNOWN 2
  653.  
  654. #define MORE_ROWS    -1
  655. #define NO_MORE_ROWS -2
  656. #define REG_ROW      MORE_ROWS
  657. #define BUF_FULL     -3
  658.  
  659. // Status code for dbresults(). Possible return values are
  660. // SUCCEED, FAIL, and NO_MORE_RESULTS.
  661. #define NO_MORE_RESULTS 2
  662. #define NO_MORE_RPC_RESULTS 3
  663.  
  664. // Macros for dbsetlname()
  665. #define DBSETHOST 1
  666. #define DBSETUSER 2
  667. #define DBSETPWD  3
  668. #define DBSETAPP  4
  669. #define DBSETID   5
  670. #define DBSETLANG 6
  671. #define DBSETSECURE 7
  672. #define DBVER42    8
  673. #define DBVER60    9
  674. #define DBSETLOGINTIME 10
  675. #define DBSETFALLBACK 12
  676.  
  677. // Standard exit and error values
  678. #define STDEXIT  0
  679. #define ERREXIT  -1
  680.  
  681. // dbrpcinit flags
  682. #define DBRPCRECOMPILE  0x0001
  683. #define DBRPCRESET      0x0004
  684. #define DBRPCCURSOR     0x0008
  685.  
  686. // dbrpcparam flags
  687. #define DBRPCRETURN     0x1
  688. #define DBRPCDEFAULT    0x2
  689.  
  690.  
  691. // Cursor related constants
  692.  
  693. // Following flags are used in the concuropt parameter in the dbcursoropen function
  694. #define CUR_READONLY 1 // Read only cursor, no data modifications
  695. #define CUR_LOCKCC   2 // Intent to update, all fetched data locked when
  696.                        // dbcursorfetch is called inside a transaction block
  697. #define CUR_OPTCC    3 // Optimistic concurrency control, data modifications
  698.                        // succeed only if the row hasn't been updated since
  699.                        // the last fetch.
  700. #define CUR_OPTCCVAL 4 // Optimistic concurrency control based on selected column values
  701.  
  702. // Following flags are used in the scrollopt parameter in dbcursoropen
  703. #define CUR_FORWARD 0       // Forward only scrolling
  704. #define CUR_KEYSET  -1      // Keyset driven scrolling
  705. #define CUR_DYNAMIC 1       // Fully dynamic
  706. #define CUR_INSENSITIVE -2  // Server-side cursors only
  707.  
  708. // Following flags define the fetchtype in the dbcursorfetch function
  709. #define FETCH_FIRST    1  // Fetch first n rows
  710. #define FETCH_NEXT     2  // Fetch next n rows
  711. #define FETCH_PREV     3  // Fetch previous n rows
  712. #define FETCH_RANDOM   4  // Fetch n rows beginning with given row #
  713. #define FETCH_RELATIVE 5  // Fetch relative to previous fetch row #
  714. #define FETCH_LAST     6  // Fetch the last n rows
  715.  
  716. // Following flags define the per row status as filled by dbcursorfetch and/or dbcursorfetchex
  717. #define FTC_EMPTY         0x00  // No row available
  718. #define FTC_SUCCEED       0x01  // Fetch succeeded, (failed if not set)
  719. #define FTC_MISSING       0x02  // The row is missing
  720. #define FTC_ENDOFKEYSET   0x04  // End of the keyset reached
  721. #define FTC_ENDOFRESULTS  0x08  // End of results set reached
  722.  
  723. // Following flags define the operator types for the dbcursor function
  724. #define CRS_UPDATE   1  // Update operation
  725. #define CRS_DELETE   2  // Delete operation
  726. #define CRS_INSERT   3  // Insert operation
  727. #define CRS_REFRESH  4  // Refetch given row
  728. #define CRS_LOCKCC   5  // Lock given row
  729.  
  730. // Following value can be passed to the dbcursorbind function for NOBIND type
  731. #define NOBIND -2       // Return length and pointer to data
  732.  
  733. // Following are values used by DBCURSORINFO's Type parameter
  734. #define CU_CLIENT        0x00000001
  735. #define CU_SERVER        0x00000002
  736. #define CU_KEYSET        0x00000004
  737. #define CU_MIXED         0x00000008
  738. #define CU_DYNAMIC       0x00000010
  739. #define CU_FORWARD       0x00000020
  740. #define CU_INSENSITIVE   0x00000040
  741. #define CU_READONLY      0x00000080
  742. #define CU_LOCKCC        0x00000100
  743. #define CU_OPTCC         0x00000200
  744. #define CU_OPTCCVAL      0x00000400
  745.  
  746. // Following are values used by DBCURSORINFO's Status parameter
  747. #define CU_FILLING       0x00000001
  748. #define CU_FILLED        0x00000002
  749.  
  750.  
  751. // Following are values used by dbupdatetext's type parameter
  752. #define UT_TEXTPTR      0x0001
  753. #define UT_TEXT         0x0002
  754. #define UT_MORETEXT     0x0004
  755. #define UT_DELETEONLY   0x0008
  756. #define UT_LOG          0x0010
  757.  
  758.  
  759. // The following values are passed to dbserverenum for searching criteria.
  760. #define NET_SEARCH  0x0001
  761. #define LOC_SEARCH  0x0002
  762.  
  763. // These constants are the possible return values from dbserverenum.
  764. #define ENUM_SUCCESS         0x0000
  765. #define MORE_DATA            0x0001
  766. #define NET_NOT_AVAIL        0x0002
  767. #define OUT_OF_MEMORY        0x0004
  768. #define NOT_SUPPORTED        0x0008
  769. #define ENUM_INVALID_PARAM   0x0010
  770.  
  771.  
  772. // Netlib Error problem codes.  ConnectionError() should return one of
  773. // these as the dblib-mapped problem code, so the corresponding string
  774. // is sent to the dblib app's error handler as dberrstr.  Return NE_E_NOMAP
  775. // for a generic DB-Library error string (as in prior versions of dblib).
  776.  
  777. #define NE_E_NOMAP              0   // No string; uses dblib default.
  778. #define NE_E_NOMEMORY           1   // Insufficient memory.
  779. #define NE_E_NOACCESS           2   // Access denied.
  780. #define NE_E_CONNBUSY           3   // Connection is busy.
  781. #define NE_E_CONNBROKEN         4   // Connection broken.
  782. #define NE_E_TOOMANYCONN        5   // Connection limit exceeded.
  783. #define NE_E_SERVERNOTFOUND     6   // Specified SQL server not found.
  784. #define NE_E_NETNOTSTARTED      7   // The network has not been started.
  785. #define NE_E_NORESOURCE         8   // Insufficient network resources.
  786. #define NE_E_NETBUSY            9   // Network is busy.
  787. #define NE_E_NONETACCESS        10  // Network access denied.
  788. #define NE_E_GENERAL            11  // General network error.  Check your documentation.
  789. #define NE_E_CONNMODE           12  // Incorrect connection mode.
  790. #define NE_E_NAMENOTFOUND       13  // Name not found in directory service.
  791. #define NE_E_INVALIDCONN        14  // Invalid connection.
  792. #define NE_E_NETDATAERR         15  // Error reading or writing network data.
  793. #define NE_E_TOOMANYFILES       16  // Too many open file handles.
  794. #define NE_E_CANTCONNECT          17  // SQL Server does not exist or access denied.
  795.  
  796. #define NE_MAX_NETERROR         17
  797.  
  798. #ifdef __cplusplus
  799. }
  800. #endif
  801.  
  802. #pragma option pop /*P_O_Pop*/
  803. #endif // _INC_SQLFRONT
  804.