sqlite3.nim 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. {.deprecated: [TSqlite3: Sqlite3, TContext: Context, Tvalue: Value,
  121. Tcallback: Callback, Tcreate_function_step_func: Create_function_step_func,
  122. Tcreate_function_func_func: Create_function_func_func,
  123. Tcreate_function_final_func: Create_function_final_func,
  124. Tresult_func: Result_func, Tcreate_collation_func: Create_collation_func,
  125. Tcollation_needed_func: Collation_needed_func].}
  126. const
  127. SQLITE_STATIC* = nil
  128. SQLITE_TRANSIENT* = cast[Tbind_destructor_func](-1)
  129. proc close*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_close".}
  130. proc exec*(para1: PSqlite3, sql: cstring, para3: Callback, para4: pointer,
  131. errmsg: var cstring): int32{.cdecl, dynlib: Lib,
  132. importc: "sqlite3_exec".}
  133. proc last_insert_rowid*(para1: PSqlite3): int64{.cdecl, dynlib: Lib,
  134. importc: "sqlite3_last_insert_rowid".}
  135. proc changes*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_changes".}
  136. proc total_changes*(para1: PSqlite3): int32{.cdecl, dynlib: Lib,
  137. importc: "sqlite3_total_changes".}
  138. proc interrupt*(para1: PSqlite3){.cdecl, dynlib: Lib, importc: "sqlite3_interrupt".}
  139. proc complete*(sql: cstring): int32{.cdecl, dynlib: Lib,
  140. importc: "sqlite3_complete".}
  141. proc complete16*(sql: pointer): int32{.cdecl, dynlib: Lib,
  142. importc: "sqlite3_complete16".}
  143. proc busy_handler*(para1: PSqlite3,
  144. para2: proc (para1: pointer, para2: int32): int32{.cdecl.},
  145. para3: pointer): int32{.cdecl, dynlib: Lib,
  146. importc: "sqlite3_busy_handler".}
  147. proc busy_timeout*(para1: PSqlite3, ms: int32): int32{.cdecl, dynlib: Lib,
  148. importc: "sqlite3_busy_timeout".}
  149. proc get_table*(para1: PSqlite3, sql: cstring, resultp: var cstringArray,
  150. nrow, ncolumn: var cint, errmsg: ptr cstring): int32{.cdecl,
  151. dynlib: Lib, importc: "sqlite3_get_table".}
  152. proc free_table*(result: cstringArray){.cdecl, dynlib: Lib,
  153. importc: "sqlite3_free_table".}
  154. # Todo: see how translate sqlite3_mprintf, sqlite3_vmprintf, sqlite3_snprintf
  155. # function sqlite3_mprintf(_para1:Pchar; args:array of const):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_mprintf';
  156. proc mprintf*(para1: cstring): cstring{.cdecl, varargs, dynlib: Lib,
  157. importc: "sqlite3_mprintf".}
  158. #function sqlite3_vmprintf(_para1:Pchar; _para2:va_list):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_vmprintf';
  159. proc free*(z: cstring){.cdecl, dynlib: Lib, importc: "sqlite3_free".}
  160. #function sqlite3_snprintf(_para1:longint; _para2:Pchar; _para3:Pchar; args:array of const):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_snprintf';
  161. proc snprintf*(para1: int32, para2: cstring, para3: cstring): cstring{.cdecl,
  162. dynlib: Lib, varargs, importc: "sqlite3_snprintf".}
  163. proc set_authorizer*(para1: PSqlite3, xAuth: proc (para1: pointer, para2: int32,
  164. para3: cstring, para4: cstring, para5: cstring, para6: cstring): int32{.
  165. cdecl.}, pUserData: pointer): int32{.cdecl, dynlib: Lib,
  166. importc: "sqlite3_set_authorizer".}
  167. proc trace*(para1: PSqlite3, xTrace: proc (para1: pointer, para2: cstring){.cdecl.},
  168. para3: pointer): pointer{.cdecl, dynlib: Lib,
  169. importc: "sqlite3_trace".}
  170. proc progress_handler*(para1: PSqlite3, para2: int32,
  171. para3: proc (para1: pointer): int32{.cdecl.},
  172. para4: pointer){.cdecl, dynlib: Lib,
  173. importc: "sqlite3_progress_handler".}
  174. proc commit_hook*(para1: PSqlite3, para2: proc (para1: pointer): int32{.cdecl.},
  175. para3: pointer): pointer{.cdecl, dynlib: Lib,
  176. importc: "sqlite3_commit_hook".}
  177. proc open*(filename: cstring, ppDb: var PSqlite3): int32{.cdecl, dynlib: Lib,
  178. importc: "sqlite3_open".}
  179. proc open16*(filename: pointer, ppDb: var PSqlite3): int32{.cdecl, dynlib: Lib,
  180. importc: "sqlite3_open16".}
  181. proc errcode*(db: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_errcode".}
  182. proc errmsg*(para1: PSqlite3): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_errmsg".}
  183. proc errmsg16*(para1: PSqlite3): pointer{.cdecl, dynlib: Lib,
  184. importc: "sqlite3_errmsg16".}
  185. proc prepare*(db: PSqlite3, zSql: cstring, nBytes: int32, ppStmt: var Pstmt,
  186. pzTail: ptr cstring): int32{.cdecl, dynlib: Lib,
  187. importc: "sqlite3_prepare".}
  188. proc prepare_v2*(db: PSqlite3, zSql: cstring, nByte: cint, ppStmt: var Pstmt,
  189. pzTail: ptr cstring): cint {.
  190. importc: "sqlite3_prepare_v2", cdecl, dynlib: Lib.}
  191. proc prepare16*(db: PSqlite3, zSql: pointer, nBytes: int32, ppStmt: var Pstmt,
  192. pzTail: var pointer): int32{.cdecl, dynlib: Lib,
  193. importc: "sqlite3_prepare16".}
  194. proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
  195. para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
  196. importc: "sqlite3_bind_blob".}
  197. proc bind_double*(para1: Pstmt, para2: int32, para3: float64): int32{.cdecl,
  198. dynlib: Lib, importc: "sqlite3_bind_double".}
  199. proc bind_int*(para1: Pstmt, para2: int32, para3: int32): int32{.cdecl,
  200. dynlib: Lib, importc: "sqlite3_bind_int".}
  201. proc bind_int64*(para1: Pstmt, para2: int32, para3: int64): int32{.cdecl,
  202. dynlib: Lib, importc: "sqlite3_bind_int64".}
  203. proc bind_null*(para1: Pstmt, para2: int32): int32{.cdecl, dynlib: Lib,
  204. importc: "sqlite3_bind_null".}
  205. proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
  206. para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
  207. importc: "sqlite3_bind_text".}
  208. proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
  209. para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
  210. importc: "sqlite3_bind_text16".}
  211. #function sqlite3_bind_value(_para1:Psqlite3_stmt; _para2:longint; _para3:Psqlite3_value):longint;cdecl; external Sqlite3Lib name 'sqlite3_bind_value';
  212. #These overloaded functions were introduced to allow the use of SQLITE_STATIC and SQLITE_TRANSIENT
  213. #It's the c world man ;-)
  214. proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
  215. para5: int32): int32{.cdecl, dynlib: Lib,
  216. importc: "sqlite3_bind_blob".}
  217. proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
  218. para5: int32): int32{.cdecl, dynlib: Lib,
  219. importc: "sqlite3_bind_text".}
  220. proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
  221. para5: int32): int32{.cdecl, dynlib: Lib,
  222. importc: "sqlite3_bind_text16".}
  223. proc bind_parameter_count*(para1: Pstmt): int32{.cdecl, dynlib: Lib,
  224. importc: "sqlite3_bind_parameter_count".}
  225. proc bind_parameter_name*(para1: Pstmt, para2: int32): cstring{.cdecl,
  226. dynlib: Lib, importc: "sqlite3_bind_parameter_name".}
  227. proc bind_parameter_index*(para1: Pstmt, zName: cstring): int32{.cdecl,
  228. dynlib: Lib, importc: "sqlite3_bind_parameter_index".}
  229. proc clear_bindings*(para1: Pstmt): int32 {.cdecl,
  230. dynlib: Lib, importc: "sqlite3_clear_bindings".}
  231. proc column_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
  232. importc: "sqlite3_column_count".}
  233. proc column_name*(para1: Pstmt, para2: int32): cstring{.cdecl, dynlib: Lib,
  234. importc: "sqlite3_column_name".}
  235. proc column_table_name*(para1: Pstmt; para2: int32): cstring{.cdecl, dynlib: Lib,
  236. importc: "sqlite3_column_table_name".}
  237. proc column_name16*(para1: Pstmt, para2: int32): pointer{.cdecl, dynlib: Lib,
  238. importc: "sqlite3_column_name16".}
  239. proc column_decltype*(para1: Pstmt, i: int32): cstring{.cdecl, dynlib: Lib,
  240. importc: "sqlite3_column_decltype".}
  241. proc column_decltype16*(para1: Pstmt, para2: int32): pointer{.cdecl,
  242. dynlib: Lib, importc: "sqlite3_column_decltype16".}
  243. proc step*(para1: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_step".}
  244. proc data_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
  245. importc: "sqlite3_data_count".}
  246. proc column_blob*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
  247. importc: "sqlite3_column_blob".}
  248. proc column_bytes*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  249. importc: "sqlite3_column_bytes".}
  250. proc column_bytes16*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  251. importc: "sqlite3_column_bytes16".}
  252. proc column_double*(para1: Pstmt, iCol: int32): float64{.cdecl, dynlib: Lib,
  253. importc: "sqlite3_column_double".}
  254. proc column_int*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  255. importc: "sqlite3_column_int".}
  256. proc column_int64*(para1: Pstmt, iCol: int32): int64{.cdecl, dynlib: Lib,
  257. importc: "sqlite3_column_int64".}
  258. proc column_text*(para1: Pstmt, iCol: int32): cstring{.cdecl, dynlib: Lib,
  259. importc: "sqlite3_column_text".}
  260. proc column_text16*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
  261. importc: "sqlite3_column_text16".}
  262. proc column_type*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
  263. importc: "sqlite3_column_type".}
  264. proc finalize*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
  265. importc: "sqlite3_finalize".}
  266. proc reset*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_reset".}
  267. proc create_function*(para1: PSqlite3, zFunctionName: cstring, 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_function".}
  273. proc create_function16*(para1: PSqlite3, zFunctionName: pointer, nArg: int32,
  274. eTextRep: int32, para5: pointer,
  275. xFunc: Create_function_func_func,
  276. xStep: Create_function_step_func,
  277. xFinal: Create_function_final_func): int32{.cdecl,
  278. dynlib: Lib, importc: "sqlite3_create_function16".}
  279. proc aggregate_count*(para1: Pcontext): int32{.cdecl, dynlib: Lib,
  280. importc: "sqlite3_aggregate_count".}
  281. proc value_blob*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  282. importc: "sqlite3_value_blob".}
  283. proc value_bytes*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  284. importc: "sqlite3_value_bytes".}
  285. proc value_bytes16*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  286. importc: "sqlite3_value_bytes16".}
  287. proc value_double*(para1: Pvalue): float64{.cdecl, dynlib: Lib,
  288. importc: "sqlite3_value_double".}
  289. proc value_int*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  290. importc: "sqlite3_value_int".}
  291. proc value_int64*(para1: Pvalue): int64{.cdecl, dynlib: Lib,
  292. importc: "sqlite3_value_int64".}
  293. proc value_text*(para1: Pvalue): cstring{.cdecl, dynlib: Lib,
  294. importc: "sqlite3_value_text".}
  295. proc value_text16*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  296. importc: "sqlite3_value_text16".}
  297. proc value_text16le*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  298. importc: "sqlite3_value_text16le".}
  299. proc value_text16be*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
  300. importc: "sqlite3_value_text16be".}
  301. proc value_type*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
  302. importc: "sqlite3_value_type".}
  303. proc aggregate_context*(para1: Pcontext, nBytes: int32): pointer{.cdecl,
  304. dynlib: Lib, importc: "sqlite3_aggregate_context".}
  305. proc user_data*(para1: Pcontext): pointer{.cdecl, dynlib: Lib,
  306. importc: "sqlite3_user_data".}
  307. proc get_auxdata*(para1: Pcontext, para2: int32): pointer{.cdecl, dynlib: Lib,
  308. importc: "sqlite3_get_auxdata".}
  309. proc set_auxdata*(para1: Pcontext, para2: int32, para3: pointer,
  310. para4: proc (para1: pointer){.cdecl.}){.cdecl, dynlib: Lib,
  311. importc: "sqlite3_set_auxdata".}
  312. proc result_blob*(para1: Pcontext, para2: pointer, para3: int32,
  313. para4: Result_func){.cdecl, dynlib: Lib,
  314. importc: "sqlite3_result_blob".}
  315. proc result_double*(para1: Pcontext, para2: float64){.cdecl, dynlib: Lib,
  316. importc: "sqlite3_result_double".}
  317. proc result_error*(para1: Pcontext, para2: cstring, para3: int32){.cdecl,
  318. dynlib: Lib, importc: "sqlite3_result_error".}
  319. proc result_error16*(para1: Pcontext, para2: pointer, para3: int32){.cdecl,
  320. dynlib: Lib, importc: "sqlite3_result_error16".}
  321. proc result_int*(para1: Pcontext, para2: int32){.cdecl, dynlib: Lib,
  322. importc: "sqlite3_result_int".}
  323. proc result_int64*(para1: Pcontext, para2: int64){.cdecl, dynlib: Lib,
  324. importc: "sqlite3_result_int64".}
  325. proc result_null*(para1: Pcontext){.cdecl, dynlib: Lib,
  326. importc: "sqlite3_result_null".}
  327. proc result_text*(para1: Pcontext, para2: cstring, para3: int32,
  328. para4: Result_func){.cdecl, dynlib: Lib,
  329. importc: "sqlite3_result_text".}
  330. proc result_text16*(para1: Pcontext, para2: pointer, para3: int32,
  331. para4: Result_func){.cdecl, dynlib: Lib,
  332. importc: "sqlite3_result_text16".}
  333. proc result_text16le*(para1: Pcontext, para2: pointer, para3: int32,
  334. para4: Result_func){.cdecl, dynlib: Lib,
  335. importc: "sqlite3_result_text16le".}
  336. proc result_text16be*(para1: Pcontext, para2: pointer, para3: int32,
  337. para4: Result_func){.cdecl, dynlib: Lib,
  338. importc: "sqlite3_result_text16be".}
  339. proc result_value*(para1: Pcontext, para2: Pvalue){.cdecl, dynlib: Lib,
  340. importc: "sqlite3_result_value".}
  341. proc create_collation*(para1: PSqlite3, zName: cstring, eTextRep: int32,
  342. para4: pointer, xCompare: Create_collation_func): int32{.
  343. cdecl, dynlib: Lib, importc: "sqlite3_create_collation".}
  344. proc create_collation16*(para1: PSqlite3, zName: cstring, eTextRep: int32,
  345. para4: pointer, xCompare: Create_collation_func): int32{.
  346. cdecl, dynlib: Lib, importc: "sqlite3_create_collation16".}
  347. proc collation_needed*(para1: PSqlite3, para2: pointer, para3: Collation_needed_func): int32{.
  348. cdecl, dynlib: Lib, importc: "sqlite3_collation_needed".}
  349. proc collation_needed16*(para1: PSqlite3, para2: pointer, para3: Collation_needed_func): int32{.
  350. cdecl, dynlib: Lib, importc: "sqlite3_collation_needed16".}
  351. proc libversion*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
  352. #Alias for allowing better code portability (win32 is not working with external variables)
  353. proc version*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
  354. # Not published functions
  355. proc libversion_number*(): int32{.cdecl, dynlib: Lib,
  356. importc: "sqlite3_libversion_number".}
  357. #function sqlite3_key(db:Psqlite3; pKey:pointer; nKey:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_key';
  358. #function sqlite3_rekey(db:Psqlite3; pKey:pointer; nKey:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_rekey';
  359. #function sqlite3_sleep(_para1:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_sleep';
  360. #function sqlite3_expired(_para1:Psqlite3_stmt):longint;cdecl; external Sqlite3Lib name 'sqlite3_expired';
  361. #function sqlite3_global_recover:longint;cdecl; external Sqlite3Lib name 'sqlite3_global_recover';
  362. # implementation