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.

2069 lines
78 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: sqlext.h
  3. //
  4. // Copyright: Copyright (c) Microsoft Corporation
  5. //
  6. // Contents: This is the include for applications using the Microsoft SQL Extensions
  7. //
  8. // Comments:
  9. //
  10. //-----------------------------------------------------------------------------
  11. #ifndef __SQLEXT
  12. #define __SQLEXT
  13. #ifndef __SQL
  14. #include "sql.h"
  15. #endif
  16. #ifdef __cplusplus
  17. extern "C" { /* Assume C declarations for C++ */
  18. #endif /* __cplusplus */
  19. /* generally useful constants */
  20. #define SQL_SPEC_MAJOR 3 /* Major version of specification */
  21. #define SQL_SPEC_MINOR 52 /* Minor version of specification */
  22. #define SQL_SPEC_STRING "03.52" /* String constant for version */
  23. #define SQL_SQLSTATE_SIZE 5 /* size of SQLSTATE */
  24. #define SQL_MAX_DSN_LENGTH 32 /* maximum data source name size */
  25. #define SQL_MAX_OPTION_STRING_LENGTH 256
  26. /* return code SQL_NO_DATA_FOUND is the same as SQL_NO_DATA */
  27. #if (ODBCVER < 0x0300)
  28. #define SQL_NO_DATA_FOUND 100
  29. #else
  30. #define SQL_NO_DATA_FOUND SQL_NO_DATA
  31. #endif
  32. /* an end handle type */
  33. #if (ODBCVER >= 0x0300)
  34. #define SQL_HANDLE_SENV 5
  35. #endif /* ODBCVER >= 0x0300 */
  36. /* env attribute */
  37. #if (ODBCVER >= 0x0300)
  38. #define SQL_ATTR_ODBC_VERSION 200
  39. #define SQL_ATTR_CONNECTION_POOLING 201
  40. #define SQL_ATTR_CP_MATCH 202
  41. #endif /* ODBCVER >= 0x0300 */
  42. #if (ODBCVER >= 0x0300)
  43. /* values for SQL_ATTR_CONNECTION_POOLING */
  44. #define SQL_CP_OFF 0UL
  45. #define SQL_CP_ONE_PER_DRIVER 1UL
  46. #define SQL_CP_ONE_PER_HENV 2UL
  47. #define SQL_CP_DEFAULT SQL_CP_OFF
  48. /* values for SQL_ATTR_CP_MATCH */
  49. #define SQL_CP_STRICT_MATCH 0UL
  50. #define SQL_CP_RELAXED_MATCH 1UL
  51. #define SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH
  52. /* values for SQL_ATTR_ODBC_VERSION */
  53. #define SQL_OV_ODBC2 2UL
  54. #define SQL_OV_ODBC3 3UL
  55. #endif /* ODBCVER >= 0x0300 */
  56. /* connection attributes */
  57. #define SQL_ACCESS_MODE 101
  58. #define SQL_AUTOCOMMIT 102
  59. #define SQL_LOGIN_TIMEOUT 103
  60. #define SQL_OPT_TRACE 104
  61. #define SQL_OPT_TRACEFILE 105
  62. #define SQL_TRANSLATE_DLL 106
  63. #define SQL_TRANSLATE_OPTION 107
  64. #define SQL_TXN_ISOLATION 108
  65. #define SQL_CURRENT_QUALIFIER 109
  66. #define SQL_ODBC_CURSORS 110
  67. #define SQL_QUIET_MODE 111
  68. #define SQL_PACKET_SIZE 112
  69. /* connection attributes with new names */
  70. #if (ODBCVER >= 0x0300)
  71. #define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE
  72. #define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT
  73. #define SQL_ATTR_CONNECTION_TIMEOUT 113
  74. #define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER
  75. #define SQL_ATTR_DISCONNECT_BEHAVIOR 114
  76. #define SQL_ATTR_ENLIST_IN_DTC 1207
  77. #define SQL_ATTR_ENLIST_IN_XA 1208
  78. #define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT
  79. #define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS
  80. #define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE
  81. #define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE
  82. #define SQL_ATTR_TRACE SQL_OPT_TRACE
  83. #define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE
  84. #define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL
  85. #define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION
  86. #define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION
  87. #endif /* ODBCVER >= 0x0300 */
  88. #define SQL_ATTR_CONNECTION_DEAD 1209 /* GetConnectAttr only */
  89. #if (ODBCVER >= 0x0351)
  90. /* ODBC Driver Manager sets this connection attribute to a unicode driver
  91. (which supports SQLConnectW) when the application is an ANSI application
  92. (which calls SQLConnect, SQLDriverConnect, or SQLBrowseConnect).
  93. This is SetConnectAttr only and application does not set this attribute
  94. This attribute was introduced because some unicode driver's some APIs may
  95. need to behave differently on ANSI or Unicode applications. A unicode
  96. driver, which has same behavior for both ANSI or Unicode applications,
  97. should return SQL_ERROR when the driver manager sets this connection
  98. attribute. When a unicode driver returns SQL_SUCCESS on this attribute,
  99. the driver manager treates ANSI and Unicode connections differently in
  100. connection pooling.
  101. */
  102. #define SQL_ATTR_ANSI_APP 115
  103. #endif
  104. /* SQL_CONNECT_OPT_DRVR_START is not meaningful for 3.0 driver */
  105. #if (ODBCVER < 0x0300)
  106. #define SQL_CONNECT_OPT_DRVR_START 1000
  107. #endif /* ODBCVER < 0x0300 */
  108. #if (ODBCVER < 0x0300)
  109. #define SQL_CONN_OPT_MAX SQL_PACKET_SIZE
  110. #define SQL_CONN_OPT_MIN SQL_ACCESS_MODE
  111. #endif /* ODBCVER < 0x0300 */
  112. /* SQL_ACCESS_MODE options */
  113. #define SQL_MODE_READ_WRITE 0UL
  114. #define SQL_MODE_READ_ONLY 1UL
  115. #define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE
  116. /* SQL_AUTOCOMMIT options */
  117. #define SQL_AUTOCOMMIT_OFF 0UL
  118. #define SQL_AUTOCOMMIT_ON 1UL
  119. #define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON
  120. /* SQL_LOGIN_TIMEOUT options */
  121. #define SQL_LOGIN_TIMEOUT_DEFAULT 15UL
  122. /* SQL_OPT_TRACE options */
  123. #define SQL_OPT_TRACE_OFF 0UL
  124. #define SQL_OPT_TRACE_ON 1UL
  125. #define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF
  126. #define SQL_OPT_TRACE_FILE_DEFAULT "\\SQL.LOG"
  127. /* SQL_ODBC_CURSORS options */
  128. #define SQL_CUR_USE_IF_NEEDED 0UL
  129. #define SQL_CUR_USE_ODBC 1UL
  130. #define SQL_CUR_USE_DRIVER 2UL
  131. #define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER
  132. #if (ODBCVER >= 0x0300)
  133. /* values for SQL_ATTR_DISCONNECT_BEHAVIOR */
  134. #define SQL_DB_RETURN_TO_POOL 0UL
  135. #define SQL_DB_DISCONNECT 1UL
  136. #define SQL_DB_DEFAULT SQL_DB_RETURN_TO_POOL
  137. /* values for SQL_ATTR_ENLIST_IN_DTC */
  138. #define SQL_DTC_DONE 0L
  139. #endif /* ODBCVER >= 0x0300 */
  140. /* values for SQL_ATTR_CONNECTION_DEAD */
  141. #define SQL_CD_TRUE 1L /* Connection is closed/dead */
  142. #define SQL_CD_FALSE 0L /* Connection is open/available */
  143. /* values for SQL_ATTR_ANSI_APP */
  144. #if (ODBCVER >= 0x0351)
  145. #define SQL_AA_TRUE 1L /* the application is an ANSI app */
  146. #define SQL_AA_FALSE 0L /* the application is a Unicode app */
  147. #endif
  148. /* statement attributes */
  149. #define SQL_QUERY_TIMEOUT 0
  150. #define SQL_MAX_ROWS 1
  151. #define SQL_NOSCAN 2
  152. #define SQL_MAX_LENGTH 3
  153. #define SQL_ASYNC_ENABLE 4 /* same as SQL_ATTR_ASYNC_ENABLE */
  154. #define SQL_BIND_TYPE 5
  155. #define SQL_CURSOR_TYPE 6
  156. #define SQL_CONCURRENCY 7
  157. #define SQL_KEYSET_SIZE 8
  158. #define SQL_ROWSET_SIZE 9
  159. #define SQL_SIMULATE_CURSOR 10
  160. #define SQL_RETRIEVE_DATA 11
  161. #define SQL_USE_BOOKMARKS 12
  162. #define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */
  163. #define SQL_ROW_NUMBER 14 /* GetStmtOption Only */
  164. /* statement attributes for ODBC 3.0 */
  165. #if (ODBCVER >= 0x0300)
  166. #define SQL_ATTR_ASYNC_ENABLE 4
  167. #define SQL_ATTR_CONCURRENCY SQL_CONCURRENCY
  168. #define SQL_ATTR_CURSOR_TYPE SQL_CURSOR_TYPE
  169. #define SQL_ATTR_ENABLE_AUTO_IPD 15
  170. #define SQL_ATTR_FETCH_BOOKMARK_PTR 16
  171. #define SQL_ATTR_KEYSET_SIZE SQL_KEYSET_SIZE
  172. #define SQL_ATTR_MAX_LENGTH SQL_MAX_LENGTH
  173. #define SQL_ATTR_MAX_ROWS SQL_MAX_ROWS
  174. #define SQL_ATTR_NOSCAN SQL_NOSCAN
  175. #define SQL_ATTR_PARAM_BIND_OFFSET_PTR 17
  176. #define SQL_ATTR_PARAM_BIND_TYPE 18
  177. #define SQL_ATTR_PARAM_OPERATION_PTR 19
  178. #define SQL_ATTR_PARAM_STATUS_PTR 20
  179. #define SQL_ATTR_PARAMS_PROCESSED_PTR 21
  180. #define SQL_ATTR_PARAMSET_SIZE 22
  181. #define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT
  182. #define SQL_ATTR_RETRIEVE_DATA SQL_RETRIEVE_DATA
  183. #define SQL_ATTR_ROW_BIND_OFFSET_PTR 23
  184. #define SQL_ATTR_ROW_BIND_TYPE SQL_BIND_TYPE
  185. #define SQL_ATTR_ROW_NUMBER SQL_ROW_NUMBER /*GetStmtAttr*/
  186. #define SQL_ATTR_ROW_OPERATION_PTR 24
  187. #define SQL_ATTR_ROW_STATUS_PTR 25
  188. #define SQL_ATTR_ROWS_FETCHED_PTR 26
  189. #define SQL_ATTR_ROW_ARRAY_SIZE 27
  190. #define SQL_ATTR_SIMULATE_CURSOR SQL_SIMULATE_CURSOR
  191. #define SQL_ATTR_USE_BOOKMARKS SQL_USE_BOOKMARKS
  192. #endif /* ODBCVER >= 0x0300 */
  193. #if (ODBCVER < 0x0300)
  194. #define SQL_STMT_OPT_MAX SQL_ROW_NUMBER
  195. #define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT
  196. #endif /* ODBCVER < 0x0300 */
  197. /* New defines for SEARCHABLE column in SQLGetTypeInfo */
  198. #if (ODBCVER >= 0x0300)
  199. #define SQL_COL_PRED_CHAR SQL_LIKE_ONLY
  200. #define SQL_COL_PRED_BASIC SQL_ALL_EXCEPT_LIKE
  201. #endif /* ODBCVER >= 0x0300 */
  202. /* whether an attribute is a pointer or not */
  203. #if (ODBCVER >= 0x0300)
  204. #define SQL_IS_POINTER (-4)
  205. #define SQL_IS_UINTEGER (-5)
  206. #define SQL_IS_INTEGER (-6)
  207. #define SQL_IS_USMALLINT (-7)
  208. #define SQL_IS_SMALLINT (-8)
  209. #endif /* ODBCVER >= 0x0300 */
  210. /* the value of SQL_ATTR_PARAM_BIND_TYPE */
  211. #if (ODBCVER >= 0x0300)
  212. #define SQL_PARAM_BIND_BY_COLUMN 0UL
  213. #define SQL_PARAM_BIND_TYPE_DEFAULT SQL_PARAM_BIND_BY_COLUMN
  214. #endif /* ODBCVER >= 0x0300 */
  215. /* SQL_QUERY_TIMEOUT options */
  216. #define SQL_QUERY_TIMEOUT_DEFAULT 0UL
  217. /* SQL_MAX_ROWS options */
  218. #define SQL_MAX_ROWS_DEFAULT 0UL
  219. /* SQL_NOSCAN options */
  220. #define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */
  221. #define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */
  222. #define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF
  223. /* SQL_MAX_LENGTH options */
  224. #define SQL_MAX_LENGTH_DEFAULT 0UL
  225. /* values for SQL_ATTR_ASYNC_ENABLE */
  226. #define SQL_ASYNC_ENABLE_OFF 0UL
  227. #define SQL_ASYNC_ENABLE_ON 1UL
  228. #define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF
  229. /* SQL_BIND_TYPE options */
  230. #define SQL_BIND_BY_COLUMN 0UL
  231. #define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */
  232. /* SQL_CONCURRENCY options */
  233. #define SQL_CONCUR_READ_ONLY 1
  234. #define SQL_CONCUR_LOCK 2
  235. #define SQL_CONCUR_ROWVER 3
  236. #define SQL_CONCUR_VALUES 4
  237. #define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY /* Default value */
  238. /* SQL_CURSOR_TYPE options */
  239. #define SQL_CURSOR_FORWARD_ONLY 0UL
  240. #define SQL_CURSOR_KEYSET_DRIVEN 1UL
  241. #define SQL_CURSOR_DYNAMIC 2UL
  242. #define SQL_CURSOR_STATIC 3UL
  243. #define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY /* Default value */
  244. /* SQL_ROWSET_SIZE options */
  245. #define SQL_ROWSET_SIZE_DEFAULT 1UL
  246. /* SQL_KEYSET_SIZE options */
  247. #define SQL_KEYSET_SIZE_DEFAULT 0UL
  248. /* SQL_SIMULATE_CURSOR options */
  249. #define SQL_SC_NON_UNIQUE 0UL
  250. #define SQL_SC_TRY_UNIQUE 1UL
  251. #define SQL_SC_UNIQUE 2UL
  252. /* SQL_RETRIEVE_DATA options */
  253. #define SQL_RD_OFF 0UL
  254. #define SQL_RD_ON 1UL
  255. #define SQL_RD_DEFAULT SQL_RD_ON
  256. /* SQL_USE_BOOKMARKS options */
  257. #define SQL_UB_OFF 0UL
  258. #define SQL_UB_ON 01UL
  259. #define SQL_UB_DEFAULT SQL_UB_OFF
  260. /* New values for SQL_USE_BOOKMARKS attribute */
  261. #if (ODBCVER >= 0x0300)
  262. #define SQL_UB_FIXED SQL_UB_ON
  263. #define SQL_UB_VARIABLE 2UL
  264. #endif /* ODBCVER >= 0x0300 */
  265. /* extended descriptor field */
  266. #if (ODBCVER >= 0x0300)
  267. #define SQL_DESC_ARRAY_SIZE 20
  268. #define SQL_DESC_ARRAY_STATUS_PTR 21
  269. #define SQL_DESC_AUTO_UNIQUE_VALUE SQL_COLUMN_AUTO_INCREMENT
  270. #define SQL_DESC_BASE_COLUMN_NAME 22
  271. #define SQL_DESC_BASE_TABLE_NAME 23
  272. #define SQL_DESC_BIND_OFFSET_PTR 24
  273. #define SQL_DESC_BIND_TYPE 25
  274. #define SQL_DESC_CASE_SENSITIVE SQL_COLUMN_CASE_SENSITIVE
  275. #define SQL_DESC_CATALOG_NAME SQL_COLUMN_QUALIFIER_NAME
  276. #define SQL_DESC_CONCISE_TYPE SQL_COLUMN_TYPE
  277. #define SQL_DESC_DATETIME_INTERVAL_PRECISION 26
  278. #define SQL_DESC_DISPLAY_SIZE SQL_COLUMN_DISPLAY_SIZE
  279. #define SQL_DESC_FIXED_PREC_SCALE SQL_COLUMN_MONEY
  280. #define SQL_DESC_LABEL SQL_COLUMN_LABEL
  281. #define SQL_DESC_LITERAL_PREFIX 27
  282. #define SQL_DESC_LITERAL_SUFFIX 28
  283. #define SQL_DESC_LOCAL_TYPE_NAME 29
  284. #define SQL_DESC_MAXIMUM_SCALE 30
  285. #define SQL_DESC_MINIMUM_SCALE 31
  286. #define SQL_DESC_NUM_PREC_RADIX 32
  287. #define SQL_DESC_PARAMETER_TYPE 33
  288. #define SQL_DESC_ROWS_PROCESSED_PTR 34
  289. #if (ODBCVER >= 0x0350)
  290. #define SQL_DESC_ROWVER 35
  291. #endif /* ODBCVER >= 0x0350 */
  292. #define SQL_DESC_SCHEMA_NAME SQL_COLUMN_OWNER_NAME
  293. #define SQL_DESC_SEARCHABLE SQL_COLUMN_SEARCHABLE
  294. #define SQL_DESC_TYPE_NAME SQL_COLUMN_TYPE_NAME
  295. #define SQL_DESC_TABLE_NAME SQL_COLUMN_TABLE_NAME
  296. #define SQL_DESC_UNSIGNED SQL_COLUMN_UNSIGNED
  297. #define SQL_DESC_UPDATABLE SQL_COLUMN_UPDATABLE
  298. #endif /* ODBCVER >= 0x0300 */
  299. /* defines for diagnostics fields */
  300. #if (ODBCVER >= 0x0300)
  301. #define SQL_DIAG_CURSOR_ROW_COUNT (-1249)
  302. #define SQL_DIAG_ROW_NUMBER (-1248)
  303. #define SQL_DIAG_COLUMN_NUMBER (-1247)
  304. #endif /* ODBCVER >= 0x0300 */
  305. /* SQL extended datatypes */
  306. #define SQL_DATE 9
  307. #if (ODBCVER >= 0x0300)
  308. #define SQL_INTERVAL 10
  309. #endif /* ODBCVER >= 0x0300 */
  310. #define SQL_TIME 10
  311. #define SQL_TIMESTAMP 11
  312. #define SQL_LONGVARCHAR (-1)
  313. #define SQL_BINARY (-2)
  314. #define SQL_VARBINARY (-3)
  315. #define SQL_LONGVARBINARY (-4)
  316. #define SQL_BIGINT (-5)
  317. #define SQL_TINYINT (-6)
  318. #define SQL_BIT (-7)
  319. #if (ODBCVER >= 0x0350)
  320. #define SQL_GUID (-11)
  321. #endif /* ODBCVER >= 0x0350 */
  322. #if (ODBCVER >= 0x0300)
  323. /* interval code */
  324. #define SQL_CODE_YEAR 1
  325. #define SQL_CODE_MONTH 2
  326. #define SQL_CODE_DAY 3
  327. #define SQL_CODE_HOUR 4
  328. #define SQL_CODE_MINUTE 5
  329. #define SQL_CODE_SECOND 6
  330. #define SQL_CODE_YEAR_TO_MONTH 7
  331. #define SQL_CODE_DAY_TO_HOUR 8
  332. #define SQL_CODE_DAY_TO_MINUTE 9
  333. #define SQL_CODE_DAY_TO_SECOND 10
  334. #define SQL_CODE_HOUR_TO_MINUTE 11
  335. #define SQL_CODE_HOUR_TO_SECOND 12
  336. #define SQL_CODE_MINUTE_TO_SECOND 13
  337. #define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR)
  338. #define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH)
  339. #define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY)
  340. #define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR)
  341. #define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE)
  342. #define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND)
  343. #define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH)
  344. #define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR)
  345. #define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE)
  346. #define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND)
  347. #define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE)
  348. #define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND)
  349. #define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND)
  350. #else
  351. #define SQL_INTERVAL_YEAR (-80)
  352. #define SQL_INTERVAL_MONTH (-81)
  353. #define SQL_INTERVAL_YEAR_TO_MONTH (-82)
  354. #define SQL_INTERVAL_DAY (-83)
  355. #define SQL_INTERVAL_HOUR (-84)
  356. #define SQL_INTERVAL_MINUTE (-85)
  357. #define SQL_INTERVAL_SECOND (-86)
  358. #define SQL_INTERVAL_DAY_TO_HOUR (-87)
  359. #define SQL_INTERVAL_DAY_TO_MINUTE (-88)
  360. #define SQL_INTERVAL_DAY_TO_SECOND (-89)
  361. #define SQL_INTERVAL_HOUR_TO_MINUTE (-90)
  362. #define SQL_INTERVAL_HOUR_TO_SECOND (-91)
  363. #define SQL_INTERVAL_MINUTE_TO_SECOND (-92)
  364. #endif /* ODBCVER >= 0x0300 */
  365. #if (ODBCVER <= 0x0300)
  366. #define SQL_UNICODE (-95)
  367. #define SQL_UNICODE_VARCHAR (-96)
  368. #define SQL_UNICODE_LONGVARCHAR (-97)
  369. #define SQL_UNICODE_CHAR SQL_UNICODE
  370. #else
  371. /* The previous definitions for SQL_UNICODE_ are historical and obsolete */
  372. #define SQL_UNICODE SQL_WCHAR
  373. #define SQL_UNICODE_VARCHAR SQL_WVARCHAR
  374. #define SQL_UNICODE_LONGVARCHAR SQL_WLONGVARCHAR
  375. #define SQL_UNICODE_CHAR SQL_WCHAR
  376. #endif
  377. #if (ODBCVER < 0x0300)
  378. #define SQL_TYPE_DRIVER_START SQL_INTERVAL_YEAR
  379. #define SQL_TYPE_DRIVER_END SQL_UNICODE_LONGVARCHAR
  380. #endif /* ODBCVER < 0x0300 */
  381. /* C datatype to SQL datatype mapping SQL types
  382. ------------------- */
  383. #define SQL_C_CHAR SQL_CHAR /* CHAR, VARCHAR, DECIMAL, NUMERIC */
  384. #define SQL_C_LONG SQL_INTEGER /* INTEGER */
  385. #define SQL_C_SHORT SQL_SMALLINT /* SMALLINT */
  386. #define SQL_C_FLOAT SQL_REAL /* REAL */
  387. #define SQL_C_DOUBLE SQL_DOUBLE /* FLOAT, DOUBLE */
  388. #if (ODBCVER >= 0x0300)
  389. #define SQL_C_NUMERIC SQL_NUMERIC
  390. #endif /* ODBCVER >= 0x0300 */
  391. #define SQL_C_DEFAULT 99
  392. #define SQL_SIGNED_OFFSET (-20)
  393. #define SQL_UNSIGNED_OFFSET (-22)
  394. /* C datatype to SQL datatype mapping */
  395. #define SQL_C_DATE SQL_DATE
  396. #define SQL_C_TIME SQL_TIME
  397. #define SQL_C_TIMESTAMP SQL_TIMESTAMP
  398. #if (ODBCVER >= 0x0300)
  399. #define SQL_C_TYPE_DATE SQL_TYPE_DATE
  400. #define SQL_C_TYPE_TIME SQL_TYPE_TIME
  401. #define SQL_C_TYPE_TIMESTAMP SQL_TYPE_TIMESTAMP
  402. #define SQL_C_INTERVAL_YEAR SQL_INTERVAL_YEAR
  403. #define SQL_C_INTERVAL_MONTH SQL_INTERVAL_MONTH
  404. #define SQL_C_INTERVAL_DAY SQL_INTERVAL_DAY
  405. #define SQL_C_INTERVAL_HOUR SQL_INTERVAL_HOUR
  406. #define SQL_C_INTERVAL_MINUTE SQL_INTERVAL_MINUTE
  407. #define SQL_C_INTERVAL_SECOND SQL_INTERVAL_SECOND
  408. #define SQL_C_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_YEAR_TO_MONTH
  409. #define SQL_C_INTERVAL_DAY_TO_HOUR SQL_INTERVAL_DAY_TO_HOUR
  410. #define SQL_C_INTERVAL_DAY_TO_MINUTE SQL_INTERVAL_DAY_TO_MINUTE
  411. #define SQL_C_INTERVAL_DAY_TO_SECOND SQL_INTERVAL_DAY_TO_SECOND
  412. #define SQL_C_INTERVAL_HOUR_TO_MINUTE SQL_INTERVAL_HOUR_TO_MINUTE
  413. #define SQL_C_INTERVAL_HOUR_TO_SECOND SQL_INTERVAL_HOUR_TO_SECOND
  414. #define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND
  415. #endif /* ODBCVER >= 0x0300 */
  416. #define SQL_C_BINARY SQL_BINARY
  417. #define SQL_C_BIT SQL_BIT
  418. #if (ODBCVER >= 0x0300)
  419. #define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) /* SIGNED BIGINT */
  420. #define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED BIGINT */
  421. #endif /* ODBCVER >= 0x0300 */
  422. #define SQL_C_TINYINT SQL_TINYINT
  423. #define SQL_C_SLONG (SQL_C_LONG+SQL_SIGNED_OFFSET) /* SIGNED INTEGER */
  424. #define SQL_C_SSHORT (SQL_C_SHORT+SQL_SIGNED_OFFSET) /* SIGNED SMALLINT */
  425. #define SQL_C_STINYINT (SQL_TINYINT+SQL_SIGNED_OFFSET) /* SIGNED TINYINT */
  426. #define SQL_C_ULONG (SQL_C_LONG+SQL_UNSIGNED_OFFSET) /* UNSIGNED INTEGER*/
  427. #define SQL_C_USHORT (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED SMALLINT*/
  428. #define SQL_C_UTINYINT (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED TINYINT*/
  429. #ifdef _WIN64
  430. #define SQL_C_BOOKMARK SQL_C_UBIGINT /* BOOKMARK */
  431. #else
  432. #define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */
  433. #endif
  434. #if (ODBCVER >= 0x0350)
  435. #define SQL_C_GUID SQL_GUID
  436. #endif /* ODBCVER >= 0x0350 */
  437. #define SQL_TYPE_NULL 0
  438. #if (ODBCVER < 0x0300)
  439. #define SQL_TYPE_MIN SQL_BIT
  440. #define SQL_TYPE_MAX SQL_VARCHAR
  441. #endif
  442. #if (ODBCVER >= 0x0300)
  443. #define SQL_C_VARBOOKMARK SQL_C_BINARY
  444. #endif /* ODBCVER >= 0x0300 */
  445. /* define for SQL_DIAG_ROW_NUMBER and SQL_DIAG_COLUMN_NUMBER */
  446. #if (ODBCVER >= 0x0300)
  447. #define SQL_NO_ROW_NUMBER (-1)
  448. #define SQL_NO_COLUMN_NUMBER (-1)
  449. #define SQL_ROW_NUMBER_UNKNOWN (-2)
  450. #define SQL_COLUMN_NUMBER_UNKNOWN (-2)
  451. #endif
  452. /* SQLBindParameter extensions */
  453. #define SQL_DEFAULT_PARAM (-5)
  454. #define SQL_IGNORE (-6)
  455. #if (ODBCVER >= 0x0300)
  456. #define SQL_COLUMN_IGNORE SQL_IGNORE
  457. #endif /* ODBCVER >= 0x0300 */
  458. #define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
  459. #define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
  460. /* binary length for driver specific attributes */
  461. #define SQL_LEN_BINARY_ATTR_OFFSET (-100)
  462. #define SQL_LEN_BINARY_ATTR(length) (-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
  463. /* Defines used by Driver Manager when mapping SQLSetParam to SQLBindParameter
  464. */
  465. #define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT
  466. #define SQL_SETPARAM_VALUE_MAX (-1L)
  467. /* SQLColAttributes defines */
  468. #define SQL_COLUMN_COUNT 0
  469. #define SQL_COLUMN_NAME 1
  470. #define SQL_COLUMN_TYPE 2
  471. #define SQL_COLUMN_LENGTH 3
  472. #define SQL_COLUMN_PRECISION 4
  473. #define SQL_COLUMN_SCALE 5
  474. #define SQL_COLUMN_DISPLAY_SIZE 6
  475. #define SQL_COLUMN_NULLABLE 7
  476. #define SQL_COLUMN_UNSIGNED 8
  477. #define SQL_COLUMN_MONEY 9
  478. #define SQL_COLUMN_UPDATABLE 10
  479. #define SQL_COLUMN_AUTO_INCREMENT 11
  480. #define SQL_COLUMN_CASE_SENSITIVE 12
  481. #define SQL_COLUMN_SEARCHABLE 13
  482. #define SQL_COLUMN_TYPE_NAME 14
  483. #define SQL_COLUMN_TABLE_NAME 15
  484. #define SQL_COLUMN_OWNER_NAME 16
  485. #define SQL_COLUMN_QUALIFIER_NAME 17
  486. #define SQL_COLUMN_LABEL 18
  487. #define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
  488. #if (ODBCVER < 0x0300)
  489. #define SQL_COLUMN_DRIVER_START 1000
  490. #endif /* ODBCVER < 0x0300 */
  491. #define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
  492. /* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */
  493. #define SQL_ATTR_READONLY 0
  494. #define SQL_ATTR_WRITE 1
  495. #define SQL_ATTR_READWRITE_UNKNOWN 2
  496. /* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */
  497. /* These are also used by SQLGetInfo */
  498. #define SQL_UNSEARCHABLE 0
  499. #define SQL_LIKE_ONLY 1
  500. #define SQL_ALL_EXCEPT_LIKE 2
  501. #define SQL_SEARCHABLE 3
  502. #define SQL_PRED_SEARCHABLE SQL_SEARCHABLE
  503. /* Special return values for SQLGetData */
  504. #define SQL_NO_TOTAL (-4)
  505. /********************************************/
  506. /* SQLGetFunctions: additional values for */
  507. /* fFunction to represent functions that */
  508. /* are not in the X/Open spec. */
  509. /********************************************/
  510. #if (ODBCVER >= 0x0300)
  511. #define SQL_API_SQLALLOCHANDLESTD 73
  512. #define SQL_API_SQLBULKOPERATIONS 24
  513. #endif /* ODBCVER >= 0x0300 */
  514. #define SQL_API_SQLBINDPARAMETER 72
  515. #define SQL_API_SQLBROWSECONNECT 55
  516. #define SQL_API_SQLCOLATTRIBUTES 6
  517. #define SQL_API_SQLCOLUMNPRIVILEGES 56
  518. #define SQL_API_SQLDESCRIBEPARAM 58
  519. #define SQL_API_SQLDRIVERCONNECT 41
  520. #define SQL_API_SQLDRIVERS 71
  521. #define SQL_API_SQLEXTENDEDFETCH 59
  522. #define SQL_API_SQLFOREIGNKEYS 60
  523. #define SQL_API_SQLMORERESULTS 61
  524. #define SQL_API_SQLNATIVESQL 62
  525. #define SQL_API_SQLNUMPARAMS 63
  526. #define SQL_API_SQLPARAMOPTIONS 64
  527. #define SQL_API_SQLPRIMARYKEYS 65
  528. #define SQL_API_SQLPROCEDURECOLUMNS 66
  529. #define SQL_API_SQLPROCEDURES 67
  530. #define SQL_API_SQLSETPOS 68
  531. #define SQL_API_SQLSETSCROLLOPTIONS 69
  532. #define SQL_API_SQLTABLEPRIVILEGES 70
  533. /*-------------------------------------------*/
  534. /* SQL_EXT_API_LAST is not useful with ODBC */
  535. /* version 3.0 because some of the values */
  536. /* from X/Open are in the 10000 range. */
  537. /*-------------------------------------------*/
  538. #if (ODBCVER < 0x0300)
  539. #define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER
  540. #define SQL_NUM_FUNCTIONS 23
  541. #define SQL_EXT_API_START 40
  542. #define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1)
  543. #endif
  544. /*--------------------------------------------*/
  545. /* SQL_API_ALL_FUNCTIONS returns an array */
  546. /* of 'booleans' representing whether a */
  547. /* function is implemented by the driver. */
  548. /* */
  549. /* CAUTION: Only functions defined in ODBC */
  550. /* version 2.0 and earlier are returned, the */
  551. /* new high-range function numbers defined by */
  552. /* X/Open break this scheme. See the new */
  553. /* method -- SQL_API_ODBC3_ALL_FUNCTIONS */
  554. /*--------------------------------------------*/
  555. #define SQL_API_ALL_FUNCTIONS 0 /* See CAUTION above */
  556. /*----------------------------------------------*/
  557. /* 2.X drivers export a dummy function with */
  558. /* ordinal number SQL_API_LOADBYORDINAL to speed*/
  559. /* loading under the windows operating system. */
  560. /* */
  561. /* CAUTION: Loading by ordinal is not supported */
  562. /* for 3.0 and above drivers. */
  563. /*----------------------------------------------*/
  564. #define SQL_API_LOADBYORDINAL 199 /* See CAUTION above */
  565. /*----------------------------------------------*/
  566. /* SQL_API_ODBC3_ALL_FUNCTIONS */
  567. /* This returns a bitmap, which allows us to */
  568. /* handle the higher-valued function numbers. */
  569. /* Use SQL_FUNC_EXISTS(bitmap,function_number) */
  570. /* to determine if the function exists. */
  571. /*----------------------------------------------*/
  572. #if (ODBCVER >= 0x0300)
  573. #define SQL_API_ODBC3_ALL_FUNCTIONS 999
  574. #define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE 250 /* array of 250 words */
  575. #define SQL_FUNC_EXISTS(pfExists, uwAPI) \
  576. ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) \
  577. & (1 << ((uwAPI) & 0x000F)) \
  578. ) ? SQL_TRUE : SQL_FALSE \
  579. )
  580. #endif /* ODBCVER >= 0x0300 */
  581. /************************************************/
  582. /* Extended definitions for SQLGetInfo */
  583. /************************************************/
  584. /*---------------------------------*/
  585. /* Values in ODBC 2.0 that are not */
  586. /* in the X/Open spec */
  587. /*---------------------------------*/
  588. #define SQL_INFO_FIRST 0
  589. #define SQL_ACTIVE_CONNECTIONS 0 /* MAX_DRIVER_CONNECTIONS */
  590. #define SQL_ACTIVE_STATEMENTS 1 /* MAX_CONCURRENT_ACTIVITIES */
  591. #define SQL_DRIVER_HDBC 3
  592. #define SQL_DRIVER_HENV 4
  593. #define SQL_DRIVER_HSTMT 5
  594. #define SQL_DRIVER_NAME 6
  595. #define SQL_DRIVER_VER 7
  596. #define SQL_ODBC_API_CONFORMANCE 9
  597. #define SQL_ODBC_VER 10
  598. #define SQL_ROW_UPDATES 11
  599. #define SQL_ODBC_SAG_CLI_CONFORMANCE 12
  600. #define SQL_ODBC_SQL_CONFORMANCE 15
  601. #define SQL_PROCEDURES 21
  602. #define SQL_CONCAT_NULL_BEHAVIOR 22
  603. #define SQL_CURSOR_ROLLBACK_BEHAVIOR 24
  604. #define SQL_EXPRESSIONS_IN_ORDERBY 27
  605. #define SQL_MAX_OWNER_NAME_LEN 32 /* MAX_SCHEMA_NAME_LEN */
  606. #define SQL_MAX_PROCEDURE_NAME_LEN 33
  607. #define SQL_MAX_QUALIFIER_NAME_LEN 34 /* MAX_CATALOG_NAME_LEN */
  608. #define SQL_MULT_RESULT_SETS 36
  609. #define SQL_MULTIPLE_ACTIVE_TXN 37
  610. #define SQL_OUTER_JOINS 38
  611. #define SQL_OWNER_TERM 39
  612. #define SQL_PROCEDURE_TERM 40
  613. #define SQL_QUALIFIER_NAME_SEPARATOR 41
  614. #define SQL_QUALIFIER_TERM 42
  615. #define SQL_SCROLL_OPTIONS 44
  616. #define SQL_TABLE_TERM 45
  617. #define SQL_CONVERT_FUNCTIONS 48
  618. #define SQL_NUMERIC_FUNCTIONS 49
  619. #define SQL_STRING_FUNCTIONS 50
  620. #define SQL_SYSTEM_FUNCTIONS 51
  621. #define SQL_TIMEDATE_FUNCTIONS 52
  622. #define SQL_CONVERT_BIGINT 53
  623. #define SQL_CONVERT_BINARY 54
  624. #define SQL_CONVERT_BIT 55
  625. #define SQL_CONVERT_CHAR 56
  626. #define SQL_CONVERT_DATE 57
  627. #define SQL_CONVERT_DECIMAL 58
  628. #define SQL_CONVERT_DOUBLE 59
  629. #define SQL_CONVERT_FLOAT 60
  630. #define SQL_CONVERT_INTEGER 61
  631. #define SQL_CONVERT_LONGVARCHAR 62
  632. #define SQL_CONVERT_NUMERIC 63
  633. #define SQL_CONVERT_REAL 64
  634. #define SQL_CONVERT_SMALLINT 65
  635. #define SQL_CONVERT_TIME 66
  636. #define SQL_CONVERT_TIMESTAMP 67
  637. #define SQL_CONVERT_TINYINT 68
  638. #define SQL_CONVERT_VARBINARY 69
  639. #define SQL_CONVERT_VARCHAR 70
  640. #define SQL_CONVERT_LONGVARBINARY 71
  641. #define SQL_ODBC_SQL_OPT_IEF 73 /* SQL_INTEGRITY */
  642. #define SQL_CORRELATION_NAME 74
  643. #define SQL_NON_NULLABLE_COLUMNS 75
  644. #define SQL_DRIVER_HLIB 76
  645. #define SQL_DRIVER_ODBC_VER 77
  646. #define SQL_LOCK_TYPES 78
  647. #define SQL_POS_OPERATIONS 79
  648. #define SQL_POSITIONED_STATEMENTS 80
  649. #define SQL_BOOKMARK_PERSISTENCE 82
  650. #define SQL_STATIC_SENSITIVITY 83
  651. #define SQL_FILE_USAGE 84
  652. #define SQL_COLUMN_ALIAS 87
  653. #define SQL_GROUP_BY 88
  654. #define SQL_KEYWORDS 89
  655. #define SQL_OWNER_USAGE 91
  656. #define SQL_QUALIFIER_USAGE 92
  657. #define SQL_QUOTED_IDENTIFIER_CASE 93
  658. #define SQL_SUBQUERIES 95
  659. #define SQL_UNION 96
  660. #define SQL_MAX_ROW_SIZE_INCLUDES_LONG 103
  661. #define SQL_MAX_CHAR_LITERAL_LEN 108
  662. #define SQL_TIMEDATE_ADD_INTERVALS 109
  663. #define SQL_TIMEDATE_DIFF_INTERVALS 110
  664. #define SQL_NEED_LONG_DATA_LEN 111
  665. #define SQL_MAX_BINARY_LITERAL_LEN 112
  666. #define SQL_LIKE_ESCAPE_CLAUSE 113
  667. #define SQL_QUALIFIER_LOCATION 114
  668. #if (ODBCVER >= 0x0201 && ODBCVER < 0x0300)
  669. #define SQL_OJ_CAPABILITIES 65003 /* Temp value until ODBC 3.0 */
  670. #endif /* ODBCVER >= 0x0201 && ODBCVER < 0x0300 */
  671. /*----------------------------------------------*/
  672. /* SQL_INFO_LAST and SQL_INFO_DRIVER_START are */
  673. /* not useful anymore, because X/Open has */
  674. /* values in the 10000 range. You */
  675. /* must contact X/Open directly to get a range */
  676. /* of numbers for driver-specific values. */
  677. /*----------------------------------------------*/
  678. #if (ODBCVER < 0x0300)
  679. #define SQL_INFO_LAST SQL_QUALIFIER_LOCATION
  680. #define SQL_INFO_DRIVER_START 1000
  681. #endif /* ODBCVER < 0x0300 */
  682. /*-----------------------------------------------*/
  683. /* ODBC 3.0 SQLGetInfo values that are not part */
  684. /* of the X/Open standard at this time. X/Open */
  685. /* standard values are in sql.h. */
  686. /*-----------------------------------------------*/
  687. #if (ODBCVER >= 0x0300)
  688. #define SQL_ACTIVE_ENVIRONMENTS 116
  689. #define SQL_ALTER_DOMAIN 117
  690. #define SQL_SQL_CONFORMANCE 118
  691. #define SQL_DATETIME_LITERALS 119
  692. #define SQL_ASYNC_MODE 10021 /* new X/Open spec */
  693. #define SQL_BATCH_ROW_COUNT 120
  694. #define SQL_BATCH_SUPPORT 121
  695. #define SQL_CATALOG_LOCATION SQL_QUALIFIER_LOCATION
  696. #define SQL_CATALOG_NAME_SEPARATOR SQL_QUALIFIER_NAME_SEPARATOR
  697. #define SQL_CATALOG_TERM SQL_QUALIFIER_TERM
  698. #define SQL_CATALOG_USAGE SQL_QUALIFIER_USAGE
  699. #define SQL_CONVERT_WCHAR 122
  700. #define SQL_CONVERT_INTERVAL_DAY_TIME 123
  701. #define SQL_CONVERT_INTERVAL_YEAR_MONTH 124
  702. #define SQL_CONVERT_WLONGVARCHAR 125
  703. #define SQL_CONVERT_WVARCHAR 126
  704. #define SQL_CREATE_ASSERTION 127
  705. #define SQL_CREATE_CHARACTER_SET 128
  706. #define SQL_CREATE_COLLATION 129
  707. #define SQL_CREATE_DOMAIN 130
  708. #define SQL_CREATE_SCHEMA 131
  709. #define SQL_CREATE_TABLE 132
  710. #define SQL_CREATE_TRANSLATION 133
  711. #define SQL_CREATE_VIEW 134
  712. #define SQL_DRIVER_HDESC 135
  713. #define SQL_DROP_ASSERTION 136
  714. #define SQL_DROP_CHARACTER_SET 137
  715. #define SQL_DROP_COLLATION 138
  716. #define SQL_DROP_DOMAIN 139
  717. #define SQL_DROP_SCHEMA 140
  718. #define SQL_DROP_TABLE 141
  719. #define SQL_DROP_TRANSLATION 142
  720. #define SQL_DROP_VIEW 143
  721. #define SQL_DYNAMIC_CURSOR_ATTRIBUTES1 144
  722. #define SQL_DYNAMIC_CURSOR_ATTRIBUTES2 145
  723. #define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 146
  724. #define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 147
  725. #define SQL_INDEX_KEYWORDS 148
  726. #define SQL_INFO_SCHEMA_VIEWS 149
  727. #define SQL_KEYSET_CURSOR_ATTRIBUTES1 150
  728. #define SQL_KEYSET_CURSOR_ATTRIBUTES2 151
  729. #define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS 10022 /* new X/Open spec */
  730. #define SQL_ODBC_INTERFACE_CONFORMANCE 152
  731. #define SQL_PARAM_ARRAY_ROW_COUNTS 153
  732. #define SQL_PARAM_ARRAY_SELECTS 154
  733. #define SQL_SCHEMA_TERM SQL_OWNER_TERM
  734. #define SQL_SCHEMA_USAGE SQL_OWNER_USAGE
  735. #define SQL_SQL92_DATETIME_FUNCTIONS 155
  736. #define SQL_SQL92_FOREIGN_KEY_DELETE_RULE 156
  737. #define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE 157
  738. #define SQL_SQL92_GRANT 158
  739. #define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS 159
  740. #define SQL_SQL92_PREDICATES 160
  741. #define SQL_SQL92_RELATIONAL_JOIN_OPERATORS 161
  742. #define SQL_SQL92_REVOKE 162
  743. #define SQL_SQL92_ROW_VALUE_CONSTRUCTOR 163
  744. #define SQL_SQL92_STRING_FUNCTIONS 164
  745. #define SQL_SQL92_VALUE_EXPRESSIONS 165
  746. #define SQL_STANDARD_CLI_CONFORMANCE 166
  747. #define SQL_STATIC_CURSOR_ATTRIBUTES1 167
  748. #define SQL_STATIC_CURSOR_ATTRIBUTES2 168
  749. #define SQL_AGGREGATE_FUNCTIONS 169
  750. #define SQL_DDL_INDEX 170
  751. #define SQL_DM_VER 171
  752. #define SQL_INSERT_STATEMENT 172
  753. #define SQL_CONVERT_GUID 173
  754. #define SQL_UNION_STATEMENT SQL_UNION
  755. #endif /* ODBCVER >= 0x0300 */
  756. #define SQL_DTC_TRANSITION_COST 1750
  757. /* SQL_ALTER_TABLE bitmasks */
  758. #if (ODBCVER >= 0x0300)
  759. /* the following 5 bitmasks are defined in sql.h
  760. *#define SQL_AT_ADD_COLUMN 0x00000001L
  761. *#define SQL_AT_DROP_COLUMN 0x00000002L
  762. *#define SQL_AT_ADD_CONSTRAINT 0x00000008L
  763. */
  764. #define SQL_AT_ADD_COLUMN_SINGLE 0x00000020L
  765. #define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L
  766. #define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L
  767. #define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L
  768. #define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L
  769. #define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L
  770. #define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L
  771. #define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L
  772. #define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L
  773. #define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L
  774. #define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L
  775. #define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L
  776. #define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L
  777. #define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L
  778. #define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L
  779. #endif /* ODBCVER >= 0x0300 */
  780. /* SQL_CONVERT_* return value bitmasks */
  781. #define SQL_CVT_CHAR 0x00000001L
  782. #define SQL_CVT_NUMERIC 0x00000002L
  783. #define SQL_CVT_DECIMAL 0x00000004L
  784. #define SQL_CVT_INTEGER 0x00000008L
  785. #define SQL_CVT_SMALLINT 0x00000010L
  786. #define SQL_CVT_FLOAT 0x00000020L
  787. #define SQL_CVT_REAL 0x00000040L
  788. #define SQL_CVT_DOUBLE 0x00000080L
  789. #define SQL_CVT_VARCHAR 0x00000100L
  790. #define SQL_CVT_LONGVARCHAR 0x00000200L
  791. #define SQL_CVT_BINARY 0x00000400L
  792. #define SQL_CVT_VARBINARY 0x00000800L
  793. #define SQL_CVT_BIT 0x00001000L
  794. #define SQL_CVT_TINYINT 0x00002000L
  795. #define SQL_CVT_BIGINT 0x00004000L
  796. #define SQL_CVT_DATE 0x00008000L
  797. #define SQL_CVT_TIME 0x00010000L
  798. #define SQL_CVT_TIMESTAMP 0x00020000L
  799. #define SQL_CVT_LONGVARBINARY 0x00040000L
  800. #if (ODBCVER >= 0x0300)
  801. #define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L
  802. #define SQL_CVT_INTERVAL_DAY_TIME 0x00100000L
  803. #define SQL_CVT_WCHAR 0x00200000L
  804. #define SQL_CVT_WLONGVARCHAR 0x00400000L
  805. #define SQL_CVT_WVARCHAR 0x00800000L
  806. #define SQL_CVT_GUID 0x01000000L
  807. #endif /* ODBCVER >= 0x0300 */
  808. /* SQL_CONVERT_FUNCTIONS functions */
  809. #define SQL_FN_CVT_CONVERT 0x00000001L
  810. #if (ODBCVER >= 0x0300)
  811. #define SQL_FN_CVT_CAST 0x00000002L
  812. #endif /* ODBCVER >= 0x0300 */
  813. /* SQL_STRING_FUNCTIONS functions */
  814. #define SQL_FN_STR_CONCAT 0x00000001L
  815. #define SQL_FN_STR_INSERT 0x00000002L
  816. #define SQL_FN_STR_LEFT 0x00000004L
  817. #define SQL_FN_STR_LTRIM 0x00000008L
  818. #define SQL_FN_STR_LENGTH 0x00000010L
  819. #define SQL_FN_STR_LOCATE 0x00000020L
  820. #define SQL_FN_STR_LCASE 0x00000040L
  821. #define SQL_FN_STR_REPEAT 0x00000080L
  822. #define SQL_FN_STR_REPLACE 0x00000100L
  823. #define SQL_FN_STR_RIGHT 0x00000200L
  824. #define SQL_FN_STR_RTRIM 0x00000400L
  825. #define SQL_FN_STR_SUBSTRING 0x00000800L
  826. #define SQL_FN_STR_UCASE 0x00001000L
  827. #define SQL_FN_STR_ASCII 0x00002000L
  828. #define SQL_FN_STR_CHAR 0x00004000L
  829. #define SQL_FN_STR_DIFFERENCE 0x00008000L
  830. #define SQL_FN_STR_LOCATE_2 0x00010000L
  831. #define SQL_FN_STR_SOUNDEX 0x00020000L
  832. #define SQL_FN_STR_SPACE 0x00040000L
  833. #if (ODBCVER >= 0x0300)
  834. #define SQL_FN_STR_BIT_LENGTH 0x00080000L
  835. #define SQL_FN_STR_CHAR_LENGTH 0x00100000L
  836. #define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L
  837. #define SQL_FN_STR_OCTET_LENGTH 0x00400000L
  838. #define SQL_FN_STR_POSITION 0x00800000L
  839. #endif /* ODBCVER >= 0x0300 */
  840. /* SQL_SQL92_STRING_FUNCTIONS */
  841. #if (ODBCVER >= 0x0300)
  842. #define SQL_SSF_CONVERT 0x00000001L
  843. #define SQL_SSF_LOWER 0x00000002L
  844. #define SQL_SSF_UPPER 0x00000004L
  845. #define SQL_SSF_SUBSTRING 0x00000008L
  846. #define SQL_SSF_TRANSLATE 0x00000010L
  847. #define SQL_SSF_TRIM_BOTH 0x00000020L
  848. #define SQL_SSF_TRIM_LEADING 0x00000040L
  849. #define SQL_SSF_TRIM_TRAILING 0x00000080L
  850. #endif /* ODBCVER >= 0x0300 */
  851. /* SQL_NUMERIC_FUNCTIONS functions */
  852. #define SQL_FN_NUM_ABS 0x00000001L
  853. #define SQL_FN_NUM_ACOS 0x00000002L
  854. #define SQL_FN_NUM_ASIN 0x00000004L
  855. #define SQL_FN_NUM_ATAN 0x00000008L
  856. #define SQL_FN_NUM_ATAN2 0x00000010L
  857. #define SQL_FN_NUM_CEILING 0x00000020L
  858. #define SQL_FN_NUM_COS 0x00000040L
  859. #define SQL_FN_NUM_COT 0x00000080L
  860. #define SQL_FN_NUM_EXP 0x00000100L
  861. #define SQL_FN_NUM_FLOOR 0x00000200L
  862. #define SQL_FN_NUM_LOG 0x00000400L
  863. #define SQL_FN_NUM_MOD 0x00000800L
  864. #define SQL_FN_NUM_SIGN 0x00001000L
  865. #define SQL_FN_NUM_SIN 0x00002000L
  866. #define SQL_FN_NUM_SQRT 0x00004000L
  867. #define SQL_FN_NUM_TAN 0x00008000L
  868. #define SQL_FN_NUM_PI 0x00010000L
  869. #define SQL_FN_NUM_RAND 0x00020000L
  870. #define SQL_FN_NUM_DEGREES 0x00040000L
  871. #define SQL_FN_NUM_LOG10 0x00080000L
  872. #define SQL_FN_NUM_POWER 0x00100000L
  873. #define SQL_FN_NUM_RADIANS 0x00200000L
  874. #define SQL_FN_NUM_ROUND 0x00400000L
  875. #define SQL_FN_NUM_TRUNCATE 0x00800000L
  876. /* SQL_SQL92_NUMERIC_VALUE_FUNCTIONS */
  877. #if (ODBCVER >= 0x0300)
  878. #define SQL_SNVF_BIT_LENGTH 0x00000001L
  879. #define SQL_SNVF_CHAR_LENGTH 0x00000002L
  880. #define SQL_SNVF_CHARACTER_LENGTH 0x00000004L
  881. #define SQL_SNVF_EXTRACT 0x00000008L
  882. #define SQL_SNVF_OCTET_LENGTH 0x00000010L
  883. #define SQL_SNVF_POSITION 0x00000020L
  884. #endif /* ODBCVER >= 0x0300 */
  885. /* SQL_TIMEDATE_FUNCTIONS functions */
  886. #define SQL_FN_TD_NOW 0x00000001L
  887. #define SQL_FN_TD_CURDATE 0x00000002L
  888. #define SQL_FN_TD_DAYOFMONTH 0x00000004L
  889. #define SQL_FN_TD_DAYOFWEEK 0x00000008L
  890. #define SQL_FN_TD_DAYOFYEAR 0x00000010L
  891. #define SQL_FN_TD_MONTH 0x00000020L
  892. #define SQL_FN_TD_QUARTER 0x00000040L
  893. #define SQL_FN_TD_WEEK 0x00000080L
  894. #define SQL_FN_TD_YEAR 0x00000100L
  895. #define SQL_FN_TD_CURTIME 0x00000200L
  896. #define SQL_FN_TD_HOUR 0x00000400L
  897. #define SQL_FN_TD_MINUTE 0x00000800L
  898. #define SQL_FN_TD_SECOND 0x00001000L
  899. #define SQL_FN_TD_TIMESTAMPADD 0x00002000L
  900. #define SQL_FN_TD_TIMESTAMPDIFF 0x00004000L
  901. #define SQL_FN_TD_DAYNAME 0x00008000L
  902. #define SQL_FN_TD_MONTHNAME 0x00010000L
  903. #if (ODBCVER >= 0x0300)
  904. #define SQL_FN_TD_CURRENT_DATE 0x00020000L
  905. #define SQL_FN_TD_CURRENT_TIME 0x00040000L
  906. #define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L
  907. #define SQL_FN_TD_EXTRACT 0x00100000L
  908. #endif /* ODBCVER >= 0x0300 */
  909. /* SQL_SQL92_DATETIME_FUNCTIONS */
  910. #if (ODBCVER >= 0x0300)
  911. #define SQL_SDF_CURRENT_DATE 0x00000001L
  912. #define SQL_SDF_CURRENT_TIME 0x00000002L
  913. #define SQL_SDF_CURRENT_TIMESTAMP 0x00000004L
  914. #endif /* ODBCVER >= 0x0300 */
  915. /* SQL_SYSTEM_FUNCTIONS functions */
  916. #define SQL_FN_SYS_USERNAME 0x00000001L
  917. #define SQL_FN_SYS_DBNAME 0x00000002L
  918. #define SQL_FN_SYS_IFNULL 0x00000004L
  919. /* SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions */
  920. #define SQL_FN_TSI_FRAC_SECOND 0x00000001L
  921. #define SQL_FN_TSI_SECOND 0x00000002L
  922. #define SQL_FN_TSI_MINUTE 0x00000004L
  923. #define SQL_FN_TSI_HOUR 0x00000008L
  924. #define SQL_FN_TSI_DAY 0x00000010L
  925. #define SQL_FN_TSI_WEEK 0x00000020L
  926. #define SQL_FN_TSI_MONTH 0x00000040L
  927. #define SQL_FN_TSI_QUARTER 0x00000080L
  928. #define SQL_FN_TSI_YEAR 0x00000100L
  929. /* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES1,
  930. * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1,
  931. * SQL_KEYSET_CURSOR_ATTRIBUTES1, and SQL_STATIC_CURSOR_ATTRIBUTES1
  932. */
  933. #if (ODBCVER >= 0x0300)
  934. /* supported SQLFetchScroll FetchOrientation's */
  935. #define SQL_CA1_NEXT 0x00000001L
  936. #define SQL_CA1_ABSOLUTE 0x00000002L
  937. #define SQL_CA1_RELATIVE 0x00000004L
  938. #define SQL_CA1_BOOKMARK 0x00000008L
  939. /* supported SQLSetPos LockType's */
  940. #define SQL_CA1_LOCK_NO_CHANGE 0x00000040L
  941. #define SQL_CA1_LOCK_EXCLUSIVE 0x00000080L
  942. #define SQL_CA1_LOCK_UNLOCK 0x00000100L
  943. /* supported SQLSetPos Operations */
  944. #define SQL_CA1_POS_POSITION 0x00000200L
  945. #define SQL_CA1_POS_UPDATE 0x00000400L
  946. #define SQL_CA1_POS_DELETE 0x00000800L
  947. #define SQL_CA1_POS_REFRESH 0x00001000L
  948. /* positioned updates and deletes */
  949. #define SQL_CA1_POSITIONED_UPDATE 0x00002000L
  950. #define SQL_CA1_POSITIONED_DELETE 0x00004000L
  951. #define SQL_CA1_SELECT_FOR_UPDATE 0x00008000L
  952. /* supported SQLBulkOperations operations */
  953. #define SQL_CA1_BULK_ADD 0x00010000L
  954. #define SQL_CA1_BULK_UPDATE_BY_BOOKMARK 0x00020000L
  955. #define SQL_CA1_BULK_DELETE_BY_BOOKMARK 0x00040000L
  956. #define SQL_CA1_BULK_FETCH_BY_BOOKMARK 0x00080000L
  957. #endif /* ODBCVER >= 0x0300 */
  958. /* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES2,
  959. * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2,
  960. * SQL_KEYSET_CURSOR_ATTRIBUTES2, and SQL_STATIC_CURSOR_ATTRIBUTES2
  961. */
  962. #if (ODBCVER >= 0x0300)
  963. /* supported values for SQL_ATTR_SCROLL_CONCURRENCY */
  964. #define SQL_CA2_READ_ONLY_CONCURRENCY 0x00000001L
  965. #define SQL_CA2_LOCK_CONCURRENCY 0x00000002L
  966. #define SQL_CA2_OPT_ROWVER_CONCURRENCY 0x00000004L
  967. #define SQL_CA2_OPT_VALUES_CONCURRENCY 0x00000008L
  968. /* sensitivity of the cursor to its own inserts, deletes, and updates */
  969. #define SQL_CA2_SENSITIVITY_ADDITIONS 0x00000010L
  970. #define SQL_CA2_SENSITIVITY_DELETIONS 0x00000020L
  971. #define SQL_CA2_SENSITIVITY_UPDATES 0x00000040L
  972. /* semantics of SQL_ATTR_MAX_ROWS */
  973. #define SQL_CA2_MAX_ROWS_SELECT 0x00000080L
  974. #define SQL_CA2_MAX_ROWS_INSERT 0x00000100L
  975. #define SQL_CA2_MAX_ROWS_DELETE 0x00000200L
  976. #define SQL_CA2_MAX_ROWS_UPDATE 0x00000400L
  977. #define SQL_CA2_MAX_ROWS_CATALOG 0x00000800L
  978. #define SQL_CA2_MAX_ROWS_AFFECTS_ALL (SQL_CA2_MAX_ROWS_SELECT | \
  979. SQL_CA2_MAX_ROWS_INSERT | SQL_CA2_MAX_ROWS_DELETE | \
  980. SQL_CA2_MAX_ROWS_UPDATE | SQL_CA2_MAX_ROWS_CATALOG)
  981. /* semantics of SQL_DIAG_CURSOR_ROW_COUNT */
  982. #define SQL_CA2_CRC_EXACT 0x00001000L
  983. #define SQL_CA2_CRC_APPROXIMATE 0x00002000L
  984. /* the kinds of positioned statements that can be simulated */
  985. #define SQL_CA2_SIMULATE_NON_UNIQUE 0x00004000L
  986. #define SQL_CA2_SIMULATE_TRY_UNIQUE 0x00008000L
  987. #define SQL_CA2_SIMULATE_UNIQUE 0x00010000L
  988. #endif /* ODBCVER >= 0x0300 */
  989. /* SQL_ODBC_API_CONFORMANCE values */
  990. #define SQL_OAC_NONE 0x0000
  991. #define SQL_OAC_LEVEL1 0x0001
  992. #define SQL_OAC_LEVEL2 0x0002
  993. /* SQL_ODBC_SAG_CLI_CONFORMANCE values */
  994. #define SQL_OSCC_NOT_COMPLIANT 0x0000
  995. #define SQL_OSCC_COMPLIANT 0x0001
  996. /* SQL_ODBC_SQL_CONFORMANCE values */
  997. #define SQL_OSC_MINIMUM 0x0000
  998. #define SQL_OSC_CORE 0x0001
  999. #define SQL_OSC_EXTENDED 0x0002
  1000. /* SQL_CONCAT_NULL_BEHAVIOR values */
  1001. #define SQL_CB_NULL 0x0000
  1002. #define SQL_CB_NON_NULL 0x0001
  1003. /* SQL_SCROLL_OPTIONS masks */
  1004. #define SQL_SO_FORWARD_ONLY 0x00000001L
  1005. #define SQL_SO_KEYSET_DRIVEN 0x00000002L
  1006. #define SQL_SO_DYNAMIC 0x00000004L
  1007. #define SQL_SO_MIXED 0x00000008L
  1008. #define SQL_SO_STATIC 0x00000010L
  1009. /* SQL_FETCH_DIRECTION masks */
  1010. /* SQL_FETCH_RESUME is no longer supported
  1011. #define SQL_FD_FETCH_RESUME 0x00000040L
  1012. */
  1013. #define SQL_FD_FETCH_BOOKMARK 0x00000080L
  1014. /* SQL_TXN_ISOLATION_OPTION masks */
  1015. /* SQL_TXN_VERSIONING is no longer supported
  1016. #define SQL_TXN_VERSIONING 0x00000010L
  1017. */
  1018. /* SQL_CORRELATION_NAME values */
  1019. #define SQL_CN_NONE 0x0000
  1020. #define SQL_CN_DIFFERENT 0x0001
  1021. #define SQL_CN_ANY 0x0002
  1022. /* SQL_NON_NULLABLE_COLUMNS values */
  1023. #define SQL_NNC_NULL 0x0000
  1024. #define SQL_NNC_NON_NULL 0x0001
  1025. /* SQL_NULL_COLLATION values */
  1026. #define SQL_NC_START 0x0002
  1027. #define SQL_NC_END 0x0004
  1028. /* SQL_FILE_USAGE values */
  1029. #define SQL_FILE_NOT_SUPPORTED 0x0000
  1030. #define SQL_FILE_TABLE 0x0001
  1031. #define SQL_FILE_QUALIFIER 0x0002
  1032. #define SQL_FILE_CATALOG SQL_FILE_QUALIFIER // ODBC 3.0
  1033. /* SQL_GETDATA_EXTENSIONS values */
  1034. #define SQL_GD_BLOCK 0x00000004L
  1035. #define SQL_GD_BOUND 0x00000008L
  1036. /* SQL_POSITIONED_STATEMENTS masks */
  1037. #define SQL_PS_POSITIONED_DELETE 0x00000001L
  1038. #define SQL_PS_POSITIONED_UPDATE 0x00000002L
  1039. #define SQL_PS_SELECT_FOR_UPDATE 0x00000004L
  1040. /* SQL_GROUP_BY values */
  1041. #define SQL_GB_NOT_SUPPORTED 0x0000
  1042. #define SQL_GB_GROUP_BY_EQUALS_SELECT 0x0001
  1043. #define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002
  1044. #define SQL_GB_NO_RELATION 0x0003
  1045. #if (ODBCVER >= 0x0300)
  1046. #define SQL_GB_COLLATE 0x0004
  1047. #endif /* ODBCVER >= 0x0300 */
  1048. /* SQL_OWNER_USAGE masks */
  1049. #define SQL_OU_DML_STATEMENTS 0x00000001L
  1050. #define SQL_OU_PROCEDURE_INVOCATION 0x00000002L
  1051. #define SQL_OU_TABLE_DEFINITION 0x00000004L
  1052. #define SQL_OU_INDEX_DEFINITION 0x00000008L
  1053. #define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L
  1054. /* SQL_SCHEMA_USAGE masks */
  1055. #if (ODBCVER >= 0x0300)
  1056. #define SQL_SU_DML_STATEMENTS SQL_OU_DML_STATEMENTS
  1057. #define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION
  1058. #define SQL_SU_TABLE_DEFINITION SQL_OU_TABLE_DEFINITION
  1059. #define SQL_SU_INDEX_DEFINITION SQL_OU_INDEX_DEFINITION
  1060. #define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION
  1061. #endif /* ODBCVER >= 0x0300 */
  1062. /* SQL_QUALIFIER_USAGE masks */
  1063. #define SQL_QU_DML_STATEMENTS 0x00000001L
  1064. #define SQL_QU_PROCEDURE_INVOCATION 0x00000002L
  1065. #define SQL_QU_TABLE_DEFINITION 0x00000004L
  1066. #define SQL_QU_INDEX_DEFINITION 0x00000008L
  1067. #define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L
  1068. #if (ODBCVER >= 0x0300)
  1069. /* SQL_CATALOG_USAGE masks */
  1070. #define SQL_CU_DML_STATEMENTS SQL_QU_DML_STATEMENTS
  1071. #define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION
  1072. #define SQL_CU_TABLE_DEFINITION SQL_QU_TABLE_DEFINITION
  1073. #define SQL_CU_INDEX_DEFINITION SQL_QU_INDEX_DEFINITION
  1074. #define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION
  1075. #endif /* ODBCVER >= 0x0300 */
  1076. /* SQL_SUBQUERIES masks */
  1077. #define SQL_SQ_COMPARISON 0x00000001L
  1078. #define SQL_SQ_EXISTS 0x00000002L
  1079. #define SQL_SQ_IN 0x00000004L
  1080. #define SQL_SQ_QUANTIFIED 0x00000008L
  1081. #define SQL_SQ_CORRELATED_SUBQUERIES 0x00000010L
  1082. /* SQL_UNION masks */
  1083. #define SQL_U_UNION 0x00000001L
  1084. #define SQL_U_UNION_ALL 0x00000002L
  1085. /* SQL_BOOKMARK_PERSISTENCE values */
  1086. #define SQL_BP_CLOSE 0x00000001L
  1087. #define SQL_BP_DELETE 0x00000002L
  1088. #define SQL_BP_DROP 0x00000004L
  1089. #define SQL_BP_TRANSACTION 0x00000008L
  1090. #define SQL_BP_UPDATE 0x00000010L
  1091. #define SQL_BP_OTHER_HSTMT 0x00000020L
  1092. #define SQL_BP_SCROLL 0x00000040L
  1093. /* SQL_STATIC_SENSITIVITY values */
  1094. #define SQL_SS_ADDITIONS 0x00000001L
  1095. #define SQL_SS_DELETIONS 0x00000002L
  1096. #define SQL_SS_UPDATES 0x00000004L
  1097. /* SQL_VIEW values */
  1098. #define SQL_CV_CREATE_VIEW 0x00000001L
  1099. #define SQL_CV_CHECK_OPTION 0x00000002L
  1100. #define SQL_CV_CASCADED 0x00000004L
  1101. #define SQL_CV_LOCAL 0x00000008L
  1102. /* SQL_LOCK_TYPES masks */
  1103. #define SQL_LCK_NO_CHANGE 0x00000001L
  1104. #define SQL_LCK_EXCLUSIVE 0x00000002L
  1105. #define SQL_LCK_UNLOCK 0x00000004L
  1106. /* SQL_POS_OPERATIONS masks */
  1107. #define SQL_POS_POSITION 0x00000001L
  1108. #define SQL_POS_REFRESH 0x00000002L
  1109. #define SQL_POS_UPDATE 0x00000004L
  1110. #define SQL_POS_DELETE 0x00000008L
  1111. #define SQL_POS_ADD 0x00000010L
  1112. /* SQL_QUALIFIER_LOCATION values */
  1113. #define SQL_QL_START 0x0001
  1114. #define SQL_QL_END 0x0002
  1115. /* Here start return values for ODBC 3.0 SQLGetInfo */
  1116. #if (ODBCVER >= 0x0300)
  1117. /* SQL_AGGREGATE_FUNCTIONS bitmasks */
  1118. #define SQL_AF_AVG 0x00000001L
  1119. #define SQL_AF_COUNT 0x00000002L
  1120. #define SQL_AF_MAX 0x00000004L
  1121. #define SQL_AF_MIN 0x00000008L
  1122. #define SQL_AF_SUM 0x00000010L
  1123. #define SQL_AF_DISTINCT 0x00000020L
  1124. #define SQL_AF_ALL 0x00000040L
  1125. /* SQL_SQL_CONFORMANCE bit masks */
  1126. #define SQL_SC_SQL92_ENTRY 0x00000001L
  1127. #define SQL_SC_FIPS127_2_TRANSITIONAL 0x00000002L
  1128. #define SQL_SC_SQL92_INTERMEDIATE 0x00000004L
  1129. #define SQL_SC_SQL92_FULL 0x00000008L
  1130. /* SQL_DATETIME_LITERALS masks */
  1131. #define SQL_DL_SQL92_DATE 0x00000001L
  1132. #define SQL_DL_SQL92_TIME 0x00000002L
  1133. #define SQL_DL_SQL92_TIMESTAMP 0x00000004L
  1134. #define SQL_DL_SQL92_INTERVAL_YEAR 0x00000008L
  1135. #define SQL_DL_SQL92_INTERVAL_MONTH 0x00000010L
  1136. #define SQL_DL_SQL92_INTERVAL_DAY 0x00000020L
  1137. #define SQL_DL_SQL92_INTERVAL_HOUR 0x00000040L
  1138. #define SQL_DL_SQL92_INTERVAL_MINUTE 0x00000080L
  1139. #define SQL_DL_SQL92_INTERVAL_SECOND 0x00000100L
  1140. #define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH 0x00000200L
  1141. #define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR 0x00000400L
  1142. #define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE 0x00000800L
  1143. #define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND 0x00001000L
  1144. #define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE 0x00002000L
  1145. #define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND 0x00004000L
  1146. #define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND 0x00008000L
  1147. /* SQL_CATALOG_LOCATION values */
  1148. #define SQL_CL_START SQL_QL_START
  1149. #define SQL_CL_END SQL_QL_END
  1150. /* values for SQL_BATCH_ROW_COUNT */
  1151. #define SQL_BRC_PROCEDURES 0x0000001
  1152. #define SQL_BRC_EXPLICIT 0x0000002
  1153. #define SQL_BRC_ROLLED_UP 0x0000004
  1154. /* bitmasks for SQL_BATCH_SUPPORT */
  1155. #define SQL_BS_SELECT_EXPLICIT 0x00000001L
  1156. #define SQL_BS_ROW_COUNT_EXPLICIT 0x00000002L
  1157. #define SQL_BS_SELECT_PROC 0x00000004L
  1158. #define SQL_BS_ROW_COUNT_PROC 0x00000008L
  1159. /* Values for SQL_PARAM_ARRAY_ROW_COUNTS getinfo */
  1160. #define SQL_PARC_BATCH 1
  1161. #define SQL_PARC_NO_BATCH 2
  1162. /* values for SQL_PARAM_ARRAY_SELECTS */
  1163. #define SQL_PAS_BATCH 1
  1164. #define SQL_PAS_NO_BATCH 2
  1165. #define SQL_PAS_NO_SELECT 3
  1166. /* Bitmasks for SQL_INDEX_KEYWORDS */
  1167. #define SQL_IK_NONE 0x00000000L
  1168. #define SQL_IK_ASC 0x00000001L
  1169. #define SQL_IK_DESC 0x00000002L
  1170. #define SQL_IK_ALL (SQL_IK_ASC | SQL_IK_DESC)
  1171. /* Bitmasks for SQL_INFO_SCHEMA_VIEWS */
  1172. #define SQL_ISV_ASSERTIONS 0x00000001L
  1173. #define SQL_ISV_CHARACTER_SETS 0x00000002L
  1174. #define SQL_ISV_CHECK_CONSTRAINTS 0x00000004L
  1175. #define SQL_ISV_COLLATIONS 0x00000008L
  1176. #define SQL_ISV_COLUMN_DOMAIN_USAGE 0x00000010L
  1177. #define SQL_ISV_COLUMN_PRIVILEGES 0x00000020L
  1178. #define SQL_ISV_COLUMNS 0x00000040L
  1179. #define SQL_ISV_CONSTRAINT_COLUMN_USAGE 0x00000080L
  1180. #define SQL_ISV_CONSTRAINT_TABLE_USAGE 0x00000100L
  1181. #define SQL_ISV_DOMAIN_CONSTRAINTS 0x00000200L
  1182. #define SQL_ISV_DOMAINS 0x00000400L
  1183. #define SQL_ISV_KEY_COLUMN_USAGE 0x00000800L
  1184. #define SQL_ISV_REFERENTIAL_CONSTRAINTS 0x00001000L
  1185. #define SQL_ISV_SCHEMATA 0x00002000L
  1186. #define SQL_ISV_SQL_LANGUAGES 0x00004000L
  1187. #define SQL_ISV_TABLE_CONSTRAINTS 0x00008000L
  1188. #define SQL_ISV_TABLE_PRIVILEGES 0x00010000L
  1189. #define SQL_ISV_TABLES 0x00020000L
  1190. #define SQL_ISV_TRANSLATIONS 0x00040000L
  1191. #define SQL_ISV_USAGE_PRIVILEGES 0x00080000L
  1192. #define SQL_ISV_VIEW_COLUMN_USAGE 0x00100000L
  1193. #define SQL_ISV_VIEW_TABLE_USAGE 0x00200000L
  1194. #define SQL_ISV_VIEWS 0x00400000L
  1195. /* Bitmasks for SQL_ASYNC_MODE */
  1196. #define SQL_AM_NONE 0
  1197. #define SQL_AM_CONNECTION 1
  1198. #define SQL_AM_STATEMENT 2
  1199. /* Bitmasks for SQL_ALTER_DOMAIN */
  1200. #define SQL_AD_CONSTRAINT_NAME_DEFINITION 0x00000001L
  1201. #define SQL_AD_ADD_DOMAIN_CONSTRAINT 0x00000002L
  1202. #define SQL_AD_DROP_DOMAIN_CONSTRAINT 0x00000004L
  1203. #define SQL_AD_ADD_DOMAIN_DEFAULT 0x00000008L
  1204. #define SQL_AD_DROP_DOMAIN_DEFAULT 0x00000010L
  1205. #define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L
  1206. #define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L
  1207. #define SQL_AD_ADD_CONSTRAINT_DEFERRABLE 0x00000080L
  1208. #define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE 0x00000100L
  1209. /* SQL_CREATE_SCHEMA bitmasks */
  1210. #define SQL_CS_CREATE_SCHEMA 0x00000001L
  1211. #define SQL_CS_AUTHORIZATION 0x00000002L
  1212. #define SQL_CS_DEFAULT_CHARACTER_SET 0x00000004L
  1213. /* SQL_CREATE_TRANSLATION bitmasks */
  1214. #define SQL_CTR_CREATE_TRANSLATION 0x00000001L
  1215. /* SQL_CREATE_ASSERTION bitmasks */
  1216. #define SQL_CA_CREATE_ASSERTION 0x00000001L
  1217. #define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED 0x00000010L
  1218. #define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000020L
  1219. #define SQL_CA_CONSTRAINT_DEFERRABLE 0x00000040L
  1220. #define SQL_CA_CONSTRAINT_NON_DEFERRABLE 0x00000080L
  1221. /* SQL_CREATE_CHARACTER_SET bitmasks */
  1222. #define SQL_CCS_CREATE_CHARACTER_SET 0x00000001L
  1223. #define SQL_CCS_COLLATE_CLAUSE 0x00000002L
  1224. #define SQL_CCS_LIMITED_COLLATION 0x00000004L
  1225. /* SQL_CREATE_COLLATION bitmasks */
  1226. #define SQL_CCOL_CREATE_COLLATION 0x00000001L
  1227. /* SQL_CREATE_DOMAIN bitmasks */
  1228. #define SQL_CDO_CREATE_DOMAIN 0x00000001L
  1229. #define SQL_CDO_DEFAULT 0x00000002L
  1230. #define SQL_CDO_CONSTRAINT 0x00000004L
  1231. #define SQL_CDO_COLLATION 0x00000008L
  1232. #define SQL_CDO_CONSTRAINT_NAME_DEFINITION 0x00000010L
  1233. #define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L
  1234. #define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L
  1235. #define SQL_CDO_CONSTRAINT_DEFERRABLE 0x00000080L
  1236. #define SQL_CDO_CONSTRAINT_NON_DEFERRABLE 0x00000100L
  1237. /* SQL_CREATE_TABLE bitmasks */
  1238. #define SQL_CT_CREATE_TABLE 0x00000001L
  1239. #define SQL_CT_COMMIT_PRESERVE 0x00000002L
  1240. #define SQL_CT_COMMIT_DELETE 0x00000004L
  1241. #define SQL_CT_GLOBAL_TEMPORARY 0x00000008L
  1242. #define SQL_CT_LOCAL_TEMPORARY 0x00000010L
  1243. #define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED 0x00000020L
  1244. #define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00000040L
  1245. #define SQL_CT_CONSTRAINT_DEFERRABLE 0x00000080L
  1246. #define SQL_CT_CONSTRAINT_NON_DEFERRABLE 0x00000100L
  1247. #define SQL_CT_COLUMN_CONSTRAINT 0x00000200L
  1248. #define SQL_CT_COLUMN_DEFAULT 0x00000400L
  1249. #define SQL_CT_COLUMN_COLLATION 0x00000800L
  1250. #define SQL_CT_TABLE_CONSTRAINT 0x00001000L
  1251. #define SQL_CT_CONSTRAINT_NAME_DEFINITION 0x00002000L
  1252. /* SQL_DDL_INDEX bitmasks */
  1253. #define SQL_DI_CREATE_INDEX 0x00000001L
  1254. #define SQL_DI_DROP_INDEX 0x00000002L
  1255. /* SQL_DROP_COLLATION bitmasks */
  1256. #define SQL_DC_DROP_COLLATION 0x00000001L
  1257. /* SQL_DROP_DOMAIN bitmasks */
  1258. #define SQL_DD_DROP_DOMAIN 0x00000001L
  1259. #define SQL_DD_RESTRICT 0x00000002L
  1260. #define SQL_DD_CASCADE 0x00000004L
  1261. /* SQL_DROP_SCHEMA bitmasks */
  1262. #define SQL_DS_DROP_SCHEMA 0x00000001L
  1263. #define SQL_DS_RESTRICT 0x00000002L
  1264. #define SQL_DS_CASCADE 0x00000004L
  1265. /* SQL_DROP_CHARACTER_SET bitmasks */
  1266. #define SQL_DCS_DROP_CHARACTER_SET 0x00000001L
  1267. /* SQL_DROP_ASSERTION bitmasks */
  1268. #define SQL_DA_DROP_ASSERTION 0x00000001L
  1269. /* SQL_DROP_TABLE bitmasks */
  1270. #define SQL_DT_DROP_TABLE 0x00000001L
  1271. #define SQL_DT_RESTRICT 0x00000002L
  1272. #define SQL_DT_CASCADE 0x00000004L
  1273. /* SQL_DROP_TRANSLATION bitmasks */
  1274. #define SQL_DTR_DROP_TRANSLATION 0x00000001L
  1275. /* SQL_DROP_VIEW bitmasks */
  1276. #define SQL_DV_DROP_VIEW 0x00000001L
  1277. #define SQL_DV_RESTRICT 0x00000002L
  1278. #define SQL_DV_CASCADE 0x00000004L
  1279. /* SQL_INSERT_STATEMENT bitmasks */
  1280. #define SQL_IS_INSERT_LITERALS 0x00000001L
  1281. #define SQL_IS_INSERT_SEARCHED 0x00000002L
  1282. #define SQL_IS_SELECT_INTO 0x00000004L
  1283. /* SQL_ODBC_INTERFACE_CONFORMANCE values */
  1284. #define SQL_OIC_CORE 1UL
  1285. #define SQL_OIC_LEVEL1 2UL
  1286. #define SQL_OIC_LEVEL2 3UL
  1287. /* SQL_SQL92_FOREIGN_KEY_DELETE_RULE bitmasks */
  1288. #define SQL_SFKD_CASCADE 0x00000001L
  1289. #define SQL_SFKD_NO_ACTION 0x00000002L
  1290. #define SQL_SFKD_SET_DEFAULT 0x00000004L
  1291. #define SQL_SFKD_SET_NULL 0x00000008L
  1292. /* SQL_SQL92_FOREIGN_KEY_UPDATE_RULE bitmasks */
  1293. #define SQL_SFKU_CASCADE 0x00000001L
  1294. #define SQL_SFKU_NO_ACTION 0x00000002L
  1295. #define SQL_SFKU_SET_DEFAULT 0x00000004L
  1296. #define SQL_SFKU_SET_NULL 0x00000008L
  1297. /* SQL_SQL92_GRANT bitmasks */
  1298. #define SQL_SG_USAGE_ON_DOMAIN 0x00000001L
  1299. #define SQL_SG_USAGE_ON_CHARACTER_SET 0x00000002L
  1300. #define SQL_SG_USAGE_ON_COLLATION 0x00000004L
  1301. #define SQL_SG_USAGE_ON_TRANSLATION 0x00000008L
  1302. #define SQL_SG_WITH_GRANT_OPTION 0x00000010L
  1303. #define SQL_SG_DELETE_TABLE 0x00000020L
  1304. #define SQL_SG_INSERT_TABLE 0x00000040L
  1305. #define SQL_SG_INSERT_COLUMN 0x00000080L
  1306. #define SQL_SG_REFERENCES_TABLE 0x00000100L
  1307. #define SQL_SG_REFERENCES_COLUMN 0x00000200L
  1308. #define SQL_SG_SELECT_TABLE 0x00000400L
  1309. #define SQL_SG_UPDATE_TABLE 0x00000800L
  1310. #define SQL_SG_UPDATE_COLUMN 0x00001000L
  1311. /* SQL_SQL92_PREDICATES bitmasks */
  1312. #define SQL_SP_EXISTS 0x00000001L
  1313. #define SQL_SP_ISNOTNULL 0x00000002L
  1314. #define SQL_SP_ISNULL 0x00000004L
  1315. #define SQL_SP_MATCH_FULL 0x00000008L
  1316. #define SQL_SP_MATCH_PARTIAL 0x00000010L
  1317. #define SQL_SP_MATCH_UNIQUE_FULL 0x00000020L
  1318. #define SQL_SP_MATCH_UNIQUE_PARTIAL 0x00000040L
  1319. #define SQL_SP_OVERLAPS 0x00000080L
  1320. #define SQL_SP_UNIQUE 0x00000100L
  1321. #define SQL_SP_LIKE 0x00000200L
  1322. #define SQL_SP_IN 0x00000400L
  1323. #define SQL_SP_BETWEEN 0x00000800L
  1324. #define SQL_SP_COMPARISON 0x00001000L
  1325. #define SQL_SP_QUANTIFIED_COMPARISON 0x00002000L
  1326. /* SQL_SQL92_RELATIONAL_JOIN_OPERATORS bitmasks */
  1327. #define SQL_SRJO_CORRESPONDING_CLAUSE 0x00000001L
  1328. #define SQL_SRJO_CROSS_JOIN 0x00000002L
  1329. #define SQL_SRJO_EXCEPT_JOIN 0x00000004L
  1330. #define SQL_SRJO_FULL_OUTER_JOIN 0x00000008L
  1331. #define SQL_SRJO_INNER_JOIN 0x00000010L
  1332. #define SQL_SRJO_INTERSECT_JOIN 0x00000020L
  1333. #define SQL_SRJO_LEFT_OUTER_JOIN 0x00000040L
  1334. #define SQL_SRJO_NATURAL_JOIN 0x00000080L
  1335. #define SQL_SRJO_RIGHT_OUTER_JOIN 0x00000100L
  1336. #define SQL_SRJO_UNION_JOIN 0x00000200L
  1337. /* SQL_SQL92_REVOKE bitmasks */
  1338. #define SQL_SR_USAGE_ON_DOMAIN 0x00000001L
  1339. #define SQL_SR_USAGE_ON_CHARACTER_SET 0x00000002L
  1340. #define SQL_SR_USAGE_ON_COLLATION 0x00000004L
  1341. #define SQL_SR_USAGE_ON_TRANSLATION 0x00000008L
  1342. #define SQL_SR_GRANT_OPTION_FOR 0x00000010L
  1343. #define SQL_SR_CASCADE 0x00000020L
  1344. #define SQL_SR_RESTRICT 0x00000040L
  1345. #define SQL_SR_DELETE_TABLE 0x00000080L
  1346. #define SQL_SR_INSERT_TABLE 0x00000100L
  1347. #define SQL_SR_INSERT_COLUMN 0x00000200L
  1348. #define SQL_SR_REFERENCES_TABLE 0x00000400L
  1349. #define SQL_SR_REFERENCES_COLUMN 0x00000800L
  1350. #define SQL_SR_SELECT_TABLE 0x00001000L
  1351. #define SQL_SR_UPDATE_TABLE 0x00002000L
  1352. #define SQL_SR_UPDATE_COLUMN 0x00004000L
  1353. /* SQL_SQL92_ROW_VALUE_CONSTRUCTOR bitmasks */
  1354. #define SQL_SRVC_VALUE_EXPRESSION 0x00000001L
  1355. #define SQL_SRVC_NULL 0x00000002L
  1356. #define SQL_SRVC_DEFAULT 0x00000004L
  1357. #define SQL_SRVC_ROW_SUBQUERY 0x00000008L
  1358. /* SQL_SQL92_VALUE_EXPRESSIONS bitmasks */
  1359. #define SQL_SVE_CASE 0x00000001L
  1360. #define SQL_SVE_CAST 0x00000002L
  1361. #define SQL_SVE_COALESCE 0x00000004L
  1362. #define SQL_SVE_NULLIF 0x00000008L
  1363. /* SQL_STANDARD_CLI_CONFORMANCE bitmasks */
  1364. #define SQL_SCC_XOPEN_CLI_VERSION1 0x00000001L
  1365. #define SQL_SCC_ISO92_CLI 0x00000002L
  1366. /* SQL_UNION_STATEMENT bitmasks */
  1367. #define SQL_US_UNION SQL_U_UNION
  1368. #define SQL_US_UNION_ALL SQL_U_UNION_ALL
  1369. #endif /* ODBCVER >= 0x0300 */
  1370. /* SQL_DTC_TRANSITION_COST bitmasks */
  1371. #define SQL_DTC_ENLIST_EXPENSIVE 0x00000001L
  1372. #define SQL_DTC_UNENLIST_EXPENSIVE 0x00000002L
  1373. /* additional SQLDataSources fetch directions */
  1374. #if (ODBCVER >= 0x0300)
  1375. #define SQL_FETCH_FIRST_USER 31
  1376. #define SQL_FETCH_FIRST_SYSTEM 32
  1377. #endif /* ODBCVER >= 0x0300 */
  1378. /* Defines for SQLSetPos */
  1379. #define SQL_ENTIRE_ROWSET 0
  1380. /* Operations in SQLSetPos */
  1381. #define SQL_POSITION 0 /* 1.0 FALSE */
  1382. #define SQL_REFRESH 1 /* 1.0 TRUE */
  1383. #define SQL_UPDATE 2
  1384. #define SQL_DELETE 3
  1385. /* Operations in SQLBulkOperations */
  1386. #define SQL_ADD 4
  1387. #define SQL_SETPOS_MAX_OPTION_VALUE SQL_ADD
  1388. #if (ODBCVER >= 0x0300)
  1389. #define SQL_UPDATE_BY_BOOKMARK 5
  1390. #define SQL_DELETE_BY_BOOKMARK 6
  1391. #define SQL_FETCH_BY_BOOKMARK 7
  1392. #endif /* ODBCVER >= 0x0300 */
  1393. /* Lock options in SQLSetPos */
  1394. #define SQL_LOCK_NO_CHANGE 0 /* 1.0 FALSE */
  1395. #define SQL_LOCK_EXCLUSIVE 1 /* 1.0 TRUE */
  1396. #define SQL_LOCK_UNLOCK 2
  1397. #define SQL_SETPOS_MAX_LOCK_VALUE SQL_LOCK_UNLOCK
  1398. /* Macros for SQLSetPos */
  1399. #define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
  1400. #define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
  1401. #define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
  1402. #define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
  1403. #define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
  1404. #define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
  1405. /* Column types and scopes in SQLSpecialColumns. */
  1406. #define SQL_BEST_ROWID 1
  1407. #define SQL_ROWVER 2
  1408. /* Defines for SQLSpecialColumns (returned in the result set)
  1409. SQL_PC_UNKNOWN and SQL_PC_PSEUDO are defined in sql.h */
  1410. #define SQL_PC_NOT_PSEUDO 1
  1411. /* Defines for SQLStatistics */
  1412. #define SQL_QUICK 0
  1413. #define SQL_ENSURE 1
  1414. /* Defines for SQLStatistics (returned in the result set)
  1415. SQL_INDEX_CLUSTERED, SQL_INDEX_HASHED, and SQL_INDEX_OTHER are
  1416. defined in sql.h */
  1417. #define SQL_TABLE_STAT 0
  1418. /* Defines for SQLTables */
  1419. #if (ODBCVER >= 0x0300)
  1420. #define SQL_ALL_CATALOGS "%"
  1421. #define SQL_ALL_SCHEMAS "%"
  1422. #define SQL_ALL_TABLE_TYPES "%"
  1423. #endif /* ODBCVER >= 0x0300 */
  1424. /* Options for SQLDriverConnect */
  1425. #define SQL_DRIVER_NOPROMPT 0
  1426. #define SQL_DRIVER_COMPLETE 1
  1427. #define SQL_DRIVER_PROMPT 2
  1428. #define SQL_DRIVER_COMPLETE_REQUIRED 3
  1429. #ifndef RC_INVOKED
  1430. SQLRETURN SQL_API SQLDriverConnect(
  1431. SQLHDBC hdbc,
  1432. SQLHWND hwnd,
  1433. SQLCHAR *szConnStrIn,
  1434. SQLSMALLINT cbConnStrIn,
  1435. SQLCHAR *szConnStrOut,
  1436. SQLSMALLINT cbConnStrOutMax,
  1437. SQLSMALLINT *pcbConnStrOut,
  1438. SQLUSMALLINT fDriverCompletion);
  1439. #endif /* RC_INVOKED */
  1440. /* Level 2 Functions */
  1441. /* SQLExtendedFetch "fFetchType" values */
  1442. #define SQL_FETCH_BOOKMARK 8
  1443. /* SQLExtendedFetch "rgfRowStatus" element values */
  1444. #define SQL_ROW_SUCCESS 0
  1445. #define SQL_ROW_DELETED 1
  1446. #define SQL_ROW_UPDATED 2
  1447. #define SQL_ROW_NOROW 3
  1448. #define SQL_ROW_ADDED 4
  1449. #define SQL_ROW_ERROR 5
  1450. #if (ODBCVER >= 0x0300)
  1451. #define SQL_ROW_SUCCESS_WITH_INFO 6
  1452. #define SQL_ROW_PROCEED 0
  1453. #define SQL_ROW_IGNORE 1
  1454. #endif
  1455. /* value for SQL_DESC_ARRAY_STATUS_PTR */
  1456. #if (ODBCVER >= 0x0300)
  1457. #define SQL_PARAM_SUCCESS 0
  1458. #define SQL_PARAM_SUCCESS_WITH_INFO 6
  1459. #define SQL_PARAM_ERROR 5
  1460. #define SQL_PARAM_UNUSED 7
  1461. #define SQL_PARAM_DIAG_UNAVAILABLE 1
  1462. #define SQL_PARAM_PROCEED 0
  1463. #define SQL_PARAM_IGNORE 1
  1464. #endif /* ODBCVER >= 0x0300 */
  1465. /* Defines for SQLForeignKeys (UPDATE_RULE and DELETE_RULE) */
  1466. #define SQL_CASCADE 0
  1467. #define SQL_RESTRICT 1
  1468. #define SQL_SET_NULL 2
  1469. #if (ODBCVER >= 0x0250)
  1470. #define SQL_NO_ACTION 3
  1471. #define SQL_SET_DEFAULT 4
  1472. #endif /* ODBCVER >= 0x0250 */
  1473. #if (ODBCVER >= 0x0300)
  1474. /* Note that the following are in a different column of SQLForeignKeys than */
  1475. /* the previous #defines. These are for DEFERRABILITY. */
  1476. #define SQL_INITIALLY_DEFERRED 5
  1477. #define SQL_INITIALLY_IMMEDIATE 6
  1478. #define SQL_NOT_DEFERRABLE 7
  1479. #endif /* ODBCVER >= 0x0300 */
  1480. /* Defines for SQLBindParameter and
  1481. SQLProcedureColumns (returned in the result set) */
  1482. #define SQL_PARAM_TYPE_UNKNOWN 0
  1483. #define SQL_PARAM_INPUT 1
  1484. #define SQL_PARAM_INPUT_OUTPUT 2
  1485. #define SQL_RESULT_COL 3
  1486. #define SQL_PARAM_OUTPUT 4
  1487. #define SQL_RETURN_VALUE 5
  1488. /* Defines for SQLProcedures (returned in the result set) */
  1489. #define SQL_PT_UNKNOWN 0
  1490. #define SQL_PT_PROCEDURE 1
  1491. #define SQL_PT_FUNCTION 2
  1492. #ifndef RC_INVOKED
  1493. /* This define is too large for RC */
  1494. #define SQL_ODBC_KEYWORDS \
  1495. "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
  1496. "ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\
  1497. "BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\
  1498. "CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\
  1499. "COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\
  1500. "CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\
  1501. "CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\
  1502. "DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\
  1503. "DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\
  1504. "DISTINCT,DOMAIN,DOUBLE,DROP,"\
  1505. "ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\
  1506. "EXISTS,EXTERNAL,EXTRACT,"\
  1507. "FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\
  1508. "GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\
  1509. "IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\
  1510. "INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\
  1511. "JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\
  1512. "MATCH,MAX,MIN,MINUTE,MODULE,MONTH,"\
  1513. "NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\
  1514. "OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\
  1515. "PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\
  1516. "PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\
  1517. "READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS"\
  1518. "SCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,"\
  1519. "SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\
  1520. "SUBSTRING,SUM,SYSTEM_USER,"\
  1521. "TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\
  1522. "TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\
  1523. "UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\
  1524. "VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,"\
  1525. "YEAR,ZONE"
  1526. SQLRETURN SQL_API SQLBrowseConnect(
  1527. SQLHDBC hdbc,
  1528. SQLCHAR *szConnStrIn,
  1529. SQLSMALLINT cbConnStrIn,
  1530. SQLCHAR *szConnStrOut,
  1531. SQLSMALLINT cbConnStrOutMax,
  1532. SQLSMALLINT *pcbConnStrOut);
  1533. #if (ODBCVER >= 0x0300)
  1534. SQLRETURN SQL_API SQLBulkOperations(
  1535. SQLHSTMT StatementHandle,
  1536. SQLSMALLINT Operation);
  1537. #endif /* ODBCVER >= 0x0300 */
  1538. SQLRETURN SQL_API SQLColAttributes(
  1539. SQLHSTMT hstmt,
  1540. SQLUSMALLINT icol,
  1541. SQLUSMALLINT fDescType,
  1542. SQLPOINTER rgbDesc,
  1543. SQLSMALLINT cbDescMax,
  1544. SQLSMALLINT *pcbDesc,
  1545. SQLLEN * pfDesc);
  1546. SQLRETURN SQL_API SQLColumnPrivileges(
  1547. SQLHSTMT hstmt,
  1548. SQLCHAR *szCatalogName,
  1549. SQLSMALLINT cbCatalogName,
  1550. SQLCHAR *szSchemaName,
  1551. SQLSMALLINT cbSchemaName,
  1552. SQLCHAR *szTableName,
  1553. SQLSMALLINT cbTableName,
  1554. SQLCHAR *szColumnName,
  1555. SQLSMALLINT cbColumnName);
  1556. SQLRETURN SQL_API SQLDescribeParam(
  1557. SQLHSTMT hstmt,
  1558. SQLUSMALLINT ipar,
  1559. SQLSMALLINT *pfSqlType,
  1560. SQLULEN *pcbParamDef,
  1561. SQLSMALLINT *pibScale,
  1562. SQLSMALLINT *pfNullable);
  1563. SQLRETURN SQL_API SQLExtendedFetch(
  1564. SQLHSTMT hstmt,
  1565. SQLUSMALLINT fFetchType,
  1566. SQLLEN irow,
  1567. SQLULEN *pcrow,
  1568. SQLUSMALLINT *rgfRowStatus);
  1569. SQLRETURN SQL_API SQLForeignKeys(
  1570. SQLHSTMT hstmt,
  1571. SQLCHAR *szPkCatalogName,
  1572. SQLSMALLINT cbPkCatalogName,
  1573. SQLCHAR *szPkSchemaName,
  1574. SQLSMALLINT cbPkSchemaName,
  1575. SQLCHAR *szPkTableName,
  1576. SQLSMALLINT cbPkTableName,
  1577. SQLCHAR *szFkCatalogName,
  1578. SQLSMALLINT cbFkCatalogName,
  1579. SQLCHAR *szFkSchemaName,
  1580. SQLSMALLINT cbFkSchemaName,
  1581. SQLCHAR *szFkTableName,
  1582. SQLSMALLINT cbFkTableName);
  1583. SQLRETURN SQL_API SQLMoreResults(
  1584. SQLHSTMT hstmt);
  1585. SQLRETURN SQL_API SQLNativeSql(
  1586. SQLHDBC hdbc,
  1587. SQLCHAR *szSqlStrIn,
  1588. SQLINTEGER cbSqlStrIn,
  1589. SQLCHAR *szSqlStr,
  1590. SQLINTEGER cbSqlStrMax,
  1591. SQLINTEGER *pcbSqlStr);
  1592. SQLRETURN SQL_API SQLNumParams(
  1593. SQLHSTMT hstmt,
  1594. SQLSMALLINT *pcpar);
  1595. SQLRETURN SQL_API SQLParamOptions(
  1596. SQLHSTMT hstmt,
  1597. SQLULEN crow,
  1598. SQLULEN *pirow);
  1599. SQLRETURN SQL_API SQLPrimaryKeys(
  1600. SQLHSTMT hstmt,
  1601. SQLCHAR *szCatalogName,
  1602. SQLSMALLINT cbCatalogName,
  1603. SQLCHAR *szSchemaName,
  1604. SQLSMALLINT cbSchemaName,
  1605. SQLCHAR *szTableName,
  1606. SQLSMALLINT cbTableName);
  1607. SQLRETURN SQL_API SQLProcedureColumns(
  1608. SQLHSTMT hstmt,
  1609. SQLCHAR *szCatalogName,
  1610. SQLSMALLINT cbCatalogName,
  1611. SQLCHAR *szSchemaName,
  1612. SQLSMALLINT cbSchemaName,
  1613. SQLCHAR *szProcName,
  1614. SQLSMALLINT cbProcName,
  1615. SQLCHAR *szColumnName,
  1616. SQLSMALLINT cbColumnName);
  1617. SQLRETURN SQL_API SQLProcedures(
  1618. SQLHSTMT hstmt,
  1619. SQLCHAR *szCatalogName,
  1620. SQLSMALLINT cbCatalogName,
  1621. SQLCHAR *szSchemaName,
  1622. SQLSMALLINT cbSchemaName,
  1623. SQLCHAR *szProcName,
  1624. SQLSMALLINT cbProcName);
  1625. SQLRETURN SQL_API SQLSetPos(
  1626. SQLHSTMT hstmt,
  1627. SQLSETPOSIROW irow,
  1628. SQLUSMALLINT fOption,
  1629. SQLUSMALLINT fLock);
  1630. SQLRETURN SQL_API SQLTablePrivileges(
  1631. SQLHSTMT hstmt,
  1632. SQLCHAR *szCatalogName,
  1633. SQLSMALLINT cbCatalogName,
  1634. SQLCHAR *szSchemaName,
  1635. SQLSMALLINT cbSchemaName,
  1636. SQLCHAR *szTableName,
  1637. SQLSMALLINT cbTableName);
  1638. SQLRETURN SQL_API SQLDrivers(
  1639. SQLHENV henv,
  1640. SQLUSMALLINT fDirection,
  1641. SQLCHAR *szDriverDesc,
  1642. SQLSMALLINT cbDriverDescMax,
  1643. SQLSMALLINT *pcbDriverDesc,
  1644. SQLCHAR *szDriverAttributes,
  1645. SQLSMALLINT cbDrvrAttrMax,
  1646. SQLSMALLINT *pcbDrvrAttr);
  1647. SQLRETURN SQL_API SQLBindParameter(
  1648. SQLHSTMT hstmt,
  1649. SQLUSMALLINT ipar,
  1650. SQLSMALLINT fParamType,
  1651. SQLSMALLINT fCType,
  1652. SQLSMALLINT fSqlType,
  1653. SQLULEN cbColDef,
  1654. SQLSMALLINT ibScale,
  1655. SQLPOINTER rgbValue,
  1656. SQLLEN cbValueMax,
  1657. SQLLEN *pcbValue);
  1658. #endif /* RC_INVOKED */
  1659. /*---------------------------------------------------------*/
  1660. /* SQLAllocHandleStd is implemented to make SQLAllocHandle */
  1661. /* compatible with X/Open standard. an application should */
  1662. /* not call SQLAllocHandleStd directly */
  1663. /*---------------------------------------------------------*/
  1664. #ifdef ODBC_STD
  1665. #define SQLAllocHandle SQLAllocHandleStd
  1666. #define SQLAllocEnv(phenv) SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv)
  1667. /* Internal type subcodes */
  1668. #define SQL_YEAR SQL_CODE_YEAR
  1669. #define SQL_MONTH SQL_CODE_MONTH
  1670. #define SQL_DAY SQL_CODE_DAY
  1671. #define SQL_HOUR SQL_CODE_HOUR
  1672. #define SQL_MINUTE SQL_CODE_MINUTE
  1673. #define SQL_SECOND SQL_CODE_SECOND
  1674. #define SQL_YEAR_TO_MONTH SQL_CODE_YEAR_TO_MONTH
  1675. #define SQL_DAY_TO_HOUR SQL_CODE_DAY_TO_HOUR
  1676. #define SQL_DAY_TO_MINUTE SQL_CODE_DAY_TO_MINUTE
  1677. #define SQL_DAY_TO_SECOND SQL_CODE_DAY_TO_SECOND
  1678. #define SQL_HOUR_TO_MINUTE SQL_CODE_HOUR_TO_MINUTE
  1679. #define SQL_HOUR_TO_SECOND SQL_CODE_HOUR_TO_SECOND
  1680. #define SQL_MINUTE_TO_SECOND SQL_CODE_MINUTE_TO_SECOND
  1681. #endif /* ODBC_STD */
  1682. #if (ODBCVER >= 0x0300)
  1683. #ifndef RC_INVOKED
  1684. SQLRETURN SQL_API SQLAllocHandleStd(
  1685. SQLSMALLINT fHandleType,
  1686. SQLHANDLE hInput,
  1687. SQLHANDLE *phOutput);
  1688. #endif /* RC_INVOKED */
  1689. #endif
  1690. /* Deprecated defines from prior versions of ODBC */
  1691. #define SQL_DATABASE_NAME 16 /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */
  1692. #define SQL_FD_FETCH_PREV SQL_FD_FETCH_PRIOR
  1693. #define SQL_FETCH_PREV SQL_FETCH_PRIOR
  1694. #define SQL_CONCUR_TIMESTAMP SQL_CONCUR_ROWVER
  1695. #define SQL_SCCO_OPT_TIMESTAMP SQL_SCCO_OPT_ROWVER
  1696. #define SQL_CC_DELETE SQL_CB_DELETE
  1697. #define SQL_CR_DELETE SQL_CB_DELETE
  1698. #define SQL_CC_CLOSE SQL_CB_CLOSE
  1699. #define SQL_CR_CLOSE SQL_CB_CLOSE
  1700. #define SQL_CC_PRESERVE SQL_CB_PRESERVE
  1701. #define SQL_CR_PRESERVE SQL_CB_PRESERVE
  1702. /* SQL_FETCH_RESUME is not supported by 2.0+ drivers
  1703. #define SQL_FETCH_RESUME 7
  1704. */
  1705. #define SQL_SCROLL_FORWARD_ONLY 0L /*-SQL_CURSOR_FORWARD_ONLY */
  1706. #define SQL_SCROLL_KEYSET_DRIVEN (-1L) /*-SQL_CURSOR_KEYSET_DRIVEN */
  1707. #define SQL_SCROLL_DYNAMIC (-2L) /*-SQL_CURSOR_DYNAMIC */
  1708. #define SQL_SCROLL_STATIC (-3L) /*-SQL_CURSOR_STATIC */
  1709. /* Deprecated functions from prior versions of ODBC */
  1710. #ifndef RC_INVOKED
  1711. SQLRETURN SQL_API SQLSetScrollOptions( /* Use SQLSetStmtOptions */
  1712. SQLHSTMT hstmt,
  1713. SQLUSMALLINT fConcurrency,
  1714. SQLLEN crowKeyset,
  1715. SQLUSMALLINT crowRowset);
  1716. /* Tracing section */
  1717. #define TRACE_VERSION 1000 /* Version of trace API */
  1718. RETCODE SQL_API TraceOpenLogFile(LPWSTR,LPWSTR,DWORD);// open a trace log file
  1719. RETCODE SQL_API TraceCloseLogFile(); // Request to close a trace log
  1720. VOID SQL_API TraceReturn(RETCODE,RETCODE); // Processes trace after FN is called
  1721. DWORD SQL_API TraceVersion(); // Returns trace API version
  1722. /* Functions for Visual Studio Analyzer*/
  1723. /* to turn on/off tracing or VS events, call TraceVSControl by setting or clearing the following bits */
  1724. #define TRACE_ON 0x00000001L
  1725. #define TRACE_VS_EVENT_ON 0x00000002L
  1726. RETCODE SQL_API TraceVSControl(DWORD);
  1727. /* Functions for setting the connection pooling failure detection code */
  1728. /* The "TryWait" value is the time (in seconds) that the DM will wait */
  1729. /* between detecting that a connection is dead (using */
  1730. /* SQL_ATTR_CONNECTION_DEAD) and retrying the connection. During that */
  1731. /* interval, connection requests will get "The server appears to be */
  1732. /* dead" error returns. */
  1733. BOOL SQL_API ODBCSetTryWaitValue(DWORD dwValue); /* In seconds */
  1734. DWORD SQL_API ODBCGetTryWaitValue(); /* In Milliseconds(!) */
  1735. /* the flags in ODBC_VS_ARGS */
  1736. #define ODBC_VS_FLAG_UNICODE_ARG 0x00000001L /* the argument is unicode */
  1737. #define ODBC_VS_FLAG_UNICODE_COR 0x00000002L /* the correlation is unicode */
  1738. #define ODBC_VS_FLAG_RETCODE 0x00000004L /* RetCode field is set */
  1739. #define ODBC_VS_FLAG_STOP 0x00000008L /* Stop firing visual studio analyzer events */
  1740. typedef struct tagODBC_VS_ARGS {
  1741. const GUID *pguidEvent; /* the GUID for event */
  1742. DWORD dwFlags; /* flags for the call */
  1743. union {
  1744. WCHAR *wszArg;
  1745. CHAR *szArg;
  1746. };
  1747. union {
  1748. WCHAR *wszCorrelation;
  1749. CHAR *szCorrelation;
  1750. };
  1751. RETCODE RetCode;
  1752. } ODBC_VS_ARGS, *PODBC_VS_ARGS;
  1753. VOID SQL_API FireVSDebugEvent(PODBC_VS_ARGS);
  1754. #endif /* RC_INVOKED */
  1755. #ifdef __cplusplus
  1756. } /* End of extern "C" { */
  1757. #endif /* __cplusplus */
  1758. #if defined(WIN32) || defined(_WIN64)
  1759. #include "sqlucode.h"
  1760. #endif
  1761. #endif /* __SQLEXT */