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

  1. /*****************************************************************
  2. ** SQL.H - This is the the main include for ODBC Core functions.
  3. **
  4. ** preconditions:
  5. **      #include "windows.h"
  6. **
  7. ** (C) Copyright 1990 - 1998 By Microsoft Corp.
  8. **
  9. **      Updated 5/12/93 for 2.00 specification
  10. **      Updated 5/23/94 for 2.01 specification
  11. **      Updated 11/10/94 for 2.10 specification
  12. **      Updated 04/10/95 for 2.50 specification
  13. **      Updated 6/6/95  for 3.00 specification
  14. **        Updated 10/22/97 for 3.51 specification 
  15. *********************************************************************/
  16.  
  17.  
  18. #ifndef __SQL
  19. #define __SQL
  20.  
  21. /*
  22. * ODBCVER  ODBC version number (0x0351).   To exclude
  23. *          definitions introduced in version 3.5 (or above)
  24. *          #define ODBCVER 0x0300 before #including <sql.h>
  25. */
  26. #ifndef ODBCVER
  27. #define ODBCVER 0x0351
  28. #endif
  29.  
  30. #ifndef __SQLTYPES
  31. #include "sqltypes.h"
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {             /* Assume C declarations for C++   */
  36. #endif  /* __cplusplus */
  37.  
  38. /* special length/indicator values */
  39. #define SQL_NULL_DATA             (-1)
  40. #define SQL_DATA_AT_EXEC          (-2)
  41.  
  42.  
  43. /* return values from functions */
  44. #define SQL_SUCCESS                0
  45. #define SQL_SUCCESS_WITH_INFO      1
  46. #if (ODBCVER >= 0x0300)
  47. #define SQL_NO_DATA              100
  48. #endif
  49. #define SQL_ERROR                 (-1)
  50. #define SQL_INVALID_HANDLE        (-2)
  51.  
  52. #define SQL_STILL_EXECUTING        2
  53. #define SQL_NEED_DATA             99
  54.  
  55. /* test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */
  56. #define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
  57.  
  58. /* flags for null-terminated string */
  59. #define SQL_NTS                   (-3)
  60. #define SQL_NTSL                  (-3L)
  61.  
  62. /* maximum message length */
  63. #define SQL_MAX_MESSAGE_LENGTH   512
  64.  
  65. /* date/time length constants */
  66. #if (ODBCVER >= 0x0300)
  67. #define SQL_DATE_LEN           10
  68. #define SQL_TIME_LEN            8  /* add P+1 if precision is nonzero */
  69. #define SQL_TIMESTAMP_LEN      19  /* add P+1 if precision is nonzero */
  70. #endif
  71.  
  72. /* handle type identifiers */
  73. #if (ODBCVER >= 0x0300)
  74. #define SQL_HANDLE_ENV             1
  75. #define SQL_HANDLE_DBC             2
  76. #define SQL_HANDLE_STMT            3
  77. #define SQL_HANDLE_DESC            4
  78. #endif
  79.  
  80. /* environment attribute */
  81. #if (ODBCVER >= 0x0300)
  82. #define SQL_ATTR_OUTPUT_NTS    10001
  83. #endif
  84.  
  85. /* connection attributes */
  86. #if (ODBCVER >= 0x0300)
  87. #define SQL_ATTR_AUTO_IPD      10001
  88. #define SQL_ATTR_METADATA_ID   10014
  89. #endif  /* ODBCVER >= 0x0300 */
  90.  
  91. /* statement attributes */
  92. #if (ODBCVER >= 0x0300)
  93. #define SQL_ATTR_APP_ROW_DESC       10010
  94. #define SQL_ATTR_APP_PARAM_DESC     10011
  95. #define SQL_ATTR_IMP_ROW_DESC       10012
  96. #define SQL_ATTR_IMP_PARAM_DESC     10013
  97. #define SQL_ATTR_CURSOR_SCROLLABLE  (-1)
  98. #define SQL_ATTR_CURSOR_SENSITIVITY (-2)
  99. #endif
  100.  
  101. /* SQL_ATTR_CURSOR_SCROLLABLE values */
  102. #if (ODBCVER >= 0x0300)
  103. #define SQL_NONSCROLLABLE            0
  104. #define SQL_SCROLLABLE                1
  105. #endif  /* ODBCVER >= 0x0300 */
  106.  
  107. /* identifiers of fields in the SQL descriptor */
  108. #if (ODBCVER >= 0x0300)
  109. #define SQL_DESC_COUNT                  1001
  110. #define SQL_DESC_TYPE                   1002
  111. #define SQL_DESC_LENGTH                 1003
  112. #define SQL_DESC_OCTET_LENGTH_PTR       1004
  113. #define SQL_DESC_PRECISION              1005
  114. #define SQL_DESC_SCALE                  1006
  115. #define SQL_DESC_DATETIME_INTERVAL_CODE 1007
  116. #define SQL_DESC_NULLABLE               1008
  117. #define SQL_DESC_INDICATOR_PTR          1009
  118. #define SQL_DESC_DATA_PTR               1010
  119. #define SQL_DESC_NAME                   1011
  120. #define SQL_DESC_UNNAMED                1012
  121. #define SQL_DESC_OCTET_LENGTH           1013
  122. #define SQL_DESC_ALLOC_TYPE             1099
  123. #endif
  124.  
  125. /* identifiers of fields in the diagnostics area */
  126. #if (ODBCVER >= 0x0300)
  127. #define SQL_DIAG_RETURNCODE        1
  128. #define SQL_DIAG_NUMBER            2
  129. #define SQL_DIAG_ROW_COUNT         3
  130. #define SQL_DIAG_SQLSTATE          4
  131. #define SQL_DIAG_NATIVE            5
  132. #define SQL_DIAG_MESSAGE_TEXT      6
  133. #define SQL_DIAG_DYNAMIC_FUNCTION  7
  134. #define SQL_DIAG_CLASS_ORIGIN      8
  135. #define SQL_DIAG_SUBCLASS_ORIGIN   9
  136. #define SQL_DIAG_CONNECTION_NAME  10
  137. #define SQL_DIAG_SERVER_NAME      11
  138. #define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12
  139. #endif
  140.  
  141. /* dynamic function codes */
  142. #if (ODBCVER >= 0x0300)
  143. #define SQL_DIAG_ALTER_DOMAIN            3
  144. #define SQL_DIAG_ALTER_TABLE            4
  145. #define SQL_DIAG_CALL                    7
  146. #define SQL_DIAG_CREATE_ASSERTION        6
  147. #define SQL_DIAG_CREATE_CHARACTER_SET    8
  148. #define SQL_DIAG_CREATE_COLLATION        10
  149. #define SQL_DIAG_CREATE_DOMAIN            23
  150. #define SQL_DIAG_CREATE_INDEX          (-1)
  151. #define SQL_DIAG_CREATE_SCHEMA            64
  152. #define SQL_DIAG_CREATE_TABLE          77
  153. #define SQL_DIAG_CREATE_TRANSLATION        79
  154. #define SQL_DIAG_CREATE_VIEW           84
  155. #define SQL_DIAG_DELETE_WHERE          19
  156. #define    SQL_DIAG_DROP_ASSERTION            24
  157. #define    SQL_DIAG_DROP_CHARACTER_SET        25
  158. #define    SQL_DIAG_DROP_COLLATION            26
  159. #define    SQL_DIAG_DROP_DOMAIN            27
  160. #define SQL_DIAG_DROP_INDEX            (-2)
  161. #define SQL_DIAG_DROP_SCHEMA            31
  162. #define SQL_DIAG_DROP_TABLE            32
  163. #define SQL_DIAG_DROP_TRANSLATION      33
  164. #define SQL_DIAG_DROP_VIEW             36
  165. #define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38
  166. #define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81
  167. #define SQL_DIAG_GRANT                 48
  168. #define SQL_DIAG_INSERT                50
  169. #define SQL_DIAG_REVOKE                59
  170. #define SQL_DIAG_SELECT_CURSOR         85
  171. #define SQL_DIAG_UNKNOWN_STATEMENT      0
  172. #define SQL_DIAG_UPDATE_WHERE          82
  173. #endif  /* ODBCVER >= 0x0300 */
  174.  
  175. /* SQL data type codes */
  176. #define    SQL_UNKNOWN_TYPE    0
  177. #define SQL_CHAR            1
  178. #define SQL_NUMERIC         2
  179. #define SQL_DECIMAL         3
  180. #define SQL_INTEGER         4
  181. #define SQL_SMALLINT        5
  182. #define SQL_FLOAT           6
  183. #define SQL_REAL            7
  184. #define SQL_DOUBLE          8
  185. #if (ODBCVER >= 0x0300)
  186. #define SQL_DATETIME        9
  187. #endif
  188. #define SQL_VARCHAR        12
  189.  
  190. /* One-parameter shortcuts for date/time data types */
  191. #if (ODBCVER >= 0x0300)
  192. #define SQL_TYPE_DATE      91
  193. #define SQL_TYPE_TIME      92
  194. #define SQL_TYPE_TIMESTAMP 93
  195. #endif
  196.  
  197. /* Statement attribute values for cursor sensitivity */
  198. #if (ODBCVER >= 0x0300)
  199. #define SQL_UNSPECIFIED     0
  200. #define SQL_INSENSITIVE     1
  201. #define SQL_SENSITIVE       2
  202. #endif
  203.  
  204. /* GetTypeInfo() request for all data types */
  205. #define SQL_ALL_TYPES       0
  206.  
  207. /* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */
  208. #if (ODBCVER >= 0x0300)
  209. #define SQL_DEFAULT        99
  210. #endif
  211.  
  212. /* SQLGetData() code indicating that the application row descriptor
  213.  * specifies the data type
  214.  */
  215. #if (ODBCVER >= 0x0300)
  216. #define SQL_ARD_TYPE      (-99)
  217. #endif
  218.  
  219. /* SQL date/time type subcodes */
  220. #if (ODBCVER >= 0x0300)
  221. #define SQL_CODE_DATE       1
  222. #define SQL_CODE_TIME       2
  223. #define SQL_CODE_TIMESTAMP  3
  224. #endif
  225.  
  226. /* CLI option values */
  227. #if (ODBCVER >= 0x0300)
  228. #define SQL_FALSE           0
  229. #define SQL_TRUE            1
  230. #endif
  231.  
  232. /* values of NULLABLE field in descriptor */
  233. #define SQL_NO_NULLS        0
  234. #define SQL_NULLABLE        1
  235.  
  236. /* Value returned by SQLGetTypeInfo() to denote that it is
  237.  * not known whether or not a data type supports null values.
  238.  */
  239. #define SQL_NULLABLE_UNKNOWN  2
  240.  
  241. /* Values returned by SQLGetTypeInfo() to show WHERE clause
  242.  * supported
  243.  */
  244. #if (ODBCVER >= 0x0300)
  245. #define SQL_PRED_NONE     0
  246. #define SQL_PRED_CHAR     1
  247. #define SQL_PRED_BASIC    2
  248. #endif
  249.  
  250. /* values of UNNAMED field in descriptor */
  251. #if (ODBCVER >= 0x0300)
  252. #define SQL_NAMED           0
  253. #define SQL_UNNAMED         1
  254. #endif
  255.  
  256. /* values of ALLOC_TYPE field in descriptor */
  257. #if (ODBCVER >= 0x0300)
  258. #define SQL_DESC_ALLOC_AUTO 1
  259. #define SQL_DESC_ALLOC_USER 2
  260. #endif
  261.  
  262. /* FreeStmt() options */
  263. #define SQL_CLOSE           0
  264. #define SQL_DROP            1
  265. #define SQL_UNBIND          2
  266. #define SQL_RESET_PARAMS    3
  267.  
  268. /* Codes used for FetchOrientation in SQLFetchScroll(), 
  269.    and in SQLDataSources() 
  270. */
  271. #define SQL_FETCH_NEXT      1
  272. #define SQL_FETCH_FIRST     2
  273.  
  274. /* Other codes used for FetchOrientation in SQLFetchScroll() */
  275. #define SQL_FETCH_LAST      3
  276. #define SQL_FETCH_PRIOR     4
  277. #define SQL_FETCH_ABSOLUTE  5
  278. #define SQL_FETCH_RELATIVE  6
  279.  
  280. /* SQLEndTran() options */
  281. #define SQL_COMMIT          0
  282. #define SQL_ROLLBACK        1
  283.  
  284. /* null handles returned by SQLAllocHandle() */
  285. #define SQL_NULL_HENV       0
  286. #define SQL_NULL_HDBC       0
  287. #define SQL_NULL_HSTMT      0
  288. #if (ODBCVER >= 0x0300)
  289. #define SQL_NULL_HDESC      0
  290. #endif
  291.  
  292. /* null handle used in place of parent handle when allocating HENV */
  293. #if (ODBCVER >= 0x0300)
  294. #define SQL_NULL_HANDLE     0L
  295. #endif
  296.  
  297. /* Values that may appear in the result set of SQLSpecialColumns() */
  298. #define SQL_SCOPE_CURROW    0
  299. #define SQL_SCOPE_TRANSACTION 1
  300. #define SQL_SCOPE_SESSION   2
  301.  
  302. #define SQL_PC_UNKNOWN      0
  303. #if (ODBCVER >= 0x0300)
  304. #define SQL_PC_NON_PSEUDO   1
  305. #endif
  306. #define SQL_PC_PSEUDO       2
  307.  
  308. /* Reserved value for the IdentifierType argument of SQLSpecialColumns() */
  309. #if (ODBCVER >= 0x0300)
  310. #define SQL_ROW_IDENTIFIER  1
  311. #endif
  312.  
  313. /* Reserved values for UNIQUE argument of SQLStatistics() */
  314. #define SQL_INDEX_UNIQUE    0
  315. #define SQL_INDEX_ALL       1
  316.  
  317. /* Values that may appear in the result set of SQLStatistics() */
  318. #define SQL_INDEX_CLUSTERED 1
  319. #define SQL_INDEX_HASHED    2
  320. #define SQL_INDEX_OTHER     3
  321.  
  322. /* SQLGetFunctions() values to identify ODBC APIs */
  323. #define SQL_API_SQLALLOCCONNECT         1
  324. #define SQL_API_SQLALLOCENV             2
  325. #if (ODBCVER >= 0x0300)
  326. #define SQL_API_SQLALLOCHANDLE       1001
  327. #endif
  328. #define SQL_API_SQLALLOCSTMT            3
  329. #define SQL_API_SQLBINDCOL              4
  330. #if (ODBCVER >= 0x0300)
  331. #define SQL_API_SQLBINDPARAM         1002
  332. #endif
  333. #define SQL_API_SQLCANCEL               5
  334. #if (ODBCVER >= 0x0300)
  335. #define SQL_API_SQLCLOSECURSOR       1003
  336. #define SQL_API_SQLCOLATTRIBUTE         6
  337. #endif
  338. #define SQL_API_SQLCOLUMNS             40
  339. #define SQL_API_SQLCONNECT              7
  340. #if (ODBCVER >= 0x0300)
  341. #define SQL_API_SQLCOPYDESC          1004
  342. #endif
  343. #define SQL_API_SQLDATASOURCES         57
  344. #define SQL_API_SQLDESCRIBECOL          8
  345. #define SQL_API_SQLDISCONNECT           9
  346. #if (ODBCVER >= 0x0300)
  347. #define SQL_API_SQLENDTRAN           1005
  348. #endif
  349. #define SQL_API_SQLERROR               10
  350. #define SQL_API_SQLEXECDIRECT          11
  351. #define SQL_API_SQLEXECUTE             12
  352. #define SQL_API_SQLFETCH               13
  353. #if (ODBCVER >= 0x0300)
  354. #define SQL_API_SQLFETCHSCROLL       1021
  355. #endif
  356. #define SQL_API_SQLFREECONNECT         14
  357. #define SQL_API_SQLFREEENV             15
  358. #if (ODBCVER >= 0x0300)
  359. #define SQL_API_SQLFREEHANDLE        1006
  360. #endif
  361. #define SQL_API_SQLFREESTMT            16
  362. #if (ODBCVER >= 0x0300)
  363. #define SQL_API_SQLGETCONNECTATTR    1007
  364. #endif
  365. #define SQL_API_SQLGETCONNECTOPTION    42
  366. #define SQL_API_SQLGETCURSORNAME       17
  367. #define SQL_API_SQLGETDATA             43
  368. #if (ODBCVER >= 0x0300)
  369. #define SQL_API_SQLGETDESCFIELD      1008
  370. #define SQL_API_SQLGETDESCREC        1009
  371. #define SQL_API_SQLGETDIAGFIELD      1010
  372. #define SQL_API_SQLGETDIAGREC        1011
  373. #define SQL_API_SQLGETENVATTR        1012
  374. #endif
  375. #define SQL_API_SQLGETFUNCTIONS        44
  376. #define SQL_API_SQLGETINFO             45
  377. #if (ODBCVER >= 0x0300)
  378. #define SQL_API_SQLGETSTMTATTR       1014
  379. #endif
  380. #define SQL_API_SQLGETSTMTOPTION       46
  381. #define SQL_API_SQLGETTYPEINFO         47
  382. #define SQL_API_SQLNUMRESULTCOLS       18
  383. #define SQL_API_SQLPARAMDATA           48
  384. #define SQL_API_SQLPREPARE             19
  385. #define SQL_API_SQLPUTDATA             49
  386. #define SQL_API_SQLROWCOUNT            20
  387. #if (ODBCVER >= 0x0300)
  388. #define SQL_API_SQLSETCONNECTATTR    1016
  389. #endif
  390. #define SQL_API_SQLSETCONNECTOPTION    50
  391. #define SQL_API_SQLSETCURSORNAME       21
  392. #if (ODBCVER >= 0x0300)
  393. #define SQL_API_SQLSETDESCFIELD      1017
  394. #define SQL_API_SQLSETDESCREC        1018
  395. #define SQL_API_SQLSETENVATTR        1019
  396. #endif
  397. #define SQL_API_SQLSETPARAM            22
  398. #if (ODBCVER >= 0x0300)
  399. #define SQL_API_SQLSETSTMTATTR       1020
  400. #endif
  401. #define SQL_API_SQLSETSTMTOPTION       51
  402. #define SQL_API_SQLSPECIALCOLUMNS      52
  403. #define SQL_API_SQLSTATISTICS          53
  404. #define SQL_API_SQLTABLES              54
  405. #define SQL_API_SQLTRANSACT            23
  406.  
  407. /* Information requested by SQLGetInfo() */
  408. #if (ODBCVER >= 0x0300)
  409. #define SQL_MAX_DRIVER_CONNECTIONS           0
  410. #define SQL_MAXIMUM_DRIVER_CONNECTIONS        SQL_MAX_DRIVER_CONNECTIONS
  411. #define SQL_MAX_CONCURRENT_ACTIVITIES        1
  412. #define SQL_MAXIMUM_CONCURRENT_ACTIVITIES    SQL_MAX_CONCURRENT_ACTIVITIES
  413. #endif
  414. #define SQL_DATA_SOURCE_NAME                 2
  415. #define SQL_FETCH_DIRECTION                  8
  416. #define SQL_SERVER_NAME                     13
  417. #define SQL_SEARCH_PATTERN_ESCAPE           14
  418. #define SQL_DBMS_NAME                       17
  419. #define SQL_DBMS_VER                        18
  420. #define SQL_ACCESSIBLE_TABLES               19
  421. #define SQL_ACCESSIBLE_PROCEDURES            20
  422. #define SQL_CURSOR_COMMIT_BEHAVIOR          23
  423. #define SQL_DATA_SOURCE_READ_ONLY           25
  424. #define SQL_DEFAULT_TXN_ISOLATION           26
  425. #define SQL_IDENTIFIER_CASE                 28
  426. #define SQL_IDENTIFIER_QUOTE_CHAR           29
  427. #define SQL_MAX_COLUMN_NAME_LEN             30
  428. #define SQL_MAXIMUM_COLUMN_NAME_LENGTH        SQL_MAX_COLUMN_NAME_LEN
  429. #define SQL_MAX_CURSOR_NAME_LEN             31
  430. #define SQL_MAXIMUM_CURSOR_NAME_LENGTH        SQL_MAX_CURSOR_NAME_LEN
  431. #define SQL_MAX_SCHEMA_NAME_LEN             32
  432. #define SQL_MAXIMUM_SCHEMA_NAME_LENGTH        SQL_MAX_SCHEMA_NAME_LEN
  433. #define SQL_MAX_CATALOG_NAME_LEN            34
  434. #define SQL_MAXIMUM_CATALOG_NAME_LENGTH        SQL_MAX_CATALOG_NAME_LEN
  435. #define SQL_MAX_TABLE_NAME_LEN              35
  436. #define SQL_SCROLL_CONCURRENCY              43
  437. #define SQL_TXN_CAPABLE                     46
  438. #define SQL_TRANSACTION_CAPABLE                SQL_TXN_CAPABLE
  439. #define SQL_USER_NAME                       47
  440. #define SQL_TXN_ISOLATION_OPTION            72
  441. #define SQL_TRANSACTION_ISOLATION_OPTION    SQL_TXN_ISOLATION_OPTION
  442. #define SQL_INTEGRITY                       73
  443. #define SQL_GETDATA_EXTENSIONS              81
  444. #define SQL_NULL_COLLATION                  85
  445. #define SQL_ALTER_TABLE                     86
  446. #define SQL_ORDER_BY_COLUMNS_IN_SELECT      90
  447. #define SQL_SPECIAL_CHARACTERS              94
  448. #define SQL_MAX_COLUMNS_IN_GROUP_BY         97
  449. #define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY        SQL_MAX_COLUMNS_IN_GROUP_BY
  450. #define SQL_MAX_COLUMNS_IN_INDEX            98
  451. #define SQL_MAXIMUM_COLUMNS_IN_INDEX        SQL_MAX_COLUMNS_IN_INDEX
  452. #define SQL_MAX_COLUMNS_IN_ORDER_BY         99
  453. #define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY        SQL_MAX_COLUMNS_IN_ORDER_BY
  454. #define SQL_MAX_COLUMNS_IN_SELECT          100
  455. #define SQL_MAXIMUM_COLUMNS_IN_SELECT       SQL_MAX_COLUMNS_IN_SELECT
  456. #define SQL_MAX_COLUMNS_IN_TABLE           101
  457. #define SQL_MAX_INDEX_SIZE                 102
  458. #define SQL_MAXIMUM_INDEX_SIZE               SQL_MAX_INDEX_SIZE
  459. #define SQL_MAX_ROW_SIZE                   104
  460. #define SQL_MAXIMUM_ROW_SIZE               SQL_MAX_ROW_SIZE
  461. #define SQL_MAX_STATEMENT_LEN              105
  462. #define SQL_MAXIMUM_STATEMENT_LENGTH       SQL_MAX_STATEMENT_LEN
  463. #define SQL_MAX_TABLES_IN_SELECT           106
  464. #define SQL_MAXIMUM_TABLES_IN_SELECT       SQL_MAX_TABLES_IN_SELECT
  465. #define SQL_MAX_USER_NAME_LEN              107
  466. #define SQL_MAXIMUM_USER_NAME_LENGTH       SQL_MAX_USER_NAME_LEN
  467. #if (ODBCVER >= 0x0300)
  468. #define SQL_OJ_CAPABILITIES                115
  469. #define SQL_OUTER_JOIN_CAPABILITIES           SQL_OJ_CAPABILITIES
  470. #endif /* ODBCVER >= 0x0300 */
  471.  
  472. #if (ODBCVER >= 0x0300)
  473. #define SQL_XOPEN_CLI_YEAR               10000
  474. #define SQL_CURSOR_SENSITIVITY           10001
  475. #define SQL_DESCRIBE_PARAMETER           10002
  476. #define SQL_CATALOG_NAME                 10003
  477. #define SQL_COLLATION_SEQ                10004
  478. #define SQL_MAX_IDENTIFIER_LEN           10005
  479. #define SQL_MAXIMUM_IDENTIFIER_LENGTH     SQL_MAX_IDENTIFIER_LEN
  480. #endif /* ODBCVER >= 0x0300 */
  481.  
  482. /* SQL_ALTER_TABLE bitmasks */
  483. #if (ODBCVER >= 0x0200)
  484. #define SQL_AT_ADD_COLUMN                       0x00000001L
  485. #define SQL_AT_DROP_COLUMN                      0x00000002L
  486. #endif /* ODBCVER >= 0x0200 */
  487.  
  488. #if (ODBCVER >= 0x0300)
  489. #define SQL_AT_ADD_CONSTRAINT                   0x00000008L
  490.  
  491. /* The following bitmasks are ODBC extensions and defined in sqlext.h
  492. *#define    SQL_AT_COLUMN_SINGLE                    0x00000020L    
  493. *#define    SQL_AT_ADD_COLUMN_DEFAULT                0x00000040L
  494. *#define    SQL_AT_ADD_COLUMN_COLLATION                0x00000080L
  495. *#define    SQL_AT_SET_COLUMN_DEFAULT                0x00000100L
  496. *#define    SQL_AT_DROP_COLUMN_DEFAULT                0x00000200L
  497. *#define    SQL_AT_DROP_COLUMN_CASCADE                0x00000400L
  498. *#define    SQL_AT_DROP_COLUMN_RESTRICT                0x00000800L
  499. *#define SQL_AT_ADD_TABLE_CONSTRAINT                0x00001000L        
  500. *#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE        0x00002000L        
  501. *#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT        0x00004000L        
  502. *#define SQL_AT_CONSTRAINT_NAME_DEFINITION            0x00008000L
  503. *#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED        0x00010000L
  504. *#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE        0x00020000L
  505. *#define SQL_AT_CONSTRAINT_DEFERRABLE                0x00040000L
  506. *#define SQL_AT_CONSTRAINT_NON_DEFERRABLE            0x00080000L
  507. */
  508. #endif  /* ODBCVER >= 0x0300 */
  509.  
  510.  
  511. /* SQL_ASYNC_MODE values */
  512. #if (ODBCVER >= 0x0300)
  513. #define SQL_AM_NONE                         0
  514. #define SQL_AM_CONNECTION                   1
  515. #define SQL_AM_STATEMENT                    2
  516. #endif
  517.  
  518. /* SQL_CURSOR_COMMIT_BEHAVIOR values */
  519. #define SQL_CB_DELETE                       0
  520. #define SQL_CB_CLOSE                        1
  521. #define SQL_CB_PRESERVE                     2
  522.  
  523. /* SQL_FETCH_DIRECTION bitmasks */
  524. #define SQL_FD_FETCH_NEXT                   0x00000001L
  525. #define SQL_FD_FETCH_FIRST                  0x00000002L
  526. #define SQL_FD_FETCH_LAST                   0x00000004L
  527. #define SQL_FD_FETCH_PRIOR                  0x00000008L
  528. #define SQL_FD_FETCH_ABSOLUTE               0x00000010L
  529. #define SQL_FD_FETCH_RELATIVE               0x00000020L
  530.  
  531. /* SQL_GETDATA_EXTENSIONS bitmasks */
  532. #define SQL_GD_ANY_COLUMN                   0x00000001L
  533. #define SQL_GD_ANY_ORDER                    0x00000002L
  534.  
  535. /* SQL_IDENTIFIER_CASE values */
  536. #define SQL_IC_UPPER                        1
  537. #define SQL_IC_LOWER                        2
  538. #define SQL_IC_SENSITIVE                    3
  539. #define SQL_IC_MIXED                        4
  540.  
  541. /* SQL_OJ_CAPABILITIES bitmasks */
  542. /* NB: this means 'outer join', not what  you may be thinking */
  543.  
  544.  
  545. #if (ODBCVER >= 0x0201)
  546. #define SQL_OJ_LEFT                         0x00000001L
  547. #define SQL_OJ_RIGHT                        0x00000002L
  548. #define SQL_OJ_FULL                         0x00000004L
  549. #define SQL_OJ_NESTED                       0x00000008L
  550. #define SQL_OJ_NOT_ORDERED                  0x00000010L
  551. #define SQL_OJ_INNER                        0x00000020L
  552. #define SQL_OJ_ALL_COMPARISON_OPS           0x00000040L
  553. #endif
  554.  
  555. /* SQL_SCROLL_CONCURRENCY bitmasks */
  556. #define SQL_SCCO_READ_ONLY                  0x00000001L
  557. #define SQL_SCCO_LOCK                       0x00000002L
  558. #define SQL_SCCO_OPT_ROWVER                 0x00000004L
  559. #define SQL_SCCO_OPT_VALUES                 0x00000008L
  560.  
  561. /* SQL_TXN_CAPABLE values */
  562. #define SQL_TC_NONE                         0
  563. #define SQL_TC_DML                          1
  564. #define SQL_TC_ALL                          2
  565. #define SQL_TC_DDL_COMMIT                   3
  566. #define SQL_TC_DDL_IGNORE                   4
  567.  
  568. /* SQL_TXN_ISOLATION_OPTION bitmasks */
  569. #define SQL_TXN_READ_UNCOMMITTED            0x00000001L
  570. #define SQL_TRANSACTION_READ_UNCOMMITTED    SQL_TXN_READ_UNCOMMITTED
  571. #define SQL_TXN_READ_COMMITTED              0x00000002L
  572. #define SQL_TRANSACTION_READ_COMMITTED        SQL_TXN_READ_COMMITTED
  573. #define SQL_TXN_REPEATABLE_READ             0x00000004L
  574. #define SQL_TRANSACTION_REPEATABLE_READ        SQL_TXN_REPEATABLE_READ
  575. #define SQL_TXN_SERIALIZABLE                0x00000008L
  576. #define SQL_TRANSACTION_SERIALIZABLE        SQL_TXN_SERIALIZABLE
  577.  
  578. /* SQL_NULL_COLLATION values */
  579. #define SQL_NC_HIGH                         0
  580. #define SQL_NC_LOW                          1
  581.  
  582. #ifndef RC_INVOKED
  583.  
  584. SQLRETURN  SQL_API SQLAllocConnect(SQLHENV EnvironmentHandle,
  585.            SQLHDBC *ConnectionHandle);
  586.  
  587. SQLRETURN  SQL_API SQLAllocEnv(SQLHENV *EnvironmentHandle);
  588.  
  589. #if (ODBCVER >= 0x0300)
  590. SQLRETURN  SQL_API SQLAllocHandle(SQLSMALLINT HandleType,
  591.            SQLHANDLE InputHandle, SQLHANDLE *OutputHandle);
  592. #endif
  593.  
  594. SQLRETURN  SQL_API SQLAllocStmt(SQLHDBC ConnectionHandle,
  595.            SQLHSTMT *StatementHandle);
  596.  
  597. SQLRETURN  SQL_API SQLBindCol(SQLHSTMT StatementHandle, 
  598.            SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, 
  599.            SQLPOINTER TargetValue, SQLINTEGER BufferLength, 
  600.               SQLINTEGER *StrLen_or_Ind);
  601.  
  602. #if (ODBCVER >= 0x0300)
  603. SQLRETURN  SQL_API SQLBindParam(SQLHSTMT StatementHandle,
  604.            SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
  605.            SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
  606.            SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
  607.            SQLINTEGER *StrLen_or_Ind);
  608. #endif
  609.  
  610. SQLRETURN  SQL_API SQLCancel(SQLHSTMT StatementHandle);
  611.  
  612. #if (ODBCVER >= 0x0300)
  613. SQLRETURN  SQL_API SQLCloseCursor(SQLHSTMT StatementHandle);
  614.  
  615. SQLRETURN  SQL_API SQLColAttribute (SQLHSTMT StatementHandle,
  616.            SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier,
  617.            SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength,
  618.            SQLSMALLINT *StringLength, SQLPOINTER NumericAttribute);
  619. #endif
  620.  
  621.  
  622. SQLRETURN  SQL_API SQLColumns(SQLHSTMT StatementHandle,
  623.            SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
  624.            SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
  625.            SQLCHAR *TableName, SQLSMALLINT NameLength3,
  626.            SQLCHAR *ColumnName, SQLSMALLINT NameLength4);
  627.  
  628.  
  629. SQLRETURN  SQL_API SQLConnect(SQLHDBC ConnectionHandle,
  630.            SQLCHAR *ServerName, SQLSMALLINT NameLength1,
  631.            SQLCHAR *UserName, SQLSMALLINT NameLength2,
  632.            SQLCHAR *Authentication, SQLSMALLINT NameLength3);
  633.  
  634. #if (ODBCVER >= 0x0300)
  635. SQLRETURN  SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle,
  636.            SQLHDESC TargetDescHandle);
  637. #endif
  638.  
  639. SQLRETURN  SQL_API SQLDataSources(SQLHENV EnvironmentHandle,
  640.            SQLUSMALLINT Direction, SQLCHAR *ServerName,
  641.            SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
  642.            SQLCHAR *Description, SQLSMALLINT BufferLength2,
  643.            SQLSMALLINT *NameLength2);
  644.  
  645. SQLRETURN  SQL_API SQLDescribeCol(SQLHSTMT StatementHandle,
  646.            SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
  647.            SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
  648.            SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize,
  649.            SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable);
  650.  
  651. SQLRETURN  SQL_API SQLDisconnect(SQLHDBC ConnectionHandle);
  652.  
  653. #if (ODBCVER >= 0x0300)
  654. SQLRETURN  SQL_API SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle,
  655.            SQLSMALLINT CompletionType);
  656. #endif
  657.  
  658. SQLRETURN  SQL_API SQLError(SQLHENV EnvironmentHandle,
  659.            SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle,
  660.            SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
  661.            SQLCHAR *MessageText, SQLSMALLINT BufferLength,
  662.            SQLSMALLINT *TextLength);
  663.  
  664. SQLRETURN  SQL_API SQLExecDirect(SQLHSTMT StatementHandle,
  665.            SQLCHAR *StatementText, SQLINTEGER TextLength);
  666.  
  667. SQLRETURN  SQL_API SQLExecute(SQLHSTMT StatementHandle);
  668.  
  669. SQLRETURN  SQL_API SQLFetch(SQLHSTMT StatementHandle);
  670.  
  671. #if (ODBCVER >= 0x0300)
  672. SQLRETURN  SQL_API SQLFetchScroll(SQLHSTMT StatementHandle,
  673.            SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset);
  674. #endif
  675.  
  676. SQLRETURN  SQL_API SQLFreeConnect(SQLHDBC ConnectionHandle);
  677.  
  678. SQLRETURN  SQL_API SQLFreeEnv(SQLHENV EnvironmentHandle);
  679.  
  680. #if (ODBCVER >= 0x0300)
  681. SQLRETURN  SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle);
  682. #endif
  683.  
  684. SQLRETURN  SQL_API SQLFreeStmt(SQLHSTMT StatementHandle,
  685.            SQLUSMALLINT Option);
  686.  
  687. #if (ODBCVER >= 0x0300)
  688. SQLRETURN  SQL_API SQLGetConnectAttr(SQLHDBC ConnectionHandle,
  689.            SQLINTEGER Attribute, SQLPOINTER Value,
  690.            SQLINTEGER BufferLength, SQLINTEGER *StringLength);
  691. #endif
  692.  
  693. SQLRETURN  SQL_API SQLGetConnectOption(SQLHDBC ConnectionHandle,
  694.            SQLUSMALLINT Option, SQLPOINTER Value);
  695.  
  696. SQLRETURN  SQL_API SQLGetCursorName(SQLHSTMT StatementHandle,
  697.            SQLCHAR *CursorName, SQLSMALLINT BufferLength,
  698.            SQLSMALLINT *NameLength);
  699.  
  700. SQLRETURN  SQL_API SQLGetData(SQLHSTMT StatementHandle,
  701.            SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
  702.            SQLPOINTER TargetValue, SQLINTEGER BufferLength,
  703.            SQLINTEGER *StrLen_or_Ind);
  704.  
  705. #if (ODBCVER >= 0x0300)
  706. SQLRETURN  SQL_API SQLGetDescField(SQLHDESC DescriptorHandle,
  707.            SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
  708.            SQLPOINTER Value, SQLINTEGER BufferLength,
  709.            SQLINTEGER *StringLength);
  710.  
  711. SQLRETURN  SQL_API SQLGetDescRec(SQLHDESC DescriptorHandle,
  712.            SQLSMALLINT RecNumber, SQLCHAR *Name,
  713.            SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
  714.            SQLSMALLINT *Type, SQLSMALLINT *SubType, 
  715.            SQLINTEGER *Length, SQLSMALLINT *Precision, 
  716.            SQLSMALLINT *Scale, SQLSMALLINT *Nullable);
  717.  
  718. SQLRETURN  SQL_API SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
  719.            SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
  720.            SQLPOINTER DiagInfo, SQLSMALLINT BufferLength,
  721.            SQLSMALLINT *StringLength);
  722.  
  723. SQLRETURN  SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
  724.            SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
  725.            SQLINTEGER *NativeError, SQLCHAR *MessageText,
  726.            SQLSMALLINT BufferLength, SQLSMALLINT *TextLength);
  727.  
  728. SQLRETURN  SQL_API SQLGetEnvAttr(SQLHENV EnvironmentHandle,
  729.            SQLINTEGER Attribute, SQLPOINTER Value,
  730.            SQLINTEGER BufferLength, SQLINTEGER *StringLength);
  731. #endif  /* ODBCVER >= 0x0300 */
  732.  
  733. SQLRETURN  SQL_API SQLGetFunctions(SQLHDBC ConnectionHandle,
  734.            SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported);
  735.  
  736. SQLRETURN  SQL_API SQLGetInfo(SQLHDBC ConnectionHandle,
  737.            SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
  738.            SQLSMALLINT BufferLength, SQLSMALLINT *StringLength);
  739.  
  740. #if (ODBCVER >= 0x0300)
  741. SQLRETURN  SQL_API SQLGetStmtAttr(SQLHSTMT StatementHandle,
  742.            SQLINTEGER Attribute, SQLPOINTER Value,
  743.            SQLINTEGER BufferLength, SQLINTEGER *StringLength);
  744. #endif  /* ODBCVER >= 0x0300 */
  745.  
  746. SQLRETURN  SQL_API SQLGetStmtOption(SQLHSTMT StatementHandle,
  747.            SQLUSMALLINT Option, SQLPOINTER Value);
  748.  
  749. SQLRETURN  SQL_API SQLGetTypeInfo(SQLHSTMT StatementHandle,
  750.            SQLSMALLINT DataType);
  751.  
  752. SQLRETURN  SQL_API SQLNumResultCols(SQLHSTMT StatementHandle,
  753.            SQLSMALLINT *ColumnCount);
  754.  
  755. SQLRETURN  SQL_API SQLParamData(SQLHSTMT StatementHandle,
  756.            SQLPOINTER *Value);
  757.  
  758. SQLRETURN  SQL_API SQLPrepare(SQLHSTMT StatementHandle,
  759.            SQLCHAR *StatementText, SQLINTEGER TextLength);
  760.  
  761. SQLRETURN  SQL_API SQLPutData(SQLHSTMT StatementHandle,
  762.            SQLPOINTER Data, SQLINTEGER StrLen_or_Ind);
  763.  
  764. SQLRETURN  SQL_API SQLRowCount(SQLHSTMT StatementHandle, 
  765.        SQLINTEGER *RowCount);
  766.  
  767. #if (ODBCVER >= 0x0300)
  768. SQLRETURN  SQL_API SQLSetConnectAttr(SQLHDBC ConnectionHandle,
  769.            SQLINTEGER Attribute, SQLPOINTER Value,
  770.            SQLINTEGER StringLength);
  771. #endif /* ODBCVER >= 0x0300 */
  772.  
  773. SQLRETURN  SQL_API SQLSetConnectOption(SQLHDBC ConnectionHandle,
  774.            SQLUSMALLINT Option, SQLUINTEGER Value);
  775.  
  776. SQLRETURN  SQL_API SQLSetCursorName(SQLHSTMT StatementHandle,
  777.            SQLCHAR *CursorName, SQLSMALLINT NameLength);
  778.  
  779. #if (ODBCVER >= 0x0300)
  780. SQLRETURN  SQL_API SQLSetDescField(SQLHDESC DescriptorHandle,
  781.            SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
  782.            SQLPOINTER Value, SQLINTEGER BufferLength);
  783.  
  784. SQLRETURN  SQL_API SQLSetDescRec(SQLHDESC DescriptorHandle,
  785.            SQLSMALLINT RecNumber, SQLSMALLINT Type,
  786.            SQLSMALLINT SubType, SQLINTEGER Length,
  787.            SQLSMALLINT Precision, SQLSMALLINT Scale,
  788.            SQLPOINTER Data, SQLINTEGER *StringLength,
  789.            SQLINTEGER *Indicator);
  790.  
  791. SQLRETURN  SQL_API SQLSetEnvAttr(SQLHENV EnvironmentHandle,
  792.            SQLINTEGER Attribute, SQLPOINTER Value,
  793.            SQLINTEGER StringLength);
  794. #endif /* ODBCVER >= 0x0300 */
  795.  
  796. SQLRETURN  SQL_API SQLSetParam(SQLHSTMT StatementHandle,
  797.            SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
  798.            SQLSMALLINT ParameterType, SQLUINTEGER LengthPrecision,
  799.            SQLSMALLINT ParameterScale, SQLPOINTER ParameterValue,
  800.            SQLINTEGER *StrLen_or_Ind);
  801.  
  802. #if (ODBCVER >= 0x0300)
  803. SQLRETURN  SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle,
  804.            SQLINTEGER Attribute, SQLPOINTER Value,
  805.            SQLINTEGER StringLength);
  806. #endif
  807.  
  808. SQLRETURN  SQL_API SQLSetStmtOption(SQLHSTMT StatementHandle,
  809.            SQLUSMALLINT Option, SQLUINTEGER Value);
  810.  
  811. SQLRETURN  SQL_API SQLSpecialColumns(SQLHSTMT StatementHandle,
  812.            SQLUSMALLINT IdentifierType, SQLCHAR *CatalogName,
  813.            SQLSMALLINT NameLength1, SQLCHAR *SchemaName,
  814.            SQLSMALLINT NameLength2, SQLCHAR *TableName,
  815.            SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
  816.            SQLUSMALLINT Nullable);
  817.  
  818. SQLRETURN  SQL_API SQLStatistics(SQLHSTMT StatementHandle,
  819.            SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
  820.            SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
  821.            SQLCHAR *TableName, SQLSMALLINT NameLength3,
  822.            SQLUSMALLINT Unique, SQLUSMALLINT Reserved);
  823.  
  824. SQLRETURN  SQL_API SQLTables(SQLHSTMT StatementHandle,
  825.            SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
  826.            SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
  827.            SQLCHAR *TableName, SQLSMALLINT NameLength3,
  828.            SQLCHAR *TableType, SQLSMALLINT NameLength4);
  829.  
  830. SQLRETURN  SQL_API SQLTransact(SQLHENV EnvironmentHandle,
  831.            SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType);
  832.  
  833. #endif  /* RC_INVOKED */
  834.  
  835. #ifdef __cplusplus
  836. }                                    /* End of extern "C" { */
  837. #endif  /* __cplusplus */
  838. #endif    /* #ifndef __SQL */
  839.