odbcsql.nim 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2015 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. {.deadCodeElim: on.} # dce option deprecated
  10. when not defined(ODBCVER):
  11. const
  12. ODBCVER = 0x0351 ## define ODBC version 3.51 by default
  13. when defined(windows):
  14. {.push callconv: stdcall.}
  15. const odbclib = "odbc32.dll"
  16. else:
  17. {.push callconv: cdecl.}
  18. const odbclib = "libodbc.so"
  19. when defined(nimHasStyleChecks):
  20. {.push styleChecks: off.}
  21. # DATA TYPES CORRESPONDENCE
  22. # BDE fields ODBC types
  23. # ---------- ------------------
  24. # ftBlob SQL_BINARY
  25. # ftBoolean SQL_BIT
  26. # ftDate SQL_TYPE_DATE
  27. # ftTime SQL_TYPE_TIME
  28. # ftDateTime SQL_TYPE_TIMESTAMP
  29. # ftInteger SQL_INTEGER
  30. # ftSmallint SQL_SMALLINT
  31. # ftFloat SQL_DOUBLE
  32. # ftString SQL_CHAR
  33. # ftMemo SQL_BINARY // SQL_VARCHAR
  34. #
  35. type
  36. TSqlChar* = char
  37. TSqlSmallInt* = int16
  38. SqlUSmallInt* = int16
  39. SqlHandle* = pointer
  40. SqlHEnv* = SqlHandle
  41. SqlHDBC* = SqlHandle
  42. SqlHStmt* = SqlHandle
  43. SqlHDesc* = SqlHandle
  44. TSqlInteger* = int
  45. SqlUInteger* = int
  46. SqlPointer* = pointer
  47. TSqlReal* = cfloat
  48. TSqlDouble* = cdouble
  49. TSqlFloat* = cdouble
  50. SqlHWND* = pointer
  51. PSQLCHAR* = cstring
  52. PSQLINTEGER* = ptr TSqlInteger
  53. PSQLUINTEGER* = ptr SqlUInteger
  54. PSQLSMALLINT* = ptr TSqlSmallInt
  55. PSQLUSMALLINT* = ptr SqlUSmallInt
  56. PSQLREAL* = ptr TSqlReal
  57. PSQLDOUBLE* = ptr TSqlDouble
  58. PSQLFLOAT* = ptr TSqlFloat
  59. PSQLHANDLE* = ptr SqlHandle
  60. const # SQL data type codes
  61. SQL_UNKNOWN_TYPE* = 0
  62. SQL_LONGVARCHAR* = (- 1)
  63. SQL_BINARY* = (- 2)
  64. SQL_VARBINARY* = (- 3)
  65. SQL_LONGVARBINARY* = (- 4)
  66. SQL_BIGINT* = (- 5)
  67. SQL_TINYINT* = (- 6)
  68. SQL_BIT* = (- 7)
  69. SQL_WCHAR* = (- 8)
  70. SQL_WVARCHAR* = (- 9)
  71. SQL_WLONGVARCHAR* = (- 10)
  72. SQL_CHAR* = 1
  73. SQL_NUMERIC* = 2
  74. SQL_DECIMAL* = 3
  75. SQL_INTEGER* = 4
  76. SQL_SMALLINT* = 5
  77. SQL_FLOAT* = 6
  78. SQL_REAL* = 7
  79. SQL_DOUBLE* = 8
  80. SQL_DATETIME* = 9
  81. SQL_VARCHAR* = 12
  82. SQL_TYPE_DATE* = 91
  83. SQL_TYPE_TIME* = 92
  84. SQL_TYPE_TIMESTAMP* = 93
  85. SQL_DATE* = 9
  86. SQL_TIME* = 10
  87. SQL_TIMESTAMP* = 11
  88. SQL_INTERVAL* = 10
  89. SQL_GUID* = - 11 # interval codes
  90. when ODBCVER >= 0x0300:
  91. const
  92. SQL_CODE_YEAR* = 1
  93. SQL_CODE_MONTH* = 2
  94. SQL_CODE_DAY* = 3
  95. SQL_CODE_HOUR* = 4
  96. SQL_CODE_MINUTE* = 5
  97. SQL_CODE_SECOND* = 6
  98. SQL_CODE_YEAR_TO_MONTH* = 7
  99. SQL_CODE_DAY_TO_HOUR* = 8
  100. SQL_CODE_DAY_TO_MINUTE* = 9
  101. SQL_CODE_DAY_TO_SECOND* = 10
  102. SQL_CODE_HOUR_TO_MINUTE* = 11
  103. SQL_CODE_HOUR_TO_SECOND* = 12
  104. SQL_CODE_MINUTE_TO_SECOND* = 13
  105. SQL_INTERVAL_YEAR* = 100 + SQL_CODE_YEAR
  106. SQL_INTERVAL_MONTH* = 100 + SQL_CODE_MONTH
  107. SQL_INTERVAL_DAY* = 100 + SQL_CODE_DAY
  108. SQL_INTERVAL_HOUR* = 100 + SQL_CODE_HOUR
  109. SQL_INTERVAL_MINUTE* = 100 + SQL_CODE_MINUTE
  110. SQL_INTERVAL_SECOND* = 100 + SQL_CODE_SECOND
  111. SQL_INTERVAL_YEAR_TO_MONTH* = 100 + SQL_CODE_YEAR_TO_MONTH
  112. SQL_INTERVAL_DAY_TO_HOUR* = 100 + SQL_CODE_DAY_TO_HOUR
  113. SQL_INTERVAL_DAY_TO_MINUTE* = 100 + SQL_CODE_DAY_TO_MINUTE
  114. SQL_INTERVAL_DAY_TO_SECOND* = 100 + SQL_CODE_DAY_TO_SECOND
  115. SQL_INTERVAL_HOUR_TO_MINUTE* = 100 + SQL_CODE_HOUR_TO_MINUTE
  116. SQL_INTERVAL_HOUR_TO_SECOND* = 100 + SQL_CODE_HOUR_TO_SECOND
  117. SQL_INTERVAL_MINUTE_TO_SECOND* = 100 + SQL_CODE_MINUTE_TO_SECOND
  118. else:
  119. const
  120. SQL_INTERVAL_YEAR* = - 80
  121. SQL_INTERVAL_MONTH* = - 81
  122. SQL_INTERVAL_YEAR_TO_MONTH* = - 82
  123. SQL_INTERVAL_DAY* = - 83
  124. SQL_INTERVAL_HOUR* = - 84
  125. SQL_INTERVAL_MINUTE* = - 85
  126. SQL_INTERVAL_SECOND* = - 86
  127. SQL_INTERVAL_DAY_TO_HOUR* = - 87
  128. SQL_INTERVAL_DAY_TO_MINUTE* = - 88
  129. SQL_INTERVAL_DAY_TO_SECOND* = - 89
  130. SQL_INTERVAL_HOUR_TO_MINUTE* = - 90
  131. SQL_INTERVAL_HOUR_TO_SECOND* = - 91
  132. SQL_INTERVAL_MINUTE_TO_SECOND* = - 92
  133. when ODBCVER < 0x0300:
  134. const
  135. SQL_UNICODE* = - 95
  136. SQL_UNICODE_VARCHAR* = - 96
  137. SQL_UNICODE_LONGVARCHAR* = - 97
  138. SQL_UNICODE_CHAR* = SQL_UNICODE
  139. else:
  140. # The previous definitions for SQL_UNICODE_ are historical and obsolete
  141. const
  142. SQL_UNICODE* = SQL_WCHAR
  143. SQL_UNICODE_VARCHAR* = SQL_WVARCHAR
  144. SQL_UNICODE_LONGVARCHAR* = SQL_WLONGVARCHAR
  145. SQL_UNICODE_CHAR* = SQL_WCHAR
  146. const # C datatype to SQL datatype mapping
  147. SQL_C_CHAR* = SQL_CHAR
  148. SQL_C_LONG* = SQL_INTEGER
  149. SQL_C_SHORT* = SQL_SMALLINT
  150. SQL_C_FLOAT* = SQL_REAL
  151. SQL_C_DOUBLE* = SQL_DOUBLE
  152. SQL_C_NUMERIC* = SQL_NUMERIC
  153. SQL_C_DEFAULT* = 99
  154. SQL_SIGNED_OFFSET* = - 20
  155. SQL_UNSIGNED_OFFSET* = - 22
  156. SQL_C_DATE* = SQL_DATE
  157. SQL_C_TIME* = SQL_TIME
  158. SQL_C_TIMESTAMP* = SQL_TIMESTAMP
  159. SQL_C_TYPE_DATE* = SQL_TYPE_DATE
  160. SQL_C_TYPE_TIME* = SQL_TYPE_TIME
  161. SQL_C_TYPE_TIMESTAMP* = SQL_TYPE_TIMESTAMP
  162. SQL_C_INTERVAL_YEAR* = SQL_INTERVAL_YEAR
  163. SQL_C_INTERVAL_MONTH* = SQL_INTERVAL_MONTH
  164. SQL_C_INTERVAL_DAY* = SQL_INTERVAL_DAY
  165. SQL_C_INTERVAL_HOUR* = SQL_INTERVAL_HOUR
  166. SQL_C_INTERVAL_MINUTE* = SQL_INTERVAL_MINUTE
  167. SQL_C_INTERVAL_SECOND* = SQL_INTERVAL_SECOND
  168. SQL_C_INTERVAL_YEAR_TO_MONTH* = SQL_INTERVAL_YEAR_TO_MONTH
  169. SQL_C_INTERVAL_DAY_TO_HOUR* = SQL_INTERVAL_DAY_TO_HOUR
  170. SQL_C_INTERVAL_DAY_TO_MINUTE* = SQL_INTERVAL_DAY_TO_MINUTE
  171. SQL_C_INTERVAL_DAY_TO_SECOND* = SQL_INTERVAL_DAY_TO_SECOND
  172. SQL_C_INTERVAL_HOUR_TO_MINUTE* = SQL_INTERVAL_HOUR_TO_MINUTE
  173. SQL_C_INTERVAL_HOUR_TO_SECOND* = SQL_INTERVAL_HOUR_TO_SECOND
  174. SQL_C_INTERVAL_MINUTE_TO_SECOND* = SQL_INTERVAL_MINUTE_TO_SECOND
  175. SQL_C_BINARY* = SQL_BINARY
  176. SQL_C_BIT* = SQL_BIT
  177. SQL_C_SBIGINT* = SQL_BIGINT + SQL_SIGNED_OFFSET # SIGNED BIGINT
  178. SQL_C_UBIGINT* = SQL_BIGINT + SQL_UNSIGNED_OFFSET # UNSIGNED BIGINT
  179. SQL_C_TINYINT* = SQL_TINYINT
  180. SQL_C_SLONG* = SQL_C_LONG + SQL_SIGNED_OFFSET # SIGNED INTEGER
  181. SQL_C_SSHORT* = SQL_C_SHORT + SQL_SIGNED_OFFSET # SIGNED SMALLINT
  182. SQL_C_STINYINT* = SQL_TINYINT + SQL_SIGNED_OFFSET # SIGNED TINYINT
  183. SQL_C_ULONG* = SQL_C_LONG + SQL_UNSIGNED_OFFSET # UNSIGNED INTEGER
  184. SQL_C_USHORT* = SQL_C_SHORT + SQL_UNSIGNED_OFFSET # UNSIGNED SMALLINT
  185. SQL_C_UTINYINT* = SQL_TINYINT + SQL_UNSIGNED_OFFSET # UNSIGNED TINYINT
  186. SQL_C_BOOKMARK* = SQL_C_ULONG # BOOKMARK
  187. SQL_C_GUID* = SQL_GUID
  188. SQL_TYPE_NULL* = 0
  189. when ODBCVER < 0x0300:
  190. const
  191. SQL_TYPE_MIN* = SQL_BIT
  192. SQL_TYPE_MAX* = SQL_VARCHAR
  193. const
  194. SQL_C_VARBOOKMARK* = SQL_C_BINARY
  195. SQL_API_SQLDESCRIBEPARAM* = 58
  196. SQL_NO_TOTAL* = - 4
  197. type
  198. SQL_DATE_STRUCT* {.final, pure.} = object
  199. Year*: TSqlSmallInt
  200. Month*: SqlUSmallInt
  201. Day*: SqlUSmallInt
  202. PSQL_DATE_STRUCT* = ptr SQL_DATE_STRUCT
  203. SQL_TIME_STRUCT* {.final, pure.} = object
  204. Hour*: SqlUSmallInt
  205. Minute*: SqlUSmallInt
  206. Second*: SqlUSmallInt
  207. PSQL_TIME_STRUCT* = ptr SQL_TIME_STRUCT
  208. SQL_TIMESTAMP_STRUCT* {.final, pure.} = object
  209. Year*: SqlUSmallInt
  210. Month*: SqlUSmallInt
  211. Day*: SqlUSmallInt
  212. Hour*: SqlUSmallInt
  213. Minute*: SqlUSmallInt
  214. Second*: SqlUSmallInt
  215. Fraction*: SqlUInteger
  216. PSQL_TIMESTAMP_STRUCT* = ptr SQL_TIMESTAMP_STRUCT
  217. const
  218. SQL_NAME_LEN* = 128
  219. SQL_OV_ODBC3* = 3
  220. SQL_OV_ODBC2* = 2
  221. SQL_ATTR_ODBC_VERSION* = 200 # Options for SQLDriverConnect
  222. SQL_DRIVER_NOPROMPT* = 0
  223. SQL_DRIVER_COMPLETE* = 1
  224. SQL_DRIVER_PROMPT* = 2
  225. SQL_DRIVER_COMPLETE_REQUIRED* = 3
  226. SQL_IS_POINTER* = (- 4) # whether an attribute is a pointer or not
  227. SQL_IS_UINTEGER* = (- 5)
  228. SQL_IS_INTEGER* = (- 6)
  229. SQL_IS_USMALLINT* = (- 7)
  230. SQL_IS_SMALLINT* = (- 8) # SQLExtendedFetch "fFetchType" values
  231. SQL_FETCH_BOOKMARK* = 8
  232. SQL_SCROLL_OPTIONS* = 44 # SQL_USE_BOOKMARKS options
  233. SQL_UB_OFF* = 0
  234. SQL_UB_ON* = 1
  235. SQL_UB_DEFAULT* = SQL_UB_OFF
  236. SQL_UB_FIXED* = SQL_UB_ON
  237. SQL_UB_VARIABLE* = 2 # SQL_SCROLL_OPTIONS masks
  238. SQL_SO_FORWARD_ONLY* = 0x00000001
  239. SQL_SO_KEYSET_DRIVEN* = 0x00000002
  240. SQL_SO_DYNAMIC* = 0x00000004
  241. SQL_SO_MIXED* = 0x00000008
  242. SQL_SO_STATIC* = 0x00000010
  243. SQL_BOOKMARK_PERSISTENCE* = 82
  244. SQL_STATIC_SENSITIVITY* = 83 # SQL_BOOKMARK_PERSISTENCE values
  245. SQL_BP_CLOSE* = 0x00000001
  246. SQL_BP_DELETE* = 0x00000002
  247. SQL_BP_DROP* = 0x00000004
  248. SQL_BP_TRANSACTION* = 0x00000008
  249. SQL_BP_UPDATE* = 0x00000010
  250. SQL_BP_OTHER_HSTMT* = 0x00000020
  251. SQL_BP_SCROLL* = 0x00000040
  252. SQL_DYNAMIC_CURSOR_ATTRIBUTES1* = 144
  253. SQL_DYNAMIC_CURSOR_ATTRIBUTES2* = 145
  254. SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1* = 146
  255. SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2* = 147
  256. SQL_INDEX_KEYWORDS* = 148
  257. SQL_INFO_SCHEMA_VIEWS* = 149
  258. SQL_KEYSET_CURSOR_ATTRIBUTES1* = 150
  259. SQL_KEYSET_CURSOR_ATTRIBUTES2* = 151
  260. SQL_STATIC_CURSOR_ATTRIBUTES1* = 167
  261. SQL_STATIC_CURSOR_ATTRIBUTES2* = 168 # supported SQLFetchScroll FetchOrientation's
  262. SQL_CA1_NEXT* = 1
  263. SQL_CA1_ABSOLUTE* = 2
  264. SQL_CA1_RELATIVE* = 4
  265. SQL_CA1_BOOKMARK* = 8 # supported SQLSetPos LockType's
  266. SQL_CA1_LOCK_NO_CHANGE* = 0x00000040
  267. SQL_CA1_LOCK_EXCLUSIVE* = 0x00000080
  268. SQL_CA1_LOCK_UNLOCK* = 0x00000100 # supported SQLSetPos Operations
  269. SQL_CA1_POS_POSITION* = 0x00000200
  270. SQL_CA1_POS_UPDATE* = 0x00000400
  271. SQL_CA1_POS_DELETE* = 0x00000800
  272. SQL_CA1_POS_REFRESH* = 0x00001000 # positioned updates and deletes
  273. SQL_CA1_POSITIONED_UPDATE* = 0x00002000
  274. SQL_CA1_POSITIONED_DELETE* = 0x00004000
  275. SQL_CA1_SELECT_FOR_UPDATE* = 0x00008000 # supported SQLBulkOperations operations
  276. SQL_CA1_BULK_ADD* = 0x00010000
  277. SQL_CA1_BULK_UPDATE_BY_BOOKMARK* = 0x00020000
  278. SQL_CA1_BULK_DELETE_BY_BOOKMARK* = 0x00040000
  279. SQL_CA1_BULK_FETCH_BY_BOOKMARK* = 0x00080000 # supported values for SQL_ATTR_SCROLL_CONCURRENCY
  280. SQL_CA2_READ_ONLY_CONCURRENCY* = 1
  281. SQL_CA2_LOCK_CONCURRENCY* = 2
  282. SQL_CA2_OPT_ROWVER_CONCURRENCY* = 4
  283. SQL_CA2_OPT_VALUES_CONCURRENCY* = 8 # sensitivity of the cursor to its own inserts, deletes, and updates
  284. SQL_CA2_SENSITIVITY_ADDITIONS* = 0x00000010
  285. SQL_CA2_SENSITIVITY_DELETIONS* = 0x00000020
  286. SQL_CA2_SENSITIVITY_UPDATES* = 0x00000040 # semantics of SQL_ATTR_MAX_ROWS
  287. SQL_CA2_MAX_ROWS_SELECT* = 0x00000080
  288. SQL_CA2_MAX_ROWS_INSERT* = 0x00000100
  289. SQL_CA2_MAX_ROWS_DELETE* = 0x00000200
  290. SQL_CA2_MAX_ROWS_UPDATE* = 0x00000400
  291. SQL_CA2_MAX_ROWS_CATALOG* = 0x00000800
  292. SQL_CA2_MAX_ROWS_AFFECTS_ALL* = (SQL_CA2_MAX_ROWS_SELECT or
  293. SQL_CA2_MAX_ROWS_INSERT or SQL_CA2_MAX_ROWS_DELETE or
  294. SQL_CA2_MAX_ROWS_UPDATE or SQL_CA2_MAX_ROWS_CATALOG) # semantics of
  295. # SQL_DIAG_CURSOR_ROW_COUNT
  296. SQL_CA2_CRC_EXACT* = 0x00001000
  297. SQL_CA2_CRC_APPROXIMATE* = 0x00002000 # the kinds of positioned statements that can be simulated
  298. SQL_CA2_SIMULATE_NON_UNIQUE* = 0x00004000
  299. SQL_CA2_SIMULATE_TRY_UNIQUE* = 0x00008000
  300. SQL_CA2_SIMULATE_UNIQUE* = 0x00010000 # Operations in SQLBulkOperations
  301. SQL_ADD* = 4
  302. SQL_SETPOS_MAX_OPTION_VALUE* = SQL_ADD
  303. SQL_UPDATE_BY_BOOKMARK* = 5
  304. SQL_DELETE_BY_BOOKMARK* = 6
  305. SQL_FETCH_BY_BOOKMARK* = 7 # Operations in SQLSetPos
  306. SQL_POSITION* = 0
  307. SQL_REFRESH* = 1
  308. SQL_UPDATE* = 2
  309. SQL_DELETE* = 3 # Lock options in SQLSetPos
  310. SQL_LOCK_NO_CHANGE* = 0
  311. SQL_LOCK_EXCLUSIVE* = 1
  312. SQL_LOCK_UNLOCK* = 2 # SQLExtendedFetch "rgfRowStatus" element values
  313. SQL_ROW_SUCCESS* = 0
  314. SQL_ROW_DELETED* = 1
  315. SQL_ROW_UPDATED* = 2
  316. SQL_ROW_NOROW* = 3
  317. SQL_ROW_ADDED* = 4
  318. SQL_ROW_ERROR* = 5
  319. SQL_ROW_SUCCESS_WITH_INFO* = 6
  320. SQL_ROW_PROCEED* = 0
  321. SQL_ROW_IGNORE* = 1
  322. SQL_MAX_DSN_LENGTH* = 32 # maximum data source name size
  323. SQL_MAX_OPTION_STRING_LENGTH* = 256
  324. SQL_ODBC_CURSORS* = 110
  325. SQL_ATTR_ODBC_CURSORS* = SQL_ODBC_CURSORS # SQL_ODBC_CURSORS options
  326. SQL_CUR_USE_IF_NEEDED* = 0
  327. SQL_CUR_USE_ODBC* = 1
  328. SQL_CUR_USE_DRIVER* = 2
  329. SQL_CUR_DEFAULT* = SQL_CUR_USE_DRIVER
  330. SQL_PARAM_TYPE_UNKNOWN* = 0
  331. SQL_PARAM_INPUT* = 1
  332. SQL_PARAM_INPUT_OUTPUT* = 2
  333. SQL_RESULT_COL* = 3
  334. SQL_PARAM_OUTPUT* = 4
  335. SQL_RETURN_VALUE* = 5 # special length/indicator values
  336. SQL_NULL_DATA* = (- 1)
  337. SQL_DATA_AT_EXEC* = (- 2)
  338. SQL_SUCCESS* = 0
  339. SQL_SUCCESS_WITH_INFO* = 1
  340. SQL_NO_DATA* = 100
  341. SQL_ERROR* = (- 1)
  342. SQL_INVALID_HANDLE* = (- 2)
  343. SQL_STILL_EXECUTING* = 2
  344. SQL_NEED_DATA* = 99 # flags for null-terminated string
  345. SQL_NTS* = (- 3) # maximum message length
  346. SQL_MAX_MESSAGE_LENGTH* = 512 # date/time length constants
  347. SQL_DATE_LEN* = 10
  348. SQL_TIME_LEN* = 8 # add P+1 if precision is nonzero
  349. SQL_TIMESTAMP_LEN* = 19 # add P+1 if precision is nonzero
  350. # handle type identifiers
  351. SQL_HANDLE_ENV* = 1
  352. SQL_HANDLE_DBC* = 2
  353. SQL_HANDLE_STMT* = 3
  354. SQL_HANDLE_DESC* = 4 # environment attribute
  355. SQL_ATTR_OUTPUT_NTS* = 10001 # connection attributes
  356. SQL_ATTR_AUTO_IPD* = 10001
  357. SQL_ATTR_METADATA_ID* = 10014 # statement attributes
  358. SQL_ATTR_APP_ROW_DESC* = 10010
  359. SQL_ATTR_APP_PARAM_DESC* = 10011
  360. SQL_ATTR_IMP_ROW_DESC* = 10012
  361. SQL_ATTR_IMP_PARAM_DESC* = 10013
  362. SQL_ATTR_CURSOR_SCROLLABLE* = (- 1)
  363. SQL_ATTR_CURSOR_SENSITIVITY* = (- 2)
  364. SQL_QUERY_TIMEOUT* = 0
  365. SQL_MAX_ROWS* = 1
  366. SQL_NOSCAN* = 2
  367. SQL_MAX_LENGTH* = 3
  368. SQL_ASYNC_ENABLE* = 4 # same as SQL_ATTR_ASYNC_ENABLE */
  369. SQL_BIND_TYPE* = 5
  370. SQL_CURSOR_TYPE* = 6
  371. SQL_CONCURRENCY* = 7
  372. SQL_KEYSET_SIZE* = 8
  373. SQL_ROWSET_SIZE* = 9
  374. SQL_SIMULATE_CURSOR* = 10
  375. SQL_RETRIEVE_DATA* = 11
  376. SQL_USE_BOOKMARKS* = 12
  377. SQL_GET_BOOKMARK* = 13 # GetStmtOption Only */
  378. SQL_ROW_NUMBER* = 14 # GetStmtOption Only */
  379. SQL_ATTR_CURSOR_TYPE* = SQL_CURSOR_TYPE
  380. SQL_ATTR_CONCURRENCY* = SQL_CONCURRENCY
  381. SQL_ATTR_FETCH_BOOKMARK_PTR* = 16
  382. SQL_ATTR_ROW_STATUS_PTR* = 25
  383. SQL_ATTR_ROWS_FETCHED_PTR* = 26
  384. SQL_AUTOCOMMIT* = 102
  385. SQL_ATTR_AUTOCOMMIT* = SQL_AUTOCOMMIT
  386. SQL_ATTR_ROW_NUMBER* = SQL_ROW_NUMBER
  387. SQL_TXN_ISOLATION* = 108
  388. SQL_ATTR_TXN_ISOLATION* = SQL_TXN_ISOLATION
  389. SQL_ATTR_MAX_ROWS* = SQL_MAX_ROWS
  390. SQL_ATTR_USE_BOOKMARKS* = SQL_USE_BOOKMARKS #* connection attributes */
  391. SQL_ACCESS_MODE* = 101 # SQL_AUTOCOMMIT =102;
  392. SQL_LOGIN_TIMEOUT* = 103
  393. SQL_OPT_TRACE* = 104
  394. SQL_OPT_TRACEFILE* = 105
  395. SQL_TRANSLATE_DLL* = 106
  396. SQL_TRANSLATE_OPTION* = 107 # SQL_TXN_ISOLATION =108;
  397. SQL_CURRENT_QUALIFIER* = 109 # SQL_ODBC_CURSORS =110;
  398. SQL_QUIET_MODE* = 111
  399. SQL_PACKET_SIZE* = 112 #* connection attributes with new names */
  400. SQL_ATTR_ACCESS_MODE* = SQL_ACCESS_MODE # SQL_ATTR_AUTOCOMMIT =SQL_AUTOCOMMIT;
  401. SQL_ATTR_CONNECTION_DEAD* = 1209 #* GetConnectAttr only */
  402. SQL_ATTR_CONNECTION_TIMEOUT* = 113
  403. SQL_ATTR_CURRENT_CATALOG* = SQL_CURRENT_QUALIFIER
  404. SQL_ATTR_DISCONNECT_BEHAVIOR* = 114
  405. SQL_ATTR_ENLIST_IN_DTC* = 1207
  406. SQL_ATTR_ENLIST_IN_XA* = 1208
  407. SQL_ATTR_LOGIN_TIMEOUT* = SQL_LOGIN_TIMEOUT # SQL_ATTR_ODBC_CURSORS =SQL_ODBC_CURSORS;
  408. SQL_ATTR_PACKET_SIZE* = SQL_PACKET_SIZE
  409. SQL_ATTR_QUIET_MODE* = SQL_QUIET_MODE
  410. SQL_ATTR_TRACE* = SQL_OPT_TRACE
  411. SQL_ATTR_TRACEFILE* = SQL_OPT_TRACEFILE
  412. SQL_ATTR_TRANSLATE_LIB* = SQL_TRANSLATE_DLL
  413. SQL_ATTR_TRANSLATE_OPTION* = SQL_TRANSLATE_OPTION # SQL_ATTR_TXN_ISOLATION =SQL_TXN_ISOLATION;
  414. #* SQL_ACCESS_MODE options */
  415. SQL_MODE_READ_WRITE* = 0
  416. SQL_MODE_READ_ONLY* = 1
  417. SQL_MODE_DEFAULT* = SQL_MODE_READ_WRITE #* SQL_AUTOCOMMIT options */
  418. SQL_AUTOCOMMIT_OFF* = 0
  419. SQL_AUTOCOMMIT_ON* = 1
  420. SQL_AUTOCOMMIT_DEFAULT* = SQL_AUTOCOMMIT_ON # SQL_ATTR_CURSOR_SCROLLABLE values
  421. SQL_NONSCROLLABLE* = 0
  422. SQL_SCROLLABLE* = 1 # SQL_CURSOR_TYPE options
  423. SQL_CURSOR_FORWARD_ONLY* = 0
  424. SQL_CURSOR_KEYSET_DRIVEN* = 1
  425. SQL_CURSOR_DYNAMIC* = 2
  426. SQL_CURSOR_STATIC* = 3
  427. SQL_CURSOR_TYPE_DEFAULT* = SQL_CURSOR_FORWARD_ONLY # Default value
  428. # SQL_CONCURRENCY options
  429. SQL_CONCUR_READ_ONLY* = 1
  430. SQL_CONCUR_LOCK* = 2
  431. SQL_CONCUR_ROWVER* = 3
  432. SQL_CONCUR_VALUES* = 4
  433. SQL_CONCUR_DEFAULT* = SQL_CONCUR_READ_ONLY # Default value
  434. # identifiers of fields in the SQL descriptor
  435. SQL_DESC_COUNT* = 1001
  436. SQL_DESC_TYPE* = 1002
  437. SQL_DESC_LENGTH* = 1003
  438. SQL_DESC_OCTET_LENGTH_PTR* = 1004
  439. SQL_DESC_PRECISION* = 1005
  440. SQL_DESC_SCALE* = 1006
  441. SQL_DESC_DATETIME_INTERVAL_CODE* = 1007
  442. SQL_DESC_NULLABLE* = 1008
  443. SQL_DESC_INDICATOR_PTR* = 1009
  444. SQL_DESC_DATA_PTR* = 1010
  445. SQL_DESC_NAME* = 1011
  446. SQL_DESC_UNNAMED* = 1012
  447. SQL_DESC_OCTET_LENGTH* = 1013
  448. SQL_DESC_ALLOC_TYPE* = 1099 # identifiers of fields in the diagnostics area
  449. SQL_DIAG_RETURNCODE* = 1
  450. SQL_DIAG_NUMBER* = 2
  451. SQL_DIAG_ROW_COUNT* = 3
  452. SQL_DIAG_SQLSTATE* = 4
  453. SQL_DIAG_NATIVE* = 5
  454. SQL_DIAG_MESSAGE_TEXT* = 6
  455. SQL_DIAG_DYNAMIC_FUNCTION* = 7
  456. SQL_DIAG_CLASS_ORIGIN* = 8
  457. SQL_DIAG_SUBCLASS_ORIGIN* = 9
  458. SQL_DIAG_CONNECTION_NAME* = 10
  459. SQL_DIAG_SERVER_NAME* = 11
  460. SQL_DIAG_DYNAMIC_FUNCTION_CODE* = 12 # dynamic function codes
  461. SQL_DIAG_ALTER_TABLE* = 4
  462. SQL_DIAG_CREATE_INDEX* = (- 1)
  463. SQL_DIAG_CREATE_TABLE* = 77
  464. SQL_DIAG_CREATE_VIEW* = 84
  465. SQL_DIAG_DELETE_WHERE* = 19
  466. SQL_DIAG_DROP_INDEX* = (- 2)
  467. SQL_DIAG_DROP_TABLE* = 32
  468. SQL_DIAG_DROP_VIEW* = 36
  469. SQL_DIAG_DYNAMIC_DELETE_CURSOR* = 38
  470. SQL_DIAG_DYNAMIC_UPDATE_CURSOR* = 81
  471. SQL_DIAG_GRANT* = 48
  472. SQL_DIAG_INSERT* = 50
  473. SQL_DIAG_REVOKE* = 59
  474. SQL_DIAG_SELECT_CURSOR* = 85
  475. SQL_DIAG_UNKNOWN_STATEMENT* = 0
  476. SQL_DIAG_UPDATE_WHERE* = 82 # Statement attribute values for cursor sensitivity
  477. SQL_UNSPECIFIED* = 0
  478. SQL_INSENSITIVE* = 1
  479. SQL_SENSITIVE* = 2 # GetTypeInfo() request for all data types
  480. SQL_ALL_TYPES* = 0 # Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData()
  481. SQL_DEFAULT* = 99 # SQLGetData() code indicating that the application row descriptor
  482. # specifies the data type
  483. SQL_ARD_TYPE* = (- 99) # SQL date/time type subcodes
  484. SQL_CODE_DATE* = 1
  485. SQL_CODE_TIME* = 2
  486. SQL_CODE_TIMESTAMP* = 3 # CLI option values
  487. SQL_FALSE* = 0
  488. SQL_TRUE* = 1 # values of NULLABLE field in descriptor
  489. SQL_NO_NULLS* = 0
  490. SQL_NULLABLE* = 1 # Value returned by SQLGetTypeInfo() to denote that it is
  491. # not known whether or not a data type supports null values.
  492. SQL_NULLABLE_UNKNOWN* = 2
  493. SQL_CLOSE* = 0
  494. SQL_DROP* = 1
  495. SQL_UNBIND* = 2
  496. SQL_RESET_PARAMS* = 3 # Codes used for FetchOrientation in SQLFetchScroll(),
  497. # and in SQLDataSources()
  498. SQL_FETCH_NEXT* = 1
  499. SQL_FETCH_FIRST* = 2
  500. SQL_FETCH_FIRST_USER* = 31
  501. SQL_FETCH_FIRST_SYSTEM* = 32 # Other codes used for FetchOrientation in SQLFetchScroll()
  502. SQL_FETCH_LAST* = 3
  503. SQL_FETCH_PRIOR* = 4
  504. SQL_FETCH_ABSOLUTE* = 5
  505. SQL_FETCH_RELATIVE* = 6
  506. SQL_NULL_HENV* = SqlHEnv(nil)
  507. SQL_NULL_HDBC* = SqlHDBC(nil)
  508. SQL_NULL_HSTMT* = SqlHStmt(nil)
  509. SQL_NULL_HDESC* = SqlHDesc(nil) #* null handle used in place of parent handle when allocating HENV */
  510. SQL_NULL_HANDLE* = SqlHandle(nil) #* Values that may appear in the result set of SQLSpecialColumns() */
  511. SQL_SCOPE_CURROW* = 0
  512. SQL_SCOPE_TRANSACTION* = 1
  513. SQL_SCOPE_SESSION* = 2 #* Column types and scopes in SQLSpecialColumns. */
  514. SQL_BEST_ROWID* = 1
  515. SQL_ROWVER* = 2
  516. SQL_ROW_IDENTIFIER* = 1 #* Reserved values for UNIQUE argument of SQLStatistics() */
  517. SQL_INDEX_UNIQUE* = 0
  518. SQL_INDEX_ALL* = 1 #* Reserved values for RESERVED argument of SQLStatistics() */
  519. SQL_QUICK* = 0
  520. SQL_ENSURE* = 1 #* Values that may appear in the result set of SQLStatistics() */
  521. SQL_TABLE_STAT* = 0
  522. SQL_INDEX_CLUSTERED* = 1
  523. SQL_INDEX_HASHED* = 2
  524. SQL_INDEX_OTHER* = 3
  525. SQL_SCROLL_CONCURRENCY* = 43
  526. SQL_TXN_CAPABLE* = 46
  527. SQL_TRANSACTION_CAPABLE* = SQL_TXN_CAPABLE
  528. SQL_USER_NAME* = 47
  529. SQL_TXN_ISOLATION_OPTION* = 72
  530. SQL_TRANSACTION_ISOLATION_OPTION* = SQL_TXN_ISOLATION_OPTION
  531. SQL_OJ_CAPABILITIES* = 115
  532. SQL_OUTER_JOIN_CAPABILITIES* = SQL_OJ_CAPABILITIES
  533. SQL_XOPEN_CLI_YEAR* = 10000
  534. SQL_CURSOR_SENSITIVITY* = 10001
  535. SQL_DESCRIBE_PARAMETER* = 10002
  536. SQL_CATALOG_NAME* = 10003
  537. SQL_COLLATION_SEQ* = 10004
  538. SQL_MAX_IDENTIFIER_LEN* = 10005
  539. SQL_MAXIMUM_IDENTIFIER_LENGTH* = SQL_MAX_IDENTIFIER_LEN
  540. SQL_SCCO_READ_ONLY* = 1
  541. SQL_SCCO_LOCK* = 2
  542. SQL_SCCO_OPT_ROWVER* = 4
  543. SQL_SCCO_OPT_VALUES* = 8 #* SQL_TXN_CAPABLE values */
  544. SQL_TC_NONE* = 0
  545. SQL_TC_DML* = 1
  546. SQL_TC_ALL* = 2
  547. SQL_TC_DDL_COMMIT* = 3
  548. SQL_TC_DDL_IGNORE* = 4 #* SQL_TXN_ISOLATION_OPTION bitmasks */
  549. SQL_TXN_READ_UNCOMMITTED* = 1
  550. SQL_TRANSACTION_READ_UNCOMMITTED* = SQL_TXN_READ_UNCOMMITTED
  551. SQL_TXN_READ_COMMITTED* = 2
  552. SQL_TRANSACTION_READ_COMMITTED* = SQL_TXN_READ_COMMITTED
  553. SQL_TXN_REPEATABLE_READ* = 4
  554. SQL_TRANSACTION_REPEATABLE_READ* = SQL_TXN_REPEATABLE_READ
  555. SQL_TXN_SERIALIZABLE* = 8
  556. SQL_TRANSACTION_SERIALIZABLE* = SQL_TXN_SERIALIZABLE
  557. SQL_SS_ADDITIONS* = 1
  558. SQL_SS_DELETIONS* = 2
  559. SQL_SS_UPDATES* = 4 # SQLColAttributes defines
  560. SQL_COLUMN_COUNT* = 0
  561. SQL_COLUMN_NAME* = 1
  562. SQL_COLUMN_TYPE* = 2
  563. SQL_COLUMN_LENGTH* = 3
  564. SQL_COLUMN_PRECISION* = 4
  565. SQL_COLUMN_SCALE* = 5
  566. SQL_COLUMN_DISPLAY_SIZE* = 6
  567. SQL_COLUMN_NULLABLE* = 7
  568. SQL_COLUMN_UNSIGNED* = 8
  569. SQL_COLUMN_MONEY* = 9
  570. SQL_COLUMN_UPDATABLE* = 10
  571. SQL_COLUMN_AUTO_INCREMENT* = 11
  572. SQL_COLUMN_CASE_SENSITIVE* = 12
  573. SQL_COLUMN_SEARCHABLE* = 13
  574. SQL_COLUMN_TYPE_NAME* = 14
  575. SQL_COLUMN_TABLE_NAME* = 15
  576. SQL_COLUMN_OWNER_NAME* = 16
  577. SQL_COLUMN_QUALIFIER_NAME* = 17
  578. SQL_COLUMN_LABEL* = 18
  579. SQL_COLATT_OPT_MAX* = SQL_COLUMN_LABEL
  580. SQL_COLUMN_DRIVER_START* = 1000
  581. SQL_DESC_ARRAY_SIZE* = 20
  582. SQL_DESC_ARRAY_STATUS_PTR* = 21
  583. SQL_DESC_AUTO_UNIQUE_VALUE* = SQL_COLUMN_AUTO_INCREMENT
  584. SQL_DESC_BASE_COLUMN_NAME* = 22
  585. SQL_DESC_BASE_TABLE_NAME* = 23
  586. SQL_DESC_BIND_OFFSET_PTR* = 24
  587. SQL_DESC_BIND_TYPE* = 25
  588. SQL_DESC_CASE_SENSITIVE* = SQL_COLUMN_CASE_SENSITIVE
  589. SQL_DESC_CATALOG_NAME* = SQL_COLUMN_QUALIFIER_NAME
  590. SQL_DESC_CONCISE_TYPE* = SQL_COLUMN_TYPE
  591. SQL_DESC_DATETIME_INTERVAL_PRECISION* = 26
  592. SQL_DESC_DISPLAY_SIZE* = SQL_COLUMN_DISPLAY_SIZE
  593. SQL_DESC_FIXED_PREC_SCALE* = SQL_COLUMN_MONEY
  594. SQL_DESC_LABEL* = SQL_COLUMN_LABEL
  595. SQL_DESC_LITERAL_PREFIX* = 27
  596. SQL_DESC_LITERAL_SUFFIX* = 28
  597. SQL_DESC_LOCAL_TYPE_NAME* = 29
  598. SQL_DESC_MAXIMUM_SCALE* = 30
  599. SQL_DESC_MINIMUM_SCALE* = 31
  600. SQL_DESC_NUM_PREC_RADIX* = 32
  601. SQL_DESC_PARAMETER_TYPE* = 33
  602. SQL_DESC_ROWS_PROCESSED_PTR* = 34
  603. SQL_DESC_SCHEMA_NAME* = SQL_COLUMN_OWNER_NAME
  604. SQL_DESC_SEARCHABLE* = SQL_COLUMN_SEARCHABLE
  605. SQL_DESC_TYPE_NAME* = SQL_COLUMN_TYPE_NAME
  606. SQL_DESC_TABLE_NAME* = SQL_COLUMN_TABLE_NAME
  607. SQL_DESC_UNSIGNED* = SQL_COLUMN_UNSIGNED
  608. SQL_DESC_UPDATABLE* = SQL_COLUMN_UPDATABLE #* SQLEndTran() options */
  609. SQL_COMMIT* = 0
  610. SQL_ROLLBACK* = 1
  611. SQL_ATTR_ROW_ARRAY_SIZE* = 27 #* SQLConfigDataSource() options */
  612. ODBC_ADD_DSN* = 1
  613. ODBC_CONFIG_DSN* = 2
  614. ODBC_REMOVE_DSN* = 3
  615. ODBC_ADD_SYS_DSN* = 4
  616. ODBC_CONFIG_SYS_DSN* = 5
  617. ODBC_REMOVE_SYS_DSN* = 6
  618. SQL_ACTIVE_CONNECTIONS* = 0 # SQLGetInfo
  619. SQL_DATA_SOURCE_NAME* = 2
  620. SQL_DATA_SOURCE_READ_ONLY* = 25
  621. SQL_DATABASE_NAME* = 2
  622. SQL_DBMS_NAME* = 17
  623. SQL_DBMS_VERSION* = 18
  624. SQL_DRIVER_HDBC* = 3
  625. SQL_DRIVER_HENV* = 4
  626. SQL_DRIVER_HSTMT* = 5
  627. SQL_DRIVER_NAME* = 6
  628. SQL_DRIVER_VER* = 7
  629. SQL_FETCH_DIRECTION* = 8
  630. SQL_ODBC_VER* = 10
  631. SQL_DRIVER_ODBC_VER* = 77
  632. SQL_SERVER_NAME* = 13
  633. SQL_ACTIVE_ENVIRONMENTS* = 116
  634. SQL_ACTIVE_STATEMENTS* = 1
  635. SQL_SQL_CONFORMANCE* = 118
  636. SQL_DATETIME_LITERALS* = 119
  637. SQL_ASYNC_MODE* = 10021
  638. SQL_BATCH_ROW_COUNT* = 120
  639. SQL_BATCH_SUPPORT* = 121
  640. SQL_CATALOG_LOCATION* = 114
  641. #SQL_CATALOG_NAME* = 10003
  642. SQL_CATALOG_NAME_SEPARATOR* = 41
  643. SQL_CATALOG_TERM* = 42
  644. SQL_CATALOG_USAGE* = 92
  645. #SQL_COLLATION_SEQ* = 10004
  646. SQL_COLUMN_ALIAS* = 87
  647. #SQL_USER_NAME* = 47
  648. proc SQLAllocHandle*(HandleType: TSqlSmallInt, InputHandle: SqlHandle,
  649. OutputHandlePtr: var SqlHandle): TSqlSmallInt{.
  650. dynlib: odbclib, importc.}
  651. proc SQLSetEnvAttr*(EnvironmentHandle: SqlHEnv, Attribute: TSqlInteger,
  652. Value: TSqlInteger, StringLength: TSqlInteger): TSqlSmallInt{.
  653. dynlib: odbclib, importc.}
  654. proc SQLGetEnvAttr*(EnvironmentHandle: SqlHEnv, Attribute: TSqlInteger,
  655. Value: SqlPointer, BufferLength: TSqlInteger,
  656. StringLength: PSQLINTEGER): TSqlSmallInt{.dynlib: odbclib,
  657. importc.}
  658. proc SQLFreeHandle*(HandleType: TSqlSmallInt, Handle: SqlHandle): TSqlSmallInt{.
  659. dynlib: odbclib, importc.}
  660. proc SQLGetDiagRec*(HandleType: TSqlSmallInt, Handle: SqlHandle,
  661. RecNumber: TSqlSmallInt, Sqlstate: PSQLCHAR,
  662. NativeError: var TSqlInteger, MessageText: PSQLCHAR,
  663. BufferLength: TSqlSmallInt, TextLength: var TSqlSmallInt): TSqlSmallInt{.
  664. dynlib: odbclib, importc.}
  665. proc SQLGetDiagField*(HandleType: TSqlSmallInt, Handle: SqlHandle,
  666. RecNumber: TSqlSmallInt, DiagIdentifier: TSqlSmallInt,
  667. DiagInfoPtr: SqlPointer, BufferLength: TSqlSmallInt,
  668. StringLengthPtr: var TSqlSmallInt): TSqlSmallInt{.
  669. dynlib: odbclib, importc.}
  670. proc SQLConnect*(ConnectionHandle: SqlHDBC, ServerName: PSQLCHAR,
  671. NameLength1: TSqlSmallInt, UserName: PSQLCHAR,
  672. NameLength2: TSqlSmallInt, Authentication: PSQLCHAR,
  673. NameLength3: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
  674. proc SQLDisconnect*(ConnectionHandle: SqlHDBC): TSqlSmallInt{.dynlib: odbclib,
  675. importc.}
  676. proc SQLDriverConnect*(hdbc: SqlHDBC, hwnd: SqlHWND, szCsin: cstring,
  677. szCLen: TSqlSmallInt, szCsout: cstring,
  678. cbCSMax: TSqlSmallInt, cbCsOut: var TSqlSmallInt,
  679. f: SqlUSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
  680. proc SQLBrowseConnect*(hdbc: SqlHDBC, szConnStrIn: PSQLCHAR,
  681. cbConnStrIn: TSqlSmallInt, szConnStrOut: PSQLCHAR,
  682. cbConnStrOutMax: TSqlSmallInt,
  683. cbConnStrOut: var TSqlSmallInt): TSqlSmallInt{.
  684. dynlib: odbclib, importc.}
  685. proc SQLExecDirect*(StatementHandle: SqlHStmt, StatementText: PSQLCHAR,
  686. TextLength: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
  687. proc SQLExecDirectW*(StatementHandle: SqlHStmt, StatementText: WideCString,
  688. TextLength: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
  689. proc SQLPrepare*(StatementHandle: SqlHStmt, StatementText: PSQLCHAR,
  690. TextLength: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
  691. proc SQLPrepareW*(StatementHandle: SqlHStmt, StatementText: WideCString,
  692. TextLength: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
  693. proc SQLCloseCursor*(StatementHandle: SqlHStmt): TSqlSmallInt{.dynlib: odbclib,
  694. importc.}
  695. proc SQLExecute*(StatementHandle: SqlHStmt): TSqlSmallInt{.dynlib: odbclib, importc.}
  696. proc SQLFetch*(StatementHandle: SqlHStmt): TSqlSmallInt{.dynlib: odbclib, importc.}
  697. proc SQLNumResultCols*(StatementHandle: SqlHStmt, ColumnCount: var TSqlSmallInt): TSqlSmallInt{.
  698. dynlib: odbclib, importc.}
  699. proc SQLDescribeCol*(StatementHandle: SqlHStmt, ColumnNumber: SqlUSmallInt,
  700. ColumnName: PSQLCHAR, BufferLength: TSqlSmallInt,
  701. NameLength: var TSqlSmallInt, DataType: var TSqlSmallInt,
  702. ColumnSize: var SqlUInteger,
  703. DecimalDigits: var TSqlSmallInt, Nullable: var TSqlSmallInt): TSqlSmallInt{.
  704. dynlib: odbclib, importc.}
  705. proc SQLFetchScroll*(StatementHandle: SqlHStmt, FetchOrientation: TSqlSmallInt,
  706. FetchOffset: TSqlInteger): TSqlSmallInt{.dynlib: odbclib,
  707. importc.}
  708. proc SQLExtendedFetch*(hstmt: SqlHStmt, fFetchType: SqlUSmallInt,
  709. irow: TSqlInteger, pcrow: PSQLUINTEGER,
  710. rgfRowStatus: PSQLUSMALLINT): TSqlSmallInt{.dynlib: odbclib,
  711. importc.}
  712. proc SQLGetData*(StatementHandle: SqlHStmt, ColumnNumber: SqlUSmallInt,
  713. TargetType: TSqlSmallInt, TargetValue: SqlPointer,
  714. BufferLength: TSqlInteger, StrLen_or_Ind: PSQLINTEGER): TSqlSmallInt{.
  715. dynlib: odbclib, importc.}
  716. proc SQLSetStmtAttr*(StatementHandle: SqlHStmt, Attribute: TSqlInteger,
  717. Value: SqlPointer, StringLength: TSqlInteger): TSqlSmallInt{.
  718. dynlib: odbclib, importc.}
  719. proc SQLGetStmtAttr*(StatementHandle: SqlHStmt, Attribute: TSqlInteger,
  720. Value: SqlPointer, BufferLength: TSqlInteger,
  721. StringLength: PSQLINTEGER): TSqlSmallInt{.dynlib: odbclib,
  722. importc.}
  723. proc SQLGetInfo*(ConnectionHandle: SqlHDBC, InfoType: SqlUSmallInt,
  724. InfoValue: SqlPointer, BufferLength: TSqlSmallInt,
  725. StringLength: PSQLSMALLINT): TSqlSmallInt{.dynlib: odbclib,
  726. importc.}
  727. proc SQLBulkOperations*(StatementHandle: SqlHStmt, Operation: TSqlSmallInt): TSqlSmallInt{.
  728. dynlib: odbclib, importc.}
  729. proc SQLPutData*(StatementHandle: SqlHStmt, Data: SqlPointer,
  730. StrLen_or_Ind: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
  731. proc SQLBindCol*(StatementHandle: SqlHStmt, ColumnNumber: SqlUSmallInt,
  732. TargetType: TSqlSmallInt, TargetValue: SqlPointer,
  733. BufferLength: TSqlInteger, StrLen_or_Ind: PSQLINTEGER): TSqlSmallInt{.
  734. dynlib: odbclib, importc.}
  735. proc SQLSetPos*(hstmt: SqlHStmt, irow: SqlUSmallInt, fOption: SqlUSmallInt,
  736. fLock: SqlUSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
  737. proc SQLDataSources*(EnvironmentHandle: SqlHEnv, Direction: SqlUSmallInt,
  738. ServerName: PSQLCHAR, BufferLength1: TSqlSmallInt,
  739. NameLength1: PSQLSMALLINT, Description: PSQLCHAR,
  740. BufferLength2: TSqlSmallInt, NameLength2: PSQLSMALLINT): TSqlSmallInt{.
  741. dynlib: odbclib, importc.}
  742. proc SQLDrivers*(EnvironmentHandle: SqlHEnv, Direction: SqlUSmallInt,
  743. DriverDescription: PSQLCHAR, BufferLength1: TSqlSmallInt,
  744. DescriptionLength1: PSQLSMALLINT, DriverAttributes: PSQLCHAR,
  745. BufferLength2: TSqlSmallInt, AttributesLength2: PSQLSMALLINT): TSqlSmallInt{.
  746. dynlib: odbclib, importc.}
  747. proc SQLSetConnectAttr*(ConnectionHandle: SqlHDBC, Attribute: TSqlInteger,
  748. Value: SqlPointer, StringLength: TSqlInteger): TSqlSmallInt{.
  749. dynlib: odbclib, importc.}
  750. proc SQLGetCursorName*(StatementHandle: SqlHStmt, CursorName: PSQLCHAR,
  751. BufferLength: TSqlSmallInt, NameLength: PSQLSMALLINT): TSqlSmallInt{.
  752. dynlib: odbclib, importc.}
  753. proc SQLSetCursorName*(StatementHandle: SqlHStmt, CursorName: PSQLCHAR,
  754. NameLength: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
  755. importc.}
  756. proc SQLRowCount*(StatementHandle: SqlHStmt, RowCount: var TSqlInteger): TSqlSmallInt{.
  757. dynlib: odbclib, importc.}
  758. proc SQLBindParameter*(hstmt: SqlHStmt, ipar: SqlUSmallInt,
  759. fParamType: TSqlSmallInt, fCType: TSqlSmallInt,
  760. fSqlType: TSqlSmallInt, cbColDef: SqlUInteger,
  761. ibScale: TSqlSmallInt, rgbValue: SqlPointer,
  762. cbValueMax: TSqlInteger, pcbValue: PSQLINTEGER): TSqlSmallInt{.
  763. dynlib: odbclib, importc.}
  764. proc SQLFreeStmt*(StatementHandle: SqlHStmt, Option: SqlUSmallInt): TSqlSmallInt{.
  765. dynlib: odbclib, importc.}
  766. proc SQLColAttribute*(StatementHandle: SqlHStmt, ColumnNumber: SqlUSmallInt,
  767. FieldIdentifier: SqlUSmallInt,
  768. CharacterAttribute: PSQLCHAR, BufferLength: TSqlSmallInt,
  769. StringLength: PSQLSMALLINT,
  770. NumericAttribute: SqlPointer): TSqlSmallInt{.
  771. dynlib: odbclib, importc.}
  772. proc SQLEndTran*(HandleType: TSqlSmallInt, Handle: SqlHandle,
  773. CompletionType: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
  774. importc.}
  775. proc SQLTables*(hstmt: SqlHStmt, szTableQualifier: PSQLCHAR,
  776. cbTableQualifier: TSqlSmallInt, szTableOwner: PSQLCHAR,
  777. cbTableOwner: TSqlSmallInt, szTableName: PSQLCHAR,
  778. cbTableName: TSqlSmallInt, szTableType: PSQLCHAR,
  779. cbTableType: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
  780. proc SQLColumns*(hstmt: SqlHStmt, szTableQualifier: PSQLCHAR,
  781. cbTableQualifier: TSqlSmallInt, szTableOwner: PSQLCHAR,
  782. cbTableOwner: TSqlSmallInt, szTableName: PSQLCHAR,
  783. cbTableName: TSqlSmallInt, szColumnName: PSQLCHAR,
  784. cbColumnName: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
  785. proc SQLSpecialColumns*(StatementHandle: SqlHStmt, IdentifierType: SqlUSmallInt,
  786. CatalogName: PSQLCHAR, NameLength1: TSqlSmallInt,
  787. SchemaName: PSQLCHAR, NameLength2: TSqlSmallInt,
  788. TableName: PSQLCHAR, NameLength3: TSqlSmallInt,
  789. Scope: SqlUSmallInt,
  790. Nullable: SqlUSmallInt): TSqlSmallInt{.
  791. dynlib: odbclib, importc.}
  792. proc SQLProcedures*(hstmt: SqlHStmt, szTableQualifier: PSQLCHAR,
  793. cbTableQualifier: TSqlSmallInt, szTableOwner: PSQLCHAR,
  794. cbTableOwner: TSqlSmallInt, szTableName: PSQLCHAR,
  795. cbTableName: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
  796. importc.}
  797. proc SQLPrimaryKeys*(hstmt: SqlHStmt, CatalogName: PSQLCHAR,
  798. NameLength1: TSqlSmallInt, SchemaName: PSQLCHAR,
  799. NameLength2: TSqlSmallInt, TableName: PSQLCHAR,
  800. NameLength3: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
  801. importc.}
  802. proc SQLProcedureColumns*(hstmt: SqlHStmt, CatalogName: PSQLCHAR,
  803. NameLength1: TSqlSmallInt, SchemaName: PSQLCHAR,
  804. NameLength2: TSqlSmallInt, ProcName: PSQLCHAR,
  805. NameLength3: TSqlSmallInt, ColumnName: PSQLCHAR,
  806. NameLength4: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
  807. importc.}
  808. proc SQLStatistics*(hstmt: SqlHStmt, CatalogName: PSQLCHAR,
  809. NameLength1: TSqlSmallInt, SchemaName: PSQLCHAR,
  810. NameLength2: TSqlSmallInt, TableName: PSQLCHAR,
  811. NameLength3: TSqlSmallInt, Unique: SqlUSmallInt,
  812. Reserved: SqlUSmallInt): TSqlSmallInt {.
  813. dynlib: odbclib, importc.}
  814. proc SQLErr*(henv: SqlHEnv, hdbc: SqlHDBC, hstmt: SqlHStmt,
  815. szSqlState, pfNativeError, szErrorMsg: PSQLCHAR,
  816. cbErrorMsgMax: TSqlSmallInt,
  817. pcbErrorMsg: PSQLSMALLINT): TSqlSmallInt {.
  818. dynlib: odbclib, importc: "SQLError".}
  819. {.pop.}
  820. when defined(nimHasStyleChecks):
  821. {.pop.}