sql.h 29 KB

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