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