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