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