sqlite3.nim 20 KB

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