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

839 lines
30 KiB

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