sqlite3.nim 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2012 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 defined(windows):
  11. when defined(nimOldDlls):
  12. const Lib = "sqlite3.dll"
  13. elif defined(cpu64):
  14. const Lib = "sqlite3_64.dll"
  15. else:
  16. const Lib = "sqlite3_32.dll"
  17. elif defined(macosx):
  18. const
  19. Lib = "libsqlite3(|.0).dylib"
  20. else:
  21. const
  22. Lib = "libsqlite3.so(|.0)"
  23. const
  24. SQLITE_INTEGER* = 1
  25. SQLITE_FLOAT* = 2
  26. SQLITE_BLOB* = 4
  27. SQLITE_NULL* = 5
  28. SQLITE_TEXT* = 3
  29. SQLITE_UTF8* = 1
  30. SQLITE_UTF16LE* = 2
  31. SQLITE_UTF16BE* = 3 # Use native byte order
  32. SQLITE_UTF16* = 4 # sqlite3_create_function only
  33. SQLITE_ANY* = 5 #sqlite_exec return values
  34. SQLITE_OK* = 0
  35. SQLITE_ERROR* = 1 # SQL error or missing database
  36. SQLITE_INTERNAL* = 2 # An internal logic error in SQLite
  37. SQLITE_PERM* = 3 # Access permission denied
  38. SQLITE_ABORT* = 4 # Callback routine requested an abort
  39. SQLITE_BUSY* = 5 # The database file is locked
  40. SQLITE_LOCKED* = 6 # A table in the database is locked
  41. SQLITE_NOMEM* = 7 # A malloc() failed
  42. SQLITE_READONLY* = 8 # Attempt to write a readonly database
  43. SQLITE_INTERRUPT* = 9 # Operation terminated by sqlite3_interrupt()
  44. SQLITE_IOERR* = 10 # Some kind of disk I/O error occurred
  45. SQLITE_CORRUPT* = 11 # The database disk image is malformed
  46. SQLITE_NOTFOUND* = 12 # (Internal Only) Table or record not found
  47. SQLITE_FULL* = 13 # Insertion failed because database is full
  48. SQLITE_CANTOPEN* = 14 # Unable to open the database file
  49. SQLITE_PROTOCOL* = 15 # Database lock protocol error
  50. SQLITE_EMPTY* = 16 # Database is empty
  51. SQLITE_SCHEMA* = 17 # The database schema changed
  52. SQLITE_TOOBIG* = 18 # Too much data for one row of a table
  53. SQLITE_CONSTRAINT* = 19 # Abort due to contraint violation
  54. SQLITE_MISMATCH* = 20 # Data type mismatch
  55. SQLITE_MISUSE* = 21 # Library used incorrectly
  56. SQLITE_NOLFS* = 22 # Uses OS features not supported on host
  57. SQLITE_AUTH* = 23 # Authorization denied
  58. SQLITE_FORMAT* = 24 # Auxiliary database format error
  59. SQLITE_RANGE* = 25 # 2nd parameter to sqlite3_bind out of range
  60. SQLITE_NOTADB* = 26 # File opened that is not a database file
  61. SQLITE_ROW* = 100 # sqlite3_step() has another row ready
  62. SQLITE_DONE* = 101 # sqlite3_step() has finished executing
  63. SQLITE_COPY* = 0
  64. SQLITE_CREATE_INDEX* = 1
  65. SQLITE_CREATE_TABLE* = 2
  66. SQLITE_CREATE_TEMP_INDEX* = 3
  67. SQLITE_CREATE_TEMP_TABLE* = 4
  68. SQLITE_CREATE_TEMP_TRIGGER* = 5
  69. SQLITE_CREATE_TEMP_VIEW* = 6
  70. SQLITE_CREATE_TRIGGER* = 7
  71. SQLITE_CREATE_VIEW* = 8
  72. SQLITE_DELETE* = 9
  73. SQLITE_DROP_INDEX* = 10
  74. SQLITE_DROP_TABLE* = 11
  75. SQLITE_DROP_TEMP_INDEX* = 12
  76. SQLITE_DROP_TEMP_TABLE* = 13
  77. SQLITE_DROP_TEMP_TRIGGER* = 14
  78. SQLITE_DROP_TEMP_VIEW* = 15
  79. SQLITE_DROP_TRIGGER* = 16
  80. SQLITE_DROP_VIEW* = 17
  81. SQLITE_INSERT* = 18
  82. SQLITE_PRAGMA* = 19
  83. SQLITE_READ* = 20
  84. SQLITE_SELECT* = 21
  85. SQLITE_TRANSACTION* = 22
  86. SQLITE_UPDATE* = 23
  87. SQLITE_ATTACH* = 24
  88. SQLITE_DETACH* = 25
  89. SQLITE_ALTER_TABLE* = 26
  90. SQLITE_REINDEX* = 27
  91. SQLITE_DENY* = 1
  92. SQLITE_IGNORE* = 2 # Original from sqlite3.h:
  93. #define SQLITE_STATIC ((void(*)(void *))0)
  94. #define SQLITE_TRANSIENT ((void(*)(void *))-1)
  95. SQLITE_DETERMINISTIC* = 0x800
  96. type
  97. Sqlite3 {.pure, final.} = object
  98. PSqlite3* = ptr Sqlite3
  99. PPSqlite3* = ptr PSqlite3
  100. Context{.pure, final.} = object
  101. Pcontext* = ptr Context
  102. Tstmt{.pure, final.} = object
  103. Pstmt* = ptr Tstmt
  104. Value{.pure, final.} = object
  105. Pvalue* = ptr Value
  106. PValueArg* = array[0..127, Pvalue]
  107. Callback* = proc (para1: pointer, para2: int32, para3,
  108. para4: cstringArray): int32{.cdecl.}
  109. Tbind_destructor_func* = proc (para1: pointer){.cdecl, locks: 0, tags: [], gcsafe.}
  110. Create_function_step_func* = proc (para1: Pcontext, para2: int32,
  111. para3: PValueArg){.cdecl.}
  112. Create_function_func_func* = proc (para1: Pcontext, para2: int32,
  113. para3: PValueArg){.cdecl.}
  114. Create_function_final_func* = proc (para1: Pcontext){.cdecl.}
  115. Result_func* = proc (para1: pointer){.cdecl.}
  116. Create_collation_func* = proc (para1: pointer, para2: int32, para3: pointer,
  117. para4: int32, para5: pointer): int32{.cdecl.}
  118. Collation_needed_func* = proc (para1: pointer, para2: PSqlite3, eTextRep: int32,
  119. para4: cstring){.cdecl.}
  120. const
  121. SQLITE_STATIC* = nil
  122. SQLITE_TRANSIENT* = cast[Tbind_destructor_func](-1)
  123. proc close*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_close".}
  124. proc exec*(para1: PSqlite3, sql: cstring, para3: Callback, para4: pointer,
  125. errmsg: var cstring): int32{.cdecl, dynlib: Lib,
  126. importc: "sqlite3_exec".}
  127. proc last_insert_rowid*(para1: PSqlite3): int64{.cdecl, dynlib: Lib,
  128. importc: "sqlite3_last_insert_rowid".}
  129. proc changes*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_changes".}
  130. proc total_changes*(para1: PSqlite3): int32{.cdecl, dynlib: Lib,
  131. importc: "sqlite3_total_changes".}
  132. proc interrupt*(para1: PSqlite3){.cdecl, dynlib: Lib, importc: "sqlite3_interrupt".}
  133. proc complete*(sql: cstring): int32{.cdecl, dynlib: Lib,
  134. importc: "sqlite3_complete".}
  135. proc complete16*(sql: pointer): int32{.cdecl, dynlib: Lib,
  136. importc: "sqlite3_complete16".}
  137. proc busy_handler*(para1: PSqlite3,
  138. para2: proc (para1: pointer, para2: int32): int32{.cdecl.},
  139. para3: pointer): int32{.cdecl, dynlib: Lib,
  140. importc: "sqlite3_busy_handler".}
  141. proc busy_timeout*(para1: PSqlite3, ms: int32): int32{.cdecl, dynlib: Lib,
  142. importc: "sqlite3_busy_timeout".}
  143. proc get_table*(para1: PSqlite3, sql: cstring, resultp: var cstringArray,
  144. nrow, ncolumn: var cint, errmsg: ptr cstring): int32{.cdecl,
  145. dynlib: Lib, importc: "sqlite3_get_table".}
  146. proc free_table*(result: cstringArray){.cdecl, dynlib: Lib,
  147. importc: "sqlite3_free_table".}
  148. # Todo: see how translate sqlite3_mprintf, sqlite3_vmprintf, sqlite3_snprintf
  149. # function sqlite3_mprintf(_para1:Pchar; args:array of const):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_mprintf';
  150. proc mprintf*(para1: cstring): cstring{.cdecl, varargs, dynlib: Lib,
  151. importc: "sqlite3_mprintf".}
  152. #function sqlite3_vmprintf(_para1:Pchar; _para2:va_list):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_vmprintf';
  153. proc free*(z: cstring){.cdecl, dynlib: Lib, importc: "sqlite3_free".}
  154. #function sqlite3_snprintf(_para1:longint; _para2:Pchar; _para3:Pchar; args:array of const):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_snprintf';
  155. proc snprintf*(para1: int32, para2: cstring, para3: cstring): cstring{.cdecl,
  156. dynlib: Lib, varargs, importc: "sqlite3_snprintf".}
  157. proc set_authorizer*(para1: PSqlite3, xAuth: proc (para1: pointer, para2: int32,
  158. para3: cstring, para4: cstring, para5: cstring, para6: cstring): int32{.
  159. cdecl.}, pUserData: pointer): int32{.cdecl, dynlib: Lib,
  160. importc: "sqlite3_set_authorizer".}
  161. proc trace*(para1: PSqlite3, xTrace: proc (para1: pointer, para2: cstring){.cdecl.},
  162. para3: pointer): pointer{.cdecl, dynlib: Lib,
  163. importc: "sqlite3_trace".}
  164. proc progress_handler*(para1: PSqlite3, para2: int32,
  165. para3: proc (para1: pointer): int32{.cdecl.},
  166. para4: pointer){.cdecl, dynlib: Lib,
  167. importc: "sqlite3_progress_handler".}
  168. proc commit_hook*(para1: PSqlite3, para2: proc (para1: pointer): int32{.cdecl.},
  169. para3: pointer): pointer{.cdecl, dynlib: Lib,
  170. importc: "sqlite3_commit_hook".}
  171. proc open*(filename: cstring, ppDb: var PSqlite3): int32{.cdecl, dynlib: Lib,
  172. importc: "sqlite3_open".}
  173. proc open16*(filename: pointer, ppDb: var PSqlite3): int32{.cdecl, dynlib: Lib,
  174. importc: "sqlite3_open16".}
  175. proc errcode*(db: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_errcode".}
  176. proc errmsg*(para1: PSqlite3): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_errmsg".}
  177. proc errmsg16*(para1: PSqlite3): pointer{.cdecl, dynlib: Lib,
  178. importc: "sqlite3_errmsg16".}
  179. proc prepare*(db: PSqlite3, zSql: cstring, nBytes: int32, ppStmt: var Pstmt,
  180. pzTail: ptr cstring): int32{.cdecl, dynlib: Lib,
  181. importc: "sqlite3_prepare".}
  182. proc prepare_v2*(db: PSqlite3, zSql: cstring, nByte: cint, ppStmt: var Pstmt,
  183. pzTail: ptr cstring): cint {.
  184. importc: "sqlite3_prepare_v2", cdecl, dynlib: Lib.}
  185. proc prepare16*(db: PSqlite3, zSql: pointer, nBytes: int32, ppStmt: var Pstmt,
  186. pzTail: var pointer): int32{.cdecl, dynlib: Lib,
  187. importc: "sqlite3_prepare16".}
  188. proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
  189. para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
  190. importc: "sqlite3_bind_blob".}
  191. proc bind_double*(para1: Pstmt, para2: int32, para3: float64): int32{.cdecl,
  192. dynlib: Lib, importc: "sqlite3_bind_double".}
  193. proc bind_int*(para1: Pstmt, para2: int32, para3: int32): int32{.cdecl,
  194. dynlib: Lib, importc: "sqlite3_bind_int".}
  195. proc bind_int64*(para1: Pstmt, para2: int32, para3: int64): int32{.cdecl,
  196. dynlib: Lib, importc: "sqlite3_bind_int64".}
  197. proc bind_null*(para1: Pstmt, para2: int32): int32{.cdecl, dynlib: Lib,
  198. importc: "sqlite3_bind_null".}
  199. proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
  200. para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
  201. importc: "sqlite3_bind_text".}
  202. proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
  203. para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
  204. importc: "sqlite3_bind_text16".}
  205. #function sqlite3_bind_value(_para1:Psqlite3_stmt; _para2:longint; _para3:Psqlite3_value):longint;cdecl; external Sqlite3Lib name 'sqlite3_bind_value';
  206. #These overloaded functions were introduced to allow the use of SQLITE_STATIC and SQLITE_TRANSIENT
  207. #It's the c world man ;-)
  208. proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
  209. para5: int32): int32{.cdecl, dynlib: Lib,
  210. importc: "sqlite3_bind_blob".}
  211. proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
  212. para5: int32): int32{.cdecl, dynlib: Lib,
  213. importc: "sqlite3_bind_text".}
  214. proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
  215. para5: int32): int32{.cdecl, dynlib: Lib,
  216. importc: "sqlite3_bind_text16".}
  217. proc bind_parameter_count*(para1: Pstmt): int32{.cdecl, dynlib: Lib,
  218. importc: "sqlite3_bind_parameter_count".}
  219. proc bind_parameter_name*(para1: Pstmt, para2: int32): cstring{.cdecl,
  220. dynlib: Lib, importc: "sqlite3_bind_parameter_name".}
  221. proc bind_parameter_index*(para1: Pstmt, zName: cstring): int32{.cdecl,
  222. dynlib: Lib, importc: "sqlite3_bind_parameter_index".}
  223. proc clear_bindings*(para1: Pstmt): int32 {.cdecl,
  224. dynlib: Lib, importc: "sqlite3_clear_bindings".}
  225. proc column_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
  226. importc: "sqlite3_column_count".}
  227. proc column_name*(para1: Pstmt, para2: int32): cstring{.cdecl, dynlib: Lib,
  228. importc: "sqlite3_column_name".}
  229. proc column_table_name*(para1: Pstmt; para2: int32): cstring{.cdecl, dynlib: Lib,
  230. importc: "sqlite3_column_table_name".}
  231. proc column_name16*(para1: Pstmt, para2: int32): pointer{.cdecl, dynlib: Lib,
  232. importc: "sqlite3_column_name16".}
  233. proc column_decltype*(para1: Pstmt, i: int32): cstring{.cdecl, dynlib: Lib,
  234. importc: "sqlite3_column_decltype".}
  235. proc column_decltype16*(para1: Pstmt, para2: int32): pointer{.cdecl,
  236. dynlib: Lib, importc: "sqlite3_column_decltype16".}
  237. proc step*(para1: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_step".}
  238. proc data_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
  239. importc: "sqlite3_data_count".}
  240. proc column_blob*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
  241. importc: "sqlite3_column_blob".}
  242. proc column_bytes*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  243. importc: "sqlite3_column_bytes".}
  244. proc column_bytes16*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  245. importc: "sqlite3_column_bytes16".}
  246. proc column_double*(para1: Pstmt, iCol: int32): float64{.cdecl, dynlib: Lib,
  247. importc: "sqlite3_column_double".}
  248. proc column_int*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  249. importc: "sqlite3_column_int".}
  250. proc column_int64*(para1: Pstmt, iCol: int32): int64{.cdecl, dynlib: Lib,
  251. importc: "sqlite3_column_int64".}
  252. proc column_text*(para1: Pstmt, iCol: int32): cstring{.cdecl, dynlib: Lib,
  253. importc: "sqlite3_column_text".}
  254. proc column_text16*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
  255. importc: "sqlite3_column_text16".}
  256. proc column_type*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  257. importc: "sqlite3_column_type".}
  258. proc finalize*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
  259. importc: "sqlite3_finalize".}
  260. proc reset*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_reset".}
  261. proc create_function*(para1: PSqlite3, zFunctionName: cstring, nArg: int32,
  262. eTextRep: int32, para5: pointer,
  263. xFunc: Create_function_func_func,
  264. xStep: Create_function_step_func,
  265. xFinal: Create_function_final_func): int32{.cdecl,
  266. dynlib: Lib, importc: "sqlite3_create_function".}
  267. proc create_function16*(para1: PSqlite3, zFunctionName: pointer, nArg: int32,
  268. eTextRep: int32, para5: pointer,
  269. xFunc: Create_function_func_func,
  270. xStep: Create_function_step_func,
  271. xFinal: Create_function_final_func): int32{.cdecl,
  272. dynlib: Lib, importc: "sqlite3_create_function16".}
  273. proc aggregate_count*(para1: Pcontext): int32{.cdecl, dynlib: Lib,
  274. importc: "sqlite3_aggregate_count".}
  275. proc value_blob*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  276. importc: "sqlite3_value_blob".}
  277. proc value_bytes*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  278. importc: "sqlite3_value_bytes".}
  279. proc value_bytes16*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  280. importc: "sqlite3_value_bytes16".}
  281. proc value_double*(para1: Pvalue): float64{.cdecl, dynlib: Lib,
  282. importc: "sqlite3_value_double".}
  283. proc value_int*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  284. importc: "sqlite3_value_int".}
  285. proc value_int64*(para1: Pvalue): int64{.cdecl, dynlib: Lib,
  286. importc: "sqlite3_value_int64".}
  287. proc value_text*(para1: Pvalue): cstring{.cdecl, dynlib: Lib,
  288. importc: "sqlite3_value_text".}
  289. proc value_text16*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  290. importc: "sqlite3_value_text16".}
  291. proc value_text16le*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  292. importc: "sqlite3_value_text16le".}
  293. proc value_text16be*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  294. importc: "sqlite3_value_text16be".}
  295. proc value_type*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  296. importc: "sqlite3_value_type".}
  297. proc aggregate_context*(para1: Pcontext, nBytes: int32): pointer{.cdecl,
  298. dynlib: Lib, importc: "sqlite3_aggregate_context".}
  299. proc user_data*(para1: Pcontext): pointer{.cdecl, dynlib: Lib,
  300. importc: "sqlite3_user_data".}
  301. proc get_auxdata*(para1: Pcontext, para2: int32): pointer{.cdecl, dynlib: Lib,
  302. importc: "sqlite3_get_auxdata".}
  303. proc set_auxdata*(para1: Pcontext, para2: int32, para3: pointer,
  304. para4: proc (para1: pointer){.cdecl.}){.cdecl, dynlib: Lib,
  305. importc: "sqlite3_set_auxdata".}
  306. proc result_blob*(para1: Pcontext, para2: pointer, para3: int32,
  307. para4: Result_func){.cdecl, dynlib: Lib,
  308. importc: "sqlite3_result_blob".}
  309. proc result_double*(para1: Pcontext, para2: float64){.cdecl, dynlib: Lib,
  310. importc: "sqlite3_result_double".}
  311. proc result_error*(para1: Pcontext, para2: cstring, para3: int32){.cdecl,
  312. dynlib: Lib, importc: "sqlite3_result_error".}
  313. proc result_error16*(para1: Pcontext, para2: pointer, para3: int32){.cdecl,
  314. dynlib: Lib, importc: "sqlite3_result_error16".}
  315. proc result_int*(para1: Pcontext, para2: int32){.cdecl, dynlib: Lib,
  316. importc: "sqlite3_result_int".}
  317. proc result_int64*(para1: Pcontext, para2: int64){.cdecl, dynlib: Lib,
  318. importc: "sqlite3_result_int64".}
  319. proc result_null*(para1: Pcontext){.cdecl, dynlib: Lib,
  320. importc: "sqlite3_result_null".}
  321. proc result_text*(para1: Pcontext, para2: cstring, para3: int32,
  322. para4: Result_func){.cdecl, dynlib: Lib,
  323. importc: "sqlite3_result_text".}
  324. proc result_text16*(para1: Pcontext, para2: pointer, para3: int32,
  325. para4: Result_func){.cdecl, dynlib: Lib,
  326. importc: "sqlite3_result_text16".}
  327. proc result_text16le*(para1: Pcontext, para2: pointer, para3: int32,
  328. para4: Result_func){.cdecl, dynlib: Lib,
  329. importc: "sqlite3_result_text16le".}
  330. proc result_text16be*(para1: Pcontext, para2: pointer, para3: int32,
  331. para4: Result_func){.cdecl, dynlib: Lib,
  332. importc: "sqlite3_result_text16be".}
  333. proc result_value*(para1: Pcontext, para2: Pvalue){.cdecl, dynlib: Lib,
  334. importc: "sqlite3_result_value".}
  335. proc create_collation*(para1: PSqlite3, zName: cstring, eTextRep: int32,
  336. para4: pointer, xCompare: Create_collation_func): int32{.
  337. cdecl, dynlib: Lib, importc: "sqlite3_create_collation".}
  338. proc create_collation16*(para1: PSqlite3, zName: cstring, eTextRep: int32,
  339. para4: pointer, xCompare: Create_collation_func): int32{.
  340. cdecl, dynlib: Lib, importc: "sqlite3_create_collation16".}
  341. proc collation_needed*(para1: PSqlite3, para2: pointer, para3: Collation_needed_func): int32{.
  342. cdecl, dynlib: Lib, importc: "sqlite3_collation_needed".}
  343. proc collation_needed16*(para1: PSqlite3, para2: pointer, para3: Collation_needed_func): int32{.
  344. cdecl, dynlib: Lib, importc: "sqlite3_collation_needed16".}
  345. proc libversion*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
  346. #Alias for allowing better code portability (win32 is not working with external variables)
  347. proc version*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
  348. # Not published functions
  349. proc libversion_number*(): int32{.cdecl, dynlib: Lib,
  350. importc: "sqlite3_libversion_number".}
  351. #function sqlite3_key(db:Psqlite3; pKey:pointer; nKey:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_key';
  352. #function sqlite3_rekey(db:Psqlite3; pKey:pointer; nKey:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_rekey';
  353. #function sqlite3_sleep(_para1:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_sleep';
  354. #function sqlite3_expired(_para1:Psqlite3_stmt):longint;cdecl; external Sqlite3Lib name 'sqlite3_expired';
  355. #function sqlite3_global_recover:longint;cdecl; external Sqlite3Lib name 'sqlite3_global_recover';
  356. # implementation