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