Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

799 lines
24 KiB

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