From 5ee3bcc0da2b0a1b164cc2196afccc4784a32f70 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Wed, 15 Nov 2023 15:53:45 +0100 Subject: [PATCH] fix wasm tests --- Cargo.lock | 1030 ++++- libsql-ffi/Cargo.toml | 2 + libsql-ffi/build.rs | 19 +- .../bundled/bindings/session_bindgen.rs | 3931 ----------------- libsql-ffi/src/lib.rs | 5 + libsql-sqlite3/test/rust_suite/Cargo.toml | 8 +- .../test/rust_suite/src/alter_column.rs | 6 +- libsql-sqlite3/test/rust_suite/src/lib.rs | 26 +- .../test/rust_suite/src/random_rowid.rs | 2 +- .../test/rust_suite/src/virtual_wal.rs | 523 +-- libsql-sys/Cargo.toml | 1 + libsql-sys/src/lib.rs | 3 + libsql-sys/src/wal/ffi.rs | 4 +- libsql-sys/src/wal/mod.rs | 1 + libsql-sys/src/wal_hook.rs | 452 -- 15 files changed, 1197 insertions(+), 4816 deletions(-) delete mode 100644 libsql-ffi/bundled/bindings/session_bindgen.rs delete mode 100644 libsql-sys/src/wal_hook.rs diff --git a/Cargo.lock b/Cargo.lock index 4dbeaa0e0f..a2a87a976b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,13 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.3", +] + [[package]] name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli", + "gimli 0.28.0", ] [[package]] @@ -30,6 +39,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -60,6 +78,12 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -181,8 +205,8 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", - "zstd", - "zstd-safe", + "zstd 0.13.0", + "zstd-safe 7.0.0", ] [[package]] @@ -701,12 +725,12 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.1", "rustc-demangle", ] @@ -934,6 +958,69 @@ dependencies = [ "serde", ] +[[package]] +name = "cap-fs-ext" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc48200a1a0fa6fba138b1802ad7def18ec1cdd92f7b2a04e21f1bd887f7b9" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes 1.0.11", + "windows-sys 0.48.0", +] + +[[package]] +name = "cap-primitives" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b6df5b295dca8d56f35560be8c391d59f0420f72e546997154e24e765e6451" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes 1.0.11", + "ipnet", + "maybe-owned", + "rustix 0.37.27", + "windows-sys 0.48.0", + "winx 0.35.1", +] + +[[package]] +name = "cap-rand" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25555efacb0b5244cf1d35833d55d21abc916fff0eaad254b8e2453ea9b8ab" +dependencies = [ + "ambient-authority", + "rand", +] + +[[package]] +name = "cap-std" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3373a62accd150b4fcba056d4c5f3b552127f0ec86d3c8c102d60b978174a012" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes 1.0.11", + "rustix 0.37.27", +] + +[[package]] +name = "cap-time-ext" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e95002993b7baee6b66c8950470e59e5226a23b3af39fc59c47fe416dd39821a" +dependencies = [ + "cap-primitives", + "once_cell", + "rustix 0.37.27", + "winx 0.35.1", +] + [[package]] name = "cast" version = "0.3.0" @@ -1203,6 +1290,15 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpp_demangle" version = "0.4.3" @@ -1221,6 +1317,114 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "182b82f78049f54d3aee5a19870d356ef754226665a695ce2fcdd5d55379718e" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c027bf04ecae5b048d3554deb888061bc26f426afff47bf06d6ac933dce0a6" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli 0.27.3", + "hashbrown 0.13.2", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "649f70038235e4c81dba5680d7e5ae83e1081f567232425ab98b55b03afd9904" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a1d1c5ee2611c6a0bdc8d42d5d3dc5ce8bf53a8040561e26e88b9b21f966417" + +[[package]] +name = "cranelift-control" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da66a68b1f48da863d1d53209b8ddb1a6236411d2d72a280ffa8c2f734f7219e" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd897422dbb66621fa558f4d9209875530c53e3c8f4b13b2849fbb667c431a6" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-frontend" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05db883114c98cfcd6959f72278d2fec42e01ea6a6982cfe4f20e88eebe86653" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84559de86e2564152c87e299c8b2559f9107e9c6d274b24ebeb04fb0a5f4abf8" + +[[package]] +name = "cranelift-native" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f40b57f187f0fe1ffaf281df4adba2b4bc623a0f6651954da9f3c184be72761" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.96.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3eab6084cc789b9dd0b1316241efeb2968199fee709f4bb4fe0fb0923bb468b" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.10.5", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + [[package]] name = "crc" version = "3.0.1" @@ -1412,6 +1616,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -1422,6 +1645,17 @@ dependencies = [ "dirs-sys-next", ] +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -1557,10 +1791,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix", + "rustix 0.38.21", + "windows-sys 0.48.0", +] + +[[package]] +name = "fd-lock" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b0377f1edc77dbd1118507bc7a66e4ab64d2b90c66f90726dc801e73a8c68f9" +dependencies = [ + "cfg-if", + "rustix 0.38.21", "windows-sys 0.48.0", ] +[[package]] +name = "file-per-thread-logger" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" +dependencies = [ + "env_logger", + "log", +] + [[package]] name = "findshlibs" version = "0.10.2" @@ -1604,6 +1859,17 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-set-times" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d167b646a876ba8fda6b50ac645cfd96242553cbaf0ca4fccaa39afcbf0801f" +dependencies = [ + "io-lifetimes 1.0.11", + "rustix 0.38.21", + "windows-sys 0.48.0", +] + [[package]] name = "futures" version = "0.3.29" @@ -1693,6 +1959,28 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags 2.4.1", + "debugid", + "fxhash", + "serde", + "serde_json", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1714,6 +2002,17 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +dependencies = [ + "fallible-iterator 0.2.0", + "indexmap 1.9.3", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.28.0" @@ -1759,9 +2058,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash", ] @@ -2032,6 +2331,12 @@ dependencies = [ "cc", ] +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + [[package]] name = "idna" version = "0.4.0" @@ -2050,6 +2355,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", + "serde", ] [[package]] @@ -2103,6 +2409,33 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-extras" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde93d48f0d9277f977a333eca8313695ddd5301dc96f7e02aeddcb0dd99096f" +dependencies = [ + "io-lifetimes 1.0.11", + "windows-sys 0.48.0", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.3", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "io-lifetimes" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffb4def18c48926ccac55c1223e02865ce1a821751a95920448662696e7472c" + [[package]] name = "ipnet" version = "2.9.0" @@ -2116,7 +2449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix", + "rustix 0.38.21", "windows-sys 0.48.0", ] @@ -2144,6 +2477,26 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "ittapi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a5c0b993601cad796222ea076565c5d9f337d35592f8622c753724f06d7271" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7b5e473765060536a660eed127f758cf1a810c73e49063264959c60d1727d9" +dependencies = [ + "cc", +] + [[package]] name = "jobserver" version = "0.1.27" @@ -2188,6 +2541,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.149" @@ -2282,6 +2641,7 @@ version = "0.1.0" dependencies = [ "bindgen", "cc", + "libsql-wasmtime-bindings", ] [[package]] @@ -2345,12 +2705,28 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "libsql-wasmtime-bindings" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4794ff21e37f83839dad45f8c7977b071315f18705cf73badc9850b9fb6b6f" +dependencies = [ + "wasmtime", + "wasmtime-wasi", +] + [[package]] name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "linux-raw-sys" version = "0.4.10" @@ -2373,6 +2749,15 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "mach2" version = "0.4.1" @@ -2403,6 +2788,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + [[package]] name = "md-5" version = "0.10.6" @@ -2419,6 +2810,15 @@ version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.21", +] + [[package]] name = "memmap2" version = "0.8.0" @@ -2439,7 +2839,16 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ @@ -2488,14 +2897,14 @@ dependencies = [ [[package]] name = "metrics-util" -version = "0.15.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" +checksum = "111cb375987443c3de8d503580b536f77dc8416d32db62d9456db5d93bd7ac47" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.20", "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.13.1", + "hashbrown 0.13.2", "indexmap 1.9.3", "metrics", "num_cpus", @@ -2654,6 +3063,18 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.30.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "memchr", +] + [[package]] name = "object" version = "0.32.1" @@ -2751,6 +3172,12 @@ dependencies = [ "regex", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -3063,6 +3490,26 @@ dependencies = [ "autotools", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "pulldown-cmark" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + [[package]] name = "quanta" version = "0.11.1" @@ -3220,13 +3667,26 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regalloc2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a52e724646c6c0800fc456ec43b4165d2f91fba88ceaca06d9e0b400023478" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + [[package]] name = "regex" version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.2", "memchr", "regex-automata 0.4.3", "regex-syntax 0.8.2", @@ -3247,7 +3707,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.2", "memchr", "regex-syntax 0.8.2", ] @@ -3393,6 +3853,22 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes 1.0.11", + "itoa", + "libc", + "linux-raw-sys 0.3.8", + "once_cell", + "windows-sys 0.48.0", +] + [[package]] name = "rustix" version = "0.38.21" @@ -3402,7 +3878,7 @@ dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.10", "windows-sys 0.48.0", ] @@ -3489,7 +3965,7 @@ dependencies = [ "cfg-if", "clipboard-win", "dirs-next", - "fd-lock", + "fd-lock 3.0.13", "libc", "log", "memchr", @@ -3697,6 +4173,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shellexpand" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +dependencies = [ + "dirs", +] + [[package]] name = "shlex" version = "1.2.0" @@ -3751,6 +4236,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + [[package]] name = "smallvec" version = "1.11.1" @@ -3951,7 +4442,7 @@ version = "12.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bdcf77effe2908a21c1011b4d49a7122e0f44487a6ad89db67c55a1687e2572" dependencies = [ - "cpp_demangle", + "cpp_demangle 0.4.3", "rustc-demangle", "symbolic-common", ] @@ -4005,6 +4496,22 @@ dependencies = [ "libc", ] +[[package]] +name = "system-interface" +version = "0.25.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10081a99cbecbc363d381b9503563785f0b02735fccbb0d4c1a2cb3d39f7e7fe" +dependencies = [ + "bitflags 2.4.1", + "cap-fs-ext", + "cap-std", + "fd-lock 4.0.0", + "io-lifetimes 2.0.2", + "rustix 0.38.21", + "windows-sys 0.48.0", + "winx 0.36.2", +] + [[package]] name = "tabled" version = "0.12.2" @@ -4029,6 +4536,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "target-lexicon" +version = "0.12.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" + [[package]] name = "tempfile" version = "3.8.1" @@ -4038,7 +4551,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix", + "rustix 0.38.21", "windows-sys 0.48.0", ] @@ -4583,6 +5096,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "untrusted" version = "0.7.1" @@ -4698,6 +5217,50 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi-cap-std-sync" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d29c5da3b5cfc9212a7fa824224875cb67fb89d2a8392db655e4c59b8ab2ae7" +dependencies = [ + "anyhow", + "async-trait", + "cap-fs-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "io-extras", + "io-lifetimes 1.0.11", + "is-terminal", + "once_cell", + "rustix 0.37.27", + "system-interface", + "tracing", + "wasi-common", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasi-common" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8bd905dcec1448664bf63d42d291cbae0feeea3ad41631817b8819e096d76bd" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "cap-rand", + "cap-std", + "io-extras", + "log", + "rustix 0.37.27", + "thiserror", + "tracing", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + [[package]] name = "wasm-bindgen" version = "0.2.86" @@ -4764,6 +5327,15 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +[[package]] +name = "wasm-encoder" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d135e8940b69dbee0f5b0a0be9c1cd6fa8b71d774904c13a3fcfc5dc265e43d" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-streams" version = "0.3.0" @@ -4777,6 +5349,311 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c437373cac5ea84f1113d648d51f71751ffbe3d90c00ae67618cf20d0b5ee7b" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "wasmtime" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634357e8668774b24c80b210552f3f194e2342a065d6d83845ba22c5817d0770" +dependencies = [ + "anyhow", + "async-trait", + "bincode", + "bumpalo", + "cfg-if", + "fxprof-processed-profile", + "indexmap 1.9.3", + "libc", + "log", + "object 0.30.4", + "once_cell", + "paste", + "psm", + "rayon", + "serde", + "serde_json", + "target-lexicon", + "wasmparser", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit", + "wasmtime-runtime", + "wat", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d33c73c24ce79b0483a3b091a9acf88871f4490b88998e8974b22236264d304c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107809b2d9f5b2fd3ddbaddb3bb92ff8048b62f4030debf1408119ffd38c6cb" +dependencies = [ + "anyhow", + "base64 0.21.5", + "bincode", + "directories-next", + "file-per-thread-logger", + "log", + "rustix 0.37.27", + "serde", + "sha2", + "toml", + "windows-sys 0.48.0", + "zstd 0.11.2+zstd.1.5.2", +] + +[[package]] +name = "wasmtime-component-macro" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ba489850d9c91c6c5b9e1696ee89e7a69d9796236a005f7e9131b6746e13b6" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fa88f9e77d80f828c9d684741a9da649366c6d1cceb814755dd9cab7112d1d1" + +[[package]] +name = "wasmtime-cranelift" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5800616a28ed6bd5e8b99ea45646c956d798ae030494ac0689bc3e45d3b689c1" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.27.3", + "log", + "object 0.30.4", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-cranelift-shared", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27e4030b959ac5c5d6ee500078977e813f8768fa2b92fc12be01856cd0c76c55" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-native", + "gimli 0.27.3", + "object 0.30.4", + "target-lexicon", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec815d01a8d38aceb7ed4678f9ba551ae6b8a568a63810ac3ad9293b0fd01c8" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.27.3", + "indexmap 1.9.3", + "log", + "object 0.30.4", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23c5127908fdf720614891ec741c13dd70c844e102caa393e2faca1ee68e9bfb" +dependencies = [ + "cc", + "cfg-if", + "rustix 0.37.27", + "wasmtime-asm-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2712eafe829778b426cad0e1769fef944898923dd29f0039e34e0d53ba72b234" +dependencies = [ + "addr2line 0.19.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle 0.3.5", + "gimli 0.27.3", + "ittapi", + "log", + "object 0.30.4", + "rustc-demangle", + "serde", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fb78eacf4a6e47260d8ef8cc81ea8ddb91397b2e848b3fb01567adebfe89b5" +dependencies = [ + "object 0.30.4", + "once_cell", + "rustix 0.37.27", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1364900b05f7d6008516121e8e62767ddb3e176bdf4c84dfa85da1734aeab79" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a16ffe4de9ac9669175c0ea5c6c51ffc596dfb49320aaa6f6c57eff58cef069" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "mach", + "memfd", + "memoffset 0.8.0", + "paste", + "rand", + "rustix 0.37.27", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-types" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19961c9a3b04d5e766875a5c467f6f5d693f508b3e81f8dc4a1444aa94f041c9" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "wasmtime-wasi" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21080ff62878f1d7c53d9571053dbe96552c0f982f9f29eac65ea89974fabfd7" +dependencies = [ + "anyhow", + "libc", + "wasi-cap-std-sync", + "wasi-common", + "wasmtime", + "wiggle", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "421f0d16cc5c612b35ae53a0be3d3124c72296f18e5be3468263c745d56d37ab" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wast" +version = "35.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + +[[package]] +name = "wast" +version = "68.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bf3081ac6bcb3a5b72a401693b3566feb529dc2b7e7b62ea544c8a30d0f4d05" +dependencies = [ + "leb128", + "memchr", + "unicode-width", + "wasm-encoder", +] + +[[package]] +name = "wat" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fabe07d22a837b3bd5662ba9e980d73de115c040923659a1801934c7ccebe49" +dependencies = [ + "wast 68.0.0", +] + [[package]] name = "web-sys" version = "0.3.63" @@ -4812,7 +5689,49 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.21", +] + +[[package]] +name = "wiggle" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b34e40b7b17a920d03449ca78b0319984379eed01a9a11c1def9c3d3832d85a" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 1.3.2", + "thiserror", + "tracing", + "wasmtime", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eefda132eaa84fe5f15d23a55a912f8417385aee65d0141d78a3b65e46201ed" +dependencies = [ + "anyhow", + "heck", + "proc-macro2", + "quote", + "shellexpand", + "syn 1.0.109", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "9.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ca1a344a0ba781e2a94b27be5bb78f23e43d52336bd663b810d49d7189ad334" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "wiggle-generate", ] [[package]] @@ -4997,6 +5916,54 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winx" +version = "0.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c52a121f0fbf9320d5f2a9a5d82f6cb7557eda5e8b47fc3e7f359ec866ae960" +dependencies = [ + "bitflags 1.3.2", + "io-lifetimes 1.0.11", + "windows-sys 0.48.0", +] + +[[package]] +name = "winx" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357bb8e2932df531f83b052264b050b81ba0df90ee5a59b2d1d3949f344f81e5" +dependencies = [ + "bitflags 2.4.1", + "windows-sys 0.48.0", +] + +[[package]] +name = "wit-parser" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca2581061573ef6d1754983d7a9b3ed5871ef859d52708ea9a0f5af32919172" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 1.9.3", + "log", + "pulldown-cmark", + "unicode-xid", + "url", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror", + "wast 35.0.2", +] + [[package]] name = "worker" version = "0.0.18" @@ -5117,13 +6084,32 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe 5.0.2+zstd.1.5.2", +] + [[package]] name = "zstd" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ - "zstd-safe", + "zstd-safe 7.0.0", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", ] [[package]] diff --git a/libsql-ffi/Cargo.toml b/libsql-ffi/Cargo.toml index 32f22891e4..bfd0161178 100644 --- a/libsql-ffi/Cargo.toml +++ b/libsql-ffi/Cargo.toml @@ -7,6 +7,7 @@ build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +libsql-wasmtime-bindings = { version = "0.2.1", optional = true } [build-dependencies] bindgen = "0.66.1" @@ -14,3 +15,4 @@ cc = "1.0" [features] session = [] +wasmtime-bindings = ["dep:libsql-wasmtime-bindings"] diff --git a/libsql-ffi/build.rs b/libsql-ffi/build.rs index c7fa6f856d..5376598238 100644 --- a/libsql-ffi/build.rs +++ b/libsql-ffi/build.rs @@ -11,7 +11,7 @@ fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let out_path = Path::new(&out_dir).join("bindgen.rs"); println!("cargo:rerun-if-changed={BUNDLED_DIR}/src/"); - if std::env::var("LIBSQL_DEV").is_ok() { + if std::env::var("LIBSQL_DEV").is_ok() || cfg!(feature = "wasmtime-bindings") { println!("cargo:rerun-if-changed={SQLITE_DIR}/src/"); make_amalgation(); } @@ -20,9 +20,22 @@ fn main() { } fn make_amalgation() { + let flags = [ + "-DSQLITE_ENABLE_COLUMN_METADATA=1", + "-DSQLITE_ENABLE_WASM_RUNTIME=1", + ]; + + Command::new("make") + .current_dir(SQLITE_DIR) + .arg("clean") + .output() + .unwrap(); + Command::new("./configure") .current_dir(SQLITE_DIR) - .env("CFLAGS", "-DSQLITE_ENABLE_COLUMN_METADATA=1") + .env("CFLAGS", flags.join(" ")) + // .arg("--enable-all") + // .arg("--enable-wasm-runtime") .output() .unwrap(); Command::new("make") @@ -81,7 +94,7 @@ pub fn build_bundled(out_dir: &str, out_path: &Path) { .flag("-D_POSIX_THREAD_SAFE_FUNCTIONS") // cross compile with MinGW .warnings(false); - if cfg!(feature = "libsql-wasm-experimental") { + if cfg!(feature = "wasmtime-bindings") { cfg.flag("-DLIBSQL_ENABLE_WASM_RUNTIME=1"); } diff --git a/libsql-ffi/bundled/bindings/session_bindgen.rs b/libsql-ffi/bundled/bindings/session_bindgen.rs deleted file mode 100644 index b5e397cd3d..0000000000 --- a/libsql-ffi/bundled/bindings/session_bindgen.rs +++ /dev/null @@ -1,3931 +0,0 @@ -/* automatically generated by rust-bindgen 0.66.1 */ - -extern "C" { - pub fn sqlite3_auto_extension( - xEntryPoint: ::std::option::Option< - unsafe extern "C" fn( - db: *mut sqlite3, - pzErrMsg: *mut *const ::std::os::raw::c_char, - pThunk: *const sqlite3_api_routines, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_cancel_auto_extension( - xEntryPoint: ::std::option::Option< - unsafe extern "C" fn( - db: *mut sqlite3, - pzErrMsg: *mut *const ::std::os::raw::c_char, - pThunk: *const sqlite3_api_routines, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int; -} - -pub const SQLITE_VERSION: &[u8; 7] = b"3.43.0\0"; -pub const SQLITE_VERSION_NUMBER: i32 = 3043000; -pub const SQLITE_SOURCE_ID: &[u8; 85] = - b"2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468alt1\0"; -pub const LIBSQL_VERSION: &[u8; 6] = b"0.2.2\0"; -pub const SQLITE_OK: i32 = 0; -pub const SQLITE_ERROR: i32 = 1; -pub const SQLITE_INTERNAL: i32 = 2; -pub const SQLITE_PERM: i32 = 3; -pub const SQLITE_ABORT: i32 = 4; -pub const SQLITE_BUSY: i32 = 5; -pub const SQLITE_LOCKED: i32 = 6; -pub const SQLITE_NOMEM: i32 = 7; -pub const SQLITE_READONLY: i32 = 8; -pub const SQLITE_INTERRUPT: i32 = 9; -pub const SQLITE_IOERR: i32 = 10; -pub const SQLITE_CORRUPT: i32 = 11; -pub const SQLITE_NOTFOUND: i32 = 12; -pub const SQLITE_FULL: i32 = 13; -pub const SQLITE_CANTOPEN: i32 = 14; -pub const SQLITE_PROTOCOL: i32 = 15; -pub const SQLITE_EMPTY: i32 = 16; -pub const SQLITE_SCHEMA: i32 = 17; -pub const SQLITE_TOOBIG: i32 = 18; -pub const SQLITE_CONSTRAINT: i32 = 19; -pub const SQLITE_MISMATCH: i32 = 20; -pub const SQLITE_MISUSE: i32 = 21; -pub const SQLITE_NOLFS: i32 = 22; -pub const SQLITE_AUTH: i32 = 23; -pub const SQLITE_FORMAT: i32 = 24; -pub const SQLITE_RANGE: i32 = 25; -pub const SQLITE_NOTADB: i32 = 26; -pub const SQLITE_NOTICE: i32 = 27; -pub const SQLITE_WARNING: i32 = 28; -pub const SQLITE_ROW: i32 = 100; -pub const SQLITE_DONE: i32 = 101; -pub const SQLITE_ERROR_MISSING_COLLSEQ: i32 = 257; -pub const SQLITE_ERROR_RETRY: i32 = 513; -pub const SQLITE_ERROR_SNAPSHOT: i32 = 769; -pub const SQLITE_IOERR_READ: i32 = 266; -pub const SQLITE_IOERR_SHORT_READ: i32 = 522; -pub const SQLITE_IOERR_WRITE: i32 = 778; -pub const SQLITE_IOERR_FSYNC: i32 = 1034; -pub const SQLITE_IOERR_DIR_FSYNC: i32 = 1290; -pub const SQLITE_IOERR_TRUNCATE: i32 = 1546; -pub const SQLITE_IOERR_FSTAT: i32 = 1802; -pub const SQLITE_IOERR_UNLOCK: i32 = 2058; -pub const SQLITE_IOERR_RDLOCK: i32 = 2314; -pub const SQLITE_IOERR_DELETE: i32 = 2570; -pub const SQLITE_IOERR_BLOCKED: i32 = 2826; -pub const SQLITE_IOERR_NOMEM: i32 = 3082; -pub const SQLITE_IOERR_ACCESS: i32 = 3338; -pub const SQLITE_IOERR_CHECKRESERVEDLOCK: i32 = 3594; -pub const SQLITE_IOERR_LOCK: i32 = 3850; -pub const SQLITE_IOERR_CLOSE: i32 = 4106; -pub const SQLITE_IOERR_DIR_CLOSE: i32 = 4362; -pub const SQLITE_IOERR_SHMOPEN: i32 = 4618; -pub const SQLITE_IOERR_SHMSIZE: i32 = 4874; -pub const SQLITE_IOERR_SHMLOCK: i32 = 5130; -pub const SQLITE_IOERR_SHMMAP: i32 = 5386; -pub const SQLITE_IOERR_SEEK: i32 = 5642; -pub const SQLITE_IOERR_DELETE_NOENT: i32 = 5898; -pub const SQLITE_IOERR_MMAP: i32 = 6154; -pub const SQLITE_IOERR_GETTEMPPATH: i32 = 6410; -pub const SQLITE_IOERR_CONVPATH: i32 = 6666; -pub const SQLITE_IOERR_VNODE: i32 = 6922; -pub const SQLITE_IOERR_AUTH: i32 = 7178; -pub const SQLITE_IOERR_BEGIN_ATOMIC: i32 = 7434; -pub const SQLITE_IOERR_COMMIT_ATOMIC: i32 = 7690; -pub const SQLITE_IOERR_ROLLBACK_ATOMIC: i32 = 7946; -pub const SQLITE_IOERR_DATA: i32 = 8202; -pub const SQLITE_IOERR_CORRUPTFS: i32 = 8458; -pub const SQLITE_IOERR_IN_PAGE: i32 = 8714; -pub const SQLITE_LOCKED_SHAREDCACHE: i32 = 262; -pub const SQLITE_LOCKED_VTAB: i32 = 518; -pub const SQLITE_BUSY_RECOVERY: i32 = 261; -pub const SQLITE_BUSY_SNAPSHOT: i32 = 517; -pub const SQLITE_BUSY_TIMEOUT: i32 = 773; -pub const SQLITE_CANTOPEN_NOTEMPDIR: i32 = 270; -pub const SQLITE_CANTOPEN_ISDIR: i32 = 526; -pub const SQLITE_CANTOPEN_FULLPATH: i32 = 782; -pub const SQLITE_CANTOPEN_CONVPATH: i32 = 1038; -pub const SQLITE_CANTOPEN_DIRTYWAL: i32 = 1294; -pub const SQLITE_CANTOPEN_SYMLINK: i32 = 1550; -pub const SQLITE_CORRUPT_VTAB: i32 = 267; -pub const SQLITE_CORRUPT_SEQUENCE: i32 = 523; -pub const SQLITE_CORRUPT_INDEX: i32 = 779; -pub const SQLITE_READONLY_RECOVERY: i32 = 264; -pub const SQLITE_READONLY_CANTLOCK: i32 = 520; -pub const SQLITE_READONLY_ROLLBACK: i32 = 776; -pub const SQLITE_READONLY_DBMOVED: i32 = 1032; -pub const SQLITE_READONLY_CANTINIT: i32 = 1288; -pub const SQLITE_READONLY_DIRECTORY: i32 = 1544; -pub const SQLITE_ABORT_ROLLBACK: i32 = 516; -pub const SQLITE_CONSTRAINT_CHECK: i32 = 275; -pub const SQLITE_CONSTRAINT_COMMITHOOK: i32 = 531; -pub const SQLITE_CONSTRAINT_FOREIGNKEY: i32 = 787; -pub const SQLITE_CONSTRAINT_FUNCTION: i32 = 1043; -pub const SQLITE_CONSTRAINT_NOTNULL: i32 = 1299; -pub const SQLITE_CONSTRAINT_PRIMARYKEY: i32 = 1555; -pub const SQLITE_CONSTRAINT_TRIGGER: i32 = 1811; -pub const SQLITE_CONSTRAINT_UNIQUE: i32 = 2067; -pub const SQLITE_CONSTRAINT_VTAB: i32 = 2323; -pub const SQLITE_CONSTRAINT_ROWID: i32 = 2579; -pub const SQLITE_CONSTRAINT_PINNED: i32 = 2835; -pub const SQLITE_CONSTRAINT_DATATYPE: i32 = 3091; -pub const SQLITE_NOTICE_RECOVER_WAL: i32 = 283; -pub const SQLITE_NOTICE_RECOVER_ROLLBACK: i32 = 539; -pub const SQLITE_NOTICE_RBU: i32 = 795; -pub const SQLITE_WARNING_AUTOINDEX: i32 = 284; -pub const SQLITE_AUTH_USER: i32 = 279; -pub const SQLITE_OK_LOAD_PERMANENTLY: i32 = 256; -pub const SQLITE_OK_SYMLINK: i32 = 512; -pub const SQLITE_OPEN_READONLY: i32 = 1; -pub const SQLITE_OPEN_READWRITE: i32 = 2; -pub const SQLITE_OPEN_CREATE: i32 = 4; -pub const SQLITE_OPEN_DELETEONCLOSE: i32 = 8; -pub const SQLITE_OPEN_EXCLUSIVE: i32 = 16; -pub const SQLITE_OPEN_AUTOPROXY: i32 = 32; -pub const SQLITE_OPEN_URI: i32 = 64; -pub const SQLITE_OPEN_MEMORY: i32 = 128; -pub const SQLITE_OPEN_MAIN_DB: i32 = 256; -pub const SQLITE_OPEN_TEMP_DB: i32 = 512; -pub const SQLITE_OPEN_TRANSIENT_DB: i32 = 1024; -pub const SQLITE_OPEN_MAIN_JOURNAL: i32 = 2048; -pub const SQLITE_OPEN_TEMP_JOURNAL: i32 = 4096; -pub const SQLITE_OPEN_SUBJOURNAL: i32 = 8192; -pub const SQLITE_OPEN_SUPER_JOURNAL: i32 = 16384; -pub const SQLITE_OPEN_NOMUTEX: i32 = 32768; -pub const SQLITE_OPEN_FULLMUTEX: i32 = 65536; -pub const SQLITE_OPEN_SHAREDCACHE: i32 = 131072; -pub const SQLITE_OPEN_PRIVATECACHE: i32 = 262144; -pub const SQLITE_OPEN_WAL: i32 = 524288; -pub const SQLITE_OPEN_NOFOLLOW: i32 = 16777216; -pub const SQLITE_OPEN_EXRESCODE: i32 = 33554432; -pub const SQLITE_OPEN_MASTER_JOURNAL: i32 = 16384; -pub const SQLITE_IOCAP_ATOMIC: i32 = 1; -pub const SQLITE_IOCAP_ATOMIC512: i32 = 2; -pub const SQLITE_IOCAP_ATOMIC1K: i32 = 4; -pub const SQLITE_IOCAP_ATOMIC2K: i32 = 8; -pub const SQLITE_IOCAP_ATOMIC4K: i32 = 16; -pub const SQLITE_IOCAP_ATOMIC8K: i32 = 32; -pub const SQLITE_IOCAP_ATOMIC16K: i32 = 64; -pub const SQLITE_IOCAP_ATOMIC32K: i32 = 128; -pub const SQLITE_IOCAP_ATOMIC64K: i32 = 256; -pub const SQLITE_IOCAP_SAFE_APPEND: i32 = 512; -pub const SQLITE_IOCAP_SEQUENTIAL: i32 = 1024; -pub const SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: i32 = 2048; -pub const SQLITE_IOCAP_POWERSAFE_OVERWRITE: i32 = 4096; -pub const SQLITE_IOCAP_IMMUTABLE: i32 = 8192; -pub const SQLITE_IOCAP_BATCH_ATOMIC: i32 = 16384; -pub const SQLITE_LOCK_NONE: i32 = 0; -pub const SQLITE_LOCK_SHARED: i32 = 1; -pub const SQLITE_LOCK_RESERVED: i32 = 2; -pub const SQLITE_LOCK_PENDING: i32 = 3; -pub const SQLITE_LOCK_EXCLUSIVE: i32 = 4; -pub const SQLITE_SYNC_NORMAL: i32 = 2; -pub const SQLITE_SYNC_FULL: i32 = 3; -pub const SQLITE_SYNC_DATAONLY: i32 = 16; -pub const SQLITE_FCNTL_LOCKSTATE: i32 = 1; -pub const SQLITE_FCNTL_GET_LOCKPROXYFILE: i32 = 2; -pub const SQLITE_FCNTL_SET_LOCKPROXYFILE: i32 = 3; -pub const SQLITE_FCNTL_LAST_ERRNO: i32 = 4; -pub const SQLITE_FCNTL_SIZE_HINT: i32 = 5; -pub const SQLITE_FCNTL_CHUNK_SIZE: i32 = 6; -pub const SQLITE_FCNTL_FILE_POINTER: i32 = 7; -pub const SQLITE_FCNTL_SYNC_OMITTED: i32 = 8; -pub const SQLITE_FCNTL_WIN32_AV_RETRY: i32 = 9; -pub const SQLITE_FCNTL_PERSIST_WAL: i32 = 10; -pub const SQLITE_FCNTL_OVERWRITE: i32 = 11; -pub const SQLITE_FCNTL_VFSNAME: i32 = 12; -pub const SQLITE_FCNTL_POWERSAFE_OVERWRITE: i32 = 13; -pub const SQLITE_FCNTL_PRAGMA: i32 = 14; -pub const SQLITE_FCNTL_BUSYHANDLER: i32 = 15; -pub const SQLITE_FCNTL_TEMPFILENAME: i32 = 16; -pub const SQLITE_FCNTL_MMAP_SIZE: i32 = 18; -pub const SQLITE_FCNTL_TRACE: i32 = 19; -pub const SQLITE_FCNTL_HAS_MOVED: i32 = 20; -pub const SQLITE_FCNTL_SYNC: i32 = 21; -pub const SQLITE_FCNTL_COMMIT_PHASETWO: i32 = 22; -pub const SQLITE_FCNTL_WIN32_SET_HANDLE: i32 = 23; -pub const SQLITE_FCNTL_WAL_BLOCK: i32 = 24; -pub const SQLITE_FCNTL_ZIPVFS: i32 = 25; -pub const SQLITE_FCNTL_RBU: i32 = 26; -pub const SQLITE_FCNTL_VFS_POINTER: i32 = 27; -pub const SQLITE_FCNTL_JOURNAL_POINTER: i32 = 28; -pub const SQLITE_FCNTL_WIN32_GET_HANDLE: i32 = 29; -pub const SQLITE_FCNTL_PDB: i32 = 30; -pub const SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: i32 = 31; -pub const SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: i32 = 32; -pub const SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: i32 = 33; -pub const SQLITE_FCNTL_LOCK_TIMEOUT: i32 = 34; -pub const SQLITE_FCNTL_DATA_VERSION: i32 = 35; -pub const SQLITE_FCNTL_SIZE_LIMIT: i32 = 36; -pub const SQLITE_FCNTL_CKPT_DONE: i32 = 37; -pub const SQLITE_FCNTL_RESERVE_BYTES: i32 = 38; -pub const SQLITE_FCNTL_CKPT_START: i32 = 39; -pub const SQLITE_FCNTL_EXTERNAL_READER: i32 = 40; -pub const SQLITE_FCNTL_CKSM_FILE: i32 = 41; -pub const SQLITE_FCNTL_RESET_CACHE: i32 = 42; -pub const SQLITE_FCNTL_WAL_METHODS_POINTER: i32 = 129; -pub const SQLITE_GET_LOCKPROXYFILE: i32 = 2; -pub const SQLITE_SET_LOCKPROXYFILE: i32 = 3; -pub const SQLITE_LAST_ERRNO: i32 = 4; -pub const SQLITE_ACCESS_EXISTS: i32 = 0; -pub const SQLITE_ACCESS_READWRITE: i32 = 1; -pub const SQLITE_ACCESS_READ: i32 = 2; -pub const SQLITE_SHM_UNLOCK: i32 = 1; -pub const SQLITE_SHM_LOCK: i32 = 2; -pub const SQLITE_SHM_SHARED: i32 = 4; -pub const SQLITE_SHM_EXCLUSIVE: i32 = 8; -pub const SQLITE_SHM_NLOCK: i32 = 8; -pub const SQLITE_CONFIG_SINGLETHREAD: i32 = 1; -pub const SQLITE_CONFIG_MULTITHREAD: i32 = 2; -pub const SQLITE_CONFIG_SERIALIZED: i32 = 3; -pub const SQLITE_CONFIG_MALLOC: i32 = 4; -pub const SQLITE_CONFIG_GETMALLOC: i32 = 5; -pub const SQLITE_CONFIG_SCRATCH: i32 = 6; -pub const SQLITE_CONFIG_PAGECACHE: i32 = 7; -pub const SQLITE_CONFIG_HEAP: i32 = 8; -pub const SQLITE_CONFIG_MEMSTATUS: i32 = 9; -pub const SQLITE_CONFIG_MUTEX: i32 = 10; -pub const SQLITE_CONFIG_GETMUTEX: i32 = 11; -pub const SQLITE_CONFIG_LOOKASIDE: i32 = 13; -pub const SQLITE_CONFIG_PCACHE: i32 = 14; -pub const SQLITE_CONFIG_GETPCACHE: i32 = 15; -pub const SQLITE_CONFIG_LOG: i32 = 16; -pub const SQLITE_CONFIG_URI: i32 = 17; -pub const SQLITE_CONFIG_PCACHE2: i32 = 18; -pub const SQLITE_CONFIG_GETPCACHE2: i32 = 19; -pub const SQLITE_CONFIG_COVERING_INDEX_SCAN: i32 = 20; -pub const SQLITE_CONFIG_SQLLOG: i32 = 21; -pub const SQLITE_CONFIG_MMAP_SIZE: i32 = 22; -pub const SQLITE_CONFIG_WIN32_HEAPSIZE: i32 = 23; -pub const SQLITE_CONFIG_PCACHE_HDRSZ: i32 = 24; -pub const SQLITE_CONFIG_PMASZ: i32 = 25; -pub const SQLITE_CONFIG_STMTJRNL_SPILL: i32 = 26; -pub const SQLITE_CONFIG_SMALL_MALLOC: i32 = 27; -pub const SQLITE_CONFIG_SORTERREF_SIZE: i32 = 28; -pub const SQLITE_CONFIG_MEMDB_MAXSIZE: i32 = 29; -pub const SQLITE_DBCONFIG_MAINDBNAME: i32 = 1000; -pub const SQLITE_DBCONFIG_LOOKASIDE: i32 = 1001; -pub const SQLITE_DBCONFIG_ENABLE_FKEY: i32 = 1002; -pub const SQLITE_DBCONFIG_ENABLE_TRIGGER: i32 = 1003; -pub const SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: i32 = 1004; -pub const SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: i32 = 1005; -pub const SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: i32 = 1006; -pub const SQLITE_DBCONFIG_ENABLE_QPSG: i32 = 1007; -pub const SQLITE_DBCONFIG_TRIGGER_EQP: i32 = 1008; -pub const SQLITE_DBCONFIG_RESET_DATABASE: i32 = 1009; -pub const SQLITE_DBCONFIG_DEFENSIVE: i32 = 1010; -pub const SQLITE_DBCONFIG_WRITABLE_SCHEMA: i32 = 1011; -pub const SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: i32 = 1012; -pub const SQLITE_DBCONFIG_DQS_DML: i32 = 1013; -pub const SQLITE_DBCONFIG_DQS_DDL: i32 = 1014; -pub const SQLITE_DBCONFIG_ENABLE_VIEW: i32 = 1015; -pub const SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: i32 = 1016; -pub const SQLITE_DBCONFIG_TRUSTED_SCHEMA: i32 = 1017; -pub const SQLITE_DBCONFIG_STMT_SCANSTATUS: i32 = 1018; -pub const SQLITE_DBCONFIG_REVERSE_SCANORDER: i32 = 1019; -pub const SQLITE_DBCONFIG_MAX: i32 = 1019; -pub const SQLITE_DENY: i32 = 1; -pub const SQLITE_IGNORE: i32 = 2; -pub const SQLITE_CREATE_INDEX: i32 = 1; -pub const SQLITE_CREATE_TABLE: i32 = 2; -pub const SQLITE_CREATE_TEMP_INDEX: i32 = 3; -pub const SQLITE_CREATE_TEMP_TABLE: i32 = 4; -pub const SQLITE_CREATE_TEMP_TRIGGER: i32 = 5; -pub const SQLITE_CREATE_TEMP_VIEW: i32 = 6; -pub const SQLITE_CREATE_TRIGGER: i32 = 7; -pub const SQLITE_CREATE_VIEW: i32 = 8; -pub const SQLITE_DELETE: i32 = 9; -pub const SQLITE_DROP_INDEX: i32 = 10; -pub const SQLITE_DROP_TABLE: i32 = 11; -pub const SQLITE_DROP_TEMP_INDEX: i32 = 12; -pub const SQLITE_DROP_TEMP_TABLE: i32 = 13; -pub const SQLITE_DROP_TEMP_TRIGGER: i32 = 14; -pub const SQLITE_DROP_TEMP_VIEW: i32 = 15; -pub const SQLITE_DROP_TRIGGER: i32 = 16; -pub const SQLITE_DROP_VIEW: i32 = 17; -pub const SQLITE_INSERT: i32 = 18; -pub const SQLITE_PRAGMA: i32 = 19; -pub const SQLITE_READ: i32 = 20; -pub const SQLITE_SELECT: i32 = 21; -pub const SQLITE_TRANSACTION: i32 = 22; -pub const SQLITE_UPDATE: i32 = 23; -pub const SQLITE_ATTACH: i32 = 24; -pub const SQLITE_DETACH: i32 = 25; -pub const SQLITE_ALTER_TABLE: i32 = 26; -pub const SQLITE_REINDEX: i32 = 27; -pub const SQLITE_ANALYZE: i32 = 28; -pub const SQLITE_CREATE_VTABLE: i32 = 29; -pub const SQLITE_DROP_VTABLE: i32 = 30; -pub const SQLITE_FUNCTION: i32 = 31; -pub const SQLITE_SAVEPOINT: i32 = 32; -pub const SQLITE_COPY: i32 = 0; -pub const SQLITE_RECURSIVE: i32 = 33; -pub const SQLITE_TRACE_STMT: i32 = 1; -pub const SQLITE_TRACE_PROFILE: i32 = 2; -pub const SQLITE_TRACE_ROW: i32 = 4; -pub const SQLITE_TRACE_CLOSE: i32 = 8; -pub const SQLITE_LIMIT_LENGTH: i32 = 0; -pub const SQLITE_LIMIT_SQL_LENGTH: i32 = 1; -pub const SQLITE_LIMIT_COLUMN: i32 = 2; -pub const SQLITE_LIMIT_EXPR_DEPTH: i32 = 3; -pub const SQLITE_LIMIT_COMPOUND_SELECT: i32 = 4; -pub const SQLITE_LIMIT_VDBE_OP: i32 = 5; -pub const SQLITE_LIMIT_FUNCTION_ARG: i32 = 6; -pub const SQLITE_LIMIT_ATTACHED: i32 = 7; -pub const SQLITE_LIMIT_LIKE_PATTERN_LENGTH: i32 = 8; -pub const SQLITE_LIMIT_VARIABLE_NUMBER: i32 = 9; -pub const SQLITE_LIMIT_TRIGGER_DEPTH: i32 = 10; -pub const SQLITE_LIMIT_WORKER_THREADS: i32 = 11; -pub const SQLITE_PREPARE_PERSISTENT: i32 = 1; -pub const SQLITE_PREPARE_NORMALIZE: i32 = 2; -pub const SQLITE_PREPARE_NO_VTAB: i32 = 4; -pub const SQLITE_INTEGER: i32 = 1; -pub const SQLITE_FLOAT: i32 = 2; -pub const SQLITE_BLOB: i32 = 4; -pub const SQLITE_NULL: i32 = 5; -pub const SQLITE_TEXT: i32 = 3; -pub const SQLITE3_TEXT: i32 = 3; -pub const SQLITE_UTF8: i32 = 1; -pub const SQLITE_UTF16LE: i32 = 2; -pub const SQLITE_UTF16BE: i32 = 3; -pub const SQLITE_UTF16: i32 = 4; -pub const SQLITE_ANY: i32 = 5; -pub const SQLITE_UTF16_ALIGNED: i32 = 8; -pub const SQLITE_DETERMINISTIC: i32 = 2048; -pub const SQLITE_DIRECTONLY: i32 = 524288; -pub const SQLITE_SUBTYPE: i32 = 1048576; -pub const SQLITE_INNOCUOUS: i32 = 2097152; -pub const SQLITE_WIN32_DATA_DIRECTORY_TYPE: i32 = 1; -pub const SQLITE_WIN32_TEMP_DIRECTORY_TYPE: i32 = 2; -pub const SQLITE_TXN_NONE: i32 = 0; -pub const SQLITE_TXN_READ: i32 = 1; -pub const SQLITE_TXN_WRITE: i32 = 2; -pub const SQLITE_INDEX_SCAN_UNIQUE: i32 = 1; -pub const SQLITE_INDEX_CONSTRAINT_EQ: i32 = 2; -pub const SQLITE_INDEX_CONSTRAINT_GT: i32 = 4; -pub const SQLITE_INDEX_CONSTRAINT_LE: i32 = 8; -pub const SQLITE_INDEX_CONSTRAINT_LT: i32 = 16; -pub const SQLITE_INDEX_CONSTRAINT_GE: i32 = 32; -pub const SQLITE_INDEX_CONSTRAINT_MATCH: i32 = 64; -pub const SQLITE_INDEX_CONSTRAINT_LIKE: i32 = 65; -pub const SQLITE_INDEX_CONSTRAINT_GLOB: i32 = 66; -pub const SQLITE_INDEX_CONSTRAINT_REGEXP: i32 = 67; -pub const SQLITE_INDEX_CONSTRAINT_NE: i32 = 68; -pub const SQLITE_INDEX_CONSTRAINT_ISNOT: i32 = 69; -pub const SQLITE_INDEX_CONSTRAINT_ISNOTNULL: i32 = 70; -pub const SQLITE_INDEX_CONSTRAINT_ISNULL: i32 = 71; -pub const SQLITE_INDEX_CONSTRAINT_IS: i32 = 72; -pub const SQLITE_INDEX_CONSTRAINT_LIMIT: i32 = 73; -pub const SQLITE_INDEX_CONSTRAINT_OFFSET: i32 = 74; -pub const SQLITE_INDEX_CONSTRAINT_FUNCTION: i32 = 150; -pub const SQLITE_MUTEX_FAST: i32 = 0; -pub const SQLITE_MUTEX_RECURSIVE: i32 = 1; -pub const SQLITE_MUTEX_STATIC_MAIN: i32 = 2; -pub const SQLITE_MUTEX_STATIC_MEM: i32 = 3; -pub const SQLITE_MUTEX_STATIC_MEM2: i32 = 4; -pub const SQLITE_MUTEX_STATIC_OPEN: i32 = 4; -pub const SQLITE_MUTEX_STATIC_PRNG: i32 = 5; -pub const SQLITE_MUTEX_STATIC_LRU: i32 = 6; -pub const SQLITE_MUTEX_STATIC_LRU2: i32 = 7; -pub const SQLITE_MUTEX_STATIC_PMEM: i32 = 7; -pub const SQLITE_MUTEX_STATIC_APP1: i32 = 8; -pub const SQLITE_MUTEX_STATIC_APP2: i32 = 9; -pub const SQLITE_MUTEX_STATIC_APP3: i32 = 10; -pub const SQLITE_MUTEX_STATIC_VFS1: i32 = 11; -pub const SQLITE_MUTEX_STATIC_VFS2: i32 = 12; -pub const SQLITE_MUTEX_STATIC_VFS3: i32 = 13; -pub const SQLITE_MUTEX_STATIC_MASTER: i32 = 2; -pub const SQLITE_TESTCTRL_FIRST: i32 = 5; -pub const SQLITE_TESTCTRL_PRNG_SAVE: i32 = 5; -pub const SQLITE_TESTCTRL_PRNG_RESTORE: i32 = 6; -pub const SQLITE_TESTCTRL_PRNG_RESET: i32 = 7; -pub const SQLITE_TESTCTRL_BITVEC_TEST: i32 = 8; -pub const SQLITE_TESTCTRL_FAULT_INSTALL: i32 = 9; -pub const SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: i32 = 10; -pub const SQLITE_TESTCTRL_PENDING_BYTE: i32 = 11; -pub const SQLITE_TESTCTRL_ASSERT: i32 = 12; -pub const SQLITE_TESTCTRL_ALWAYS: i32 = 13; -pub const SQLITE_TESTCTRL_RESERVE: i32 = 14; -pub const SQLITE_TESTCTRL_OPTIMIZATIONS: i32 = 15; -pub const SQLITE_TESTCTRL_ISKEYWORD: i32 = 16; -pub const SQLITE_TESTCTRL_SCRATCHMALLOC: i32 = 17; -pub const SQLITE_TESTCTRL_INTERNAL_FUNCTIONS: i32 = 17; -pub const SQLITE_TESTCTRL_LOCALTIME_FAULT: i32 = 18; -pub const SQLITE_TESTCTRL_EXPLAIN_STMT: i32 = 19; -pub const SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD: i32 = 19; -pub const SQLITE_TESTCTRL_NEVER_CORRUPT: i32 = 20; -pub const SQLITE_TESTCTRL_VDBE_COVERAGE: i32 = 21; -pub const SQLITE_TESTCTRL_BYTEORDER: i32 = 22; -pub const SQLITE_TESTCTRL_ISINIT: i32 = 23; -pub const SQLITE_TESTCTRL_SORTER_MMAP: i32 = 24; -pub const SQLITE_TESTCTRL_IMPOSTER: i32 = 25; -pub const SQLITE_TESTCTRL_PARSER_COVERAGE: i32 = 26; -pub const SQLITE_TESTCTRL_RESULT_INTREAL: i32 = 27; -pub const SQLITE_TESTCTRL_PRNG_SEED: i32 = 28; -pub const SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: i32 = 29; -pub const SQLITE_TESTCTRL_SEEK_COUNT: i32 = 30; -pub const SQLITE_TESTCTRL_TRACEFLAGS: i32 = 31; -pub const SQLITE_TESTCTRL_TUNE: i32 = 32; -pub const SQLITE_TESTCTRL_LOGEST: i32 = 33; -pub const SQLITE_TESTCTRL_USELONGDOUBLE: i32 = 34; -pub const SQLITE_TESTCTRL_LAST: i32 = 34; -pub const SQLITE_STATUS_MEMORY_USED: i32 = 0; -pub const SQLITE_STATUS_PAGECACHE_USED: i32 = 1; -pub const SQLITE_STATUS_PAGECACHE_OVERFLOW: i32 = 2; -pub const SQLITE_STATUS_SCRATCH_USED: i32 = 3; -pub const SQLITE_STATUS_SCRATCH_OVERFLOW: i32 = 4; -pub const SQLITE_STATUS_MALLOC_SIZE: i32 = 5; -pub const SQLITE_STATUS_PARSER_STACK: i32 = 6; -pub const SQLITE_STATUS_PAGECACHE_SIZE: i32 = 7; -pub const SQLITE_STATUS_SCRATCH_SIZE: i32 = 8; -pub const SQLITE_STATUS_MALLOC_COUNT: i32 = 9; -pub const SQLITE_DBSTATUS_LOOKASIDE_USED: i32 = 0; -pub const SQLITE_DBSTATUS_CACHE_USED: i32 = 1; -pub const SQLITE_DBSTATUS_SCHEMA_USED: i32 = 2; -pub const SQLITE_DBSTATUS_STMT_USED: i32 = 3; -pub const SQLITE_DBSTATUS_LOOKASIDE_HIT: i32 = 4; -pub const SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE: i32 = 5; -pub const SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: i32 = 6; -pub const SQLITE_DBSTATUS_CACHE_HIT: i32 = 7; -pub const SQLITE_DBSTATUS_CACHE_MISS: i32 = 8; -pub const SQLITE_DBSTATUS_CACHE_WRITE: i32 = 9; -pub const SQLITE_DBSTATUS_DEFERRED_FKS: i32 = 10; -pub const SQLITE_DBSTATUS_CACHE_USED_SHARED: i32 = 11; -pub const SQLITE_DBSTATUS_CACHE_SPILL: i32 = 12; -pub const SQLITE_DBSTATUS_MAX: i32 = 12; -pub const SQLITE_STMTSTATUS_FULLSCAN_STEP: i32 = 1; -pub const SQLITE_STMTSTATUS_SORT: i32 = 2; -pub const SQLITE_STMTSTATUS_AUTOINDEX: i32 = 3; -pub const SQLITE_STMTSTATUS_VM_STEP: i32 = 4; -pub const SQLITE_STMTSTATUS_REPREPARE: i32 = 5; -pub const SQLITE_STMTSTATUS_RUN: i32 = 6; -pub const SQLITE_STMTSTATUS_FILTER_MISS: i32 = 7; -pub const SQLITE_STMTSTATUS_FILTER_HIT: i32 = 8; -pub const SQLITE_STMTSTATUS_MEMUSED: i32 = 99; -pub const LIBSQL_STMTSTATUS_BASE: i32 = 1024; -pub const LIBSQL_STMTSTATUS_ROWS_READ: i32 = 1025; -pub const LIBSQL_STMTSTATUS_ROWS_WRITTEN: i32 = 1026; -pub const SQLITE_CHECKPOINT_PASSIVE: i32 = 0; -pub const SQLITE_CHECKPOINT_FULL: i32 = 1; -pub const SQLITE_CHECKPOINT_RESTART: i32 = 2; -pub const SQLITE_CHECKPOINT_TRUNCATE: i32 = 3; -pub const SQLITE_VTAB_CONSTRAINT_SUPPORT: i32 = 1; -pub const SQLITE_VTAB_INNOCUOUS: i32 = 2; -pub const SQLITE_VTAB_DIRECTONLY: i32 = 3; -pub const SQLITE_VTAB_USES_ALL_SCHEMAS: i32 = 4; -pub const SQLITE_ROLLBACK: i32 = 1; -pub const SQLITE_FAIL: i32 = 3; -pub const SQLITE_REPLACE: i32 = 5; -pub const SQLITE_SCANSTAT_NLOOP: i32 = 0; -pub const SQLITE_SCANSTAT_NVISIT: i32 = 1; -pub const SQLITE_SCANSTAT_EST: i32 = 2; -pub const SQLITE_SCANSTAT_NAME: i32 = 3; -pub const SQLITE_SCANSTAT_EXPLAIN: i32 = 4; -pub const SQLITE_SCANSTAT_SELECTID: i32 = 5; -pub const SQLITE_SCANSTAT_PARENTID: i32 = 6; -pub const SQLITE_SCANSTAT_NCYCLE: i32 = 7; -pub const SQLITE_SCANSTAT_COMPLEX: i32 = 1; -pub const SQLITE_SERIALIZE_NOCOPY: i32 = 1; -pub const SQLITE_DESERIALIZE_FREEONCLOSE: i32 = 1; -pub const SQLITE_DESERIALIZE_RESIZEABLE: i32 = 2; -pub const SQLITE_DESERIALIZE_READONLY: i32 = 4; -pub const NOT_WITHIN: i32 = 0; -pub const PARTLY_WITHIN: i32 = 1; -pub const FULLY_WITHIN: i32 = 2; -pub const __SQLITESESSION_H_: i32 = 1; -pub const SQLITE_SESSION_OBJCONFIG_SIZE: i32 = 1; -pub const SQLITE_SESSION_OBJCONFIG_ROWID: i32 = 2; -pub const SQLITE_CHANGESETSTART_INVERT: i32 = 2; -pub const SQLITE_CHANGESETAPPLY_NOSAVEPOINT: i32 = 1; -pub const SQLITE_CHANGESETAPPLY_INVERT: i32 = 2; -pub const SQLITE_CHANGESETAPPLY_IGNORENOOP: i32 = 4; -pub const SQLITE_CHANGESET_DATA: i32 = 1; -pub const SQLITE_CHANGESET_NOTFOUND: i32 = 2; -pub const SQLITE_CHANGESET_CONFLICT: i32 = 3; -pub const SQLITE_CHANGESET_CONSTRAINT: i32 = 4; -pub const SQLITE_CHANGESET_FOREIGN_KEY: i32 = 5; -pub const SQLITE_CHANGESET_OMIT: i32 = 0; -pub const SQLITE_CHANGESET_REPLACE: i32 = 1; -pub const SQLITE_CHANGESET_ABORT: i32 = 2; -pub const SQLITE_SESSION_CONFIG_STRMSIZE: i32 = 1; -pub const FTS5_TOKENIZE_QUERY: i32 = 1; -pub const FTS5_TOKENIZE_PREFIX: i32 = 2; -pub const FTS5_TOKENIZE_DOCUMENT: i32 = 4; -pub const FTS5_TOKENIZE_AUX: i32 = 8; -pub const FTS5_TOKEN_COLOCATED: i32 = 1; -pub const WAL_SAVEPOINT_NDATA: i32 = 4; -pub type __gnuc_va_list = __builtin_va_list; -pub type va_list = __builtin_va_list; -extern "C" { - pub static sqlite3_version: [::std::os::raw::c_char; 0usize]; -} -extern "C" { - pub fn sqlite3_libversion() -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_sourceid() -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_libversion_number() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn libsql_libversion() -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_compileoption_used( - zOptName: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_compileoption_get(N: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_threadsafe() -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3 { - _unused: [u8; 0], -} -pub type sqlite_int64 = ::std::os::raw::c_longlong; -pub type sqlite_uint64 = ::std::os::raw::c_ulonglong; -pub type sqlite3_int64 = sqlite_int64; -pub type sqlite3_uint64 = sqlite_uint64; -extern "C" { - pub fn sqlite3_close(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_close_v2(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -pub type sqlite3_callback = ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut ::std::os::raw::c_char, - arg4: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, ->; -extern "C" { - pub fn sqlite3_exec( - arg1: *mut sqlite3, - sql: *const ::std::os::raw::c_char, - callback: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut ::std::os::raw::c_char, - arg4: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - arg2: *mut ::std::os::raw::c_void, - errmsg: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_file { - pub pMethods: *const sqlite3_io_methods, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_io_methods { - pub iVersion: ::std::os::raw::c_int, - pub xClose: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_file) -> ::std::os::raw::c_int, - >, - pub xRead: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - arg2: *mut ::std::os::raw::c_void, - iAmt: ::std::os::raw::c_int, - iOfst: sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xWrite: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - arg2: *const ::std::os::raw::c_void, - iAmt: ::std::os::raw::c_int, - iOfst: sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xTruncate: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_file, size: sqlite3_int64) -> ::std::os::raw::c_int, - >, - pub xSync: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xFileSize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - pSize: *mut sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xLock: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - arg2: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xUnlock: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - arg2: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xCheckReservedLock: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - pResOut: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xFileControl: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - op: ::std::os::raw::c_int, - pArg: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - pub xSectorSize: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_file) -> ::std::os::raw::c_int, - >, - pub xDeviceCharacteristics: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_file) -> ::std::os::raw::c_int, - >, - pub xShmMap: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - iPg: ::std::os::raw::c_int, - pgsz: ::std::os::raw::c_int, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - pub xShmLock: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - offset: ::std::os::raw::c_int, - n: ::std::os::raw::c_int, - flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xShmBarrier: ::std::option::Option, - pub xShmUnmap: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - deleteFlag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xFetch: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - iOfst: sqlite3_int64, - iAmt: ::std::os::raw::c_int, - pp: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - pub xUnfetch: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_file, - iOfst: sqlite3_int64, - p: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_mutex { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_api_routines { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct libsql_api_routines { - _unused: [u8; 0], -} -pub type sqlite3_filename = *const ::std::os::raw::c_char; -pub type sqlite3_syscall_ptr = ::std::option::Option; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_vfs { - pub iVersion: ::std::os::raw::c_int, - pub szOsFile: ::std::os::raw::c_int, - pub mxPathname: ::std::os::raw::c_int, - pub pNext: *mut sqlite3_vfs, - pub zName: *const ::std::os::raw::c_char, - pub pAppData: *mut ::std::os::raw::c_void, - pub xOpen: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: sqlite3_filename, - arg2: *mut sqlite3_file, - flags: ::std::os::raw::c_int, - pOutFlags: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xDelete: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: *const ::std::os::raw::c_char, - syncDir: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xAccess: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: *const ::std::os::raw::c_char, - flags: ::std::os::raw::c_int, - pResOut: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xFullPathname: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: *const ::std::os::raw::c_char, - nOut: ::std::os::raw::c_int, - zOut: *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xDlOpen: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zFilename: *const ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_void, - >, - pub xDlError: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - nByte: ::std::os::raw::c_int, - zErrMsg: *mut ::std::os::raw::c_char, - ), - >, - pub xDlSym: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - arg2: *mut ::std::os::raw::c_void, - zSymbol: *const ::std::os::raw::c_char, - ) -> ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - arg2: *mut ::std::os::raw::c_void, - zSymbol: *const ::std::os::raw::c_char, - ), - >, - >, - pub xDlClose: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_vfs, arg2: *mut ::std::os::raw::c_void), - >, - pub xRandomness: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - nByte: ::std::os::raw::c_int, - zOut: *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xSleep: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - microseconds: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xCurrentTime: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_vfs, arg2: *mut f64) -> ::std::os::raw::c_int, - >, - pub xGetLastError: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - arg2: ::std::os::raw::c_int, - arg3: *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xCurrentTimeInt64: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - arg2: *mut sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xSetSystemCall: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: *const ::std::os::raw::c_char, - arg2: sqlite3_syscall_ptr, - ) -> ::std::os::raw::c_int, - >, - pub xGetSystemCall: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: *const ::std::os::raw::c_char, - ) -> sqlite3_syscall_ptr, - >, - pub xNextSystemCall: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vfs, - zName: *const ::std::os::raw::c_char, - ) -> *const ::std::os::raw::c_char, - >, -} -extern "C" { - pub fn sqlite3_initialize() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_shutdown() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_os_init() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_os_end() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_config(arg1: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_db_config( - arg1: *mut sqlite3, - op: ::std::os::raw::c_int, - ... - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_mem_methods { - pub xMalloc: ::std::option::Option< - unsafe extern "C" fn(arg1: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_void, - >, - pub xFree: ::std::option::Option, - pub xRealloc: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void, - >, - pub xSize: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub xRoundup: ::std::option::Option< - unsafe extern "C" fn(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int, - >, - pub xInit: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub xShutdown: ::std::option::Option, - pub pAppData: *mut ::std::os::raw::c_void, -} -extern "C" { - pub fn sqlite3_extended_result_codes( - arg1: *mut sqlite3, - onoff: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_last_insert_rowid(arg1: *mut sqlite3) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_set_last_insert_rowid(arg1: *mut sqlite3, arg2: sqlite3_int64); -} -extern "C" { - pub fn sqlite3_changes(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_changes64(arg1: *mut sqlite3) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_total_changes(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_total_changes64(arg1: *mut sqlite3) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_interrupt(arg1: *mut sqlite3); -} -extern "C" { - pub fn sqlite3_is_interrupted(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_complete(sql: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_complete16(sql: *const ::std::os::raw::c_void) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_busy_handler( - arg1: *mut sqlite3, - arg2: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - arg3: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_busy_timeout( - arg1: *mut sqlite3, - ms: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_get_table( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_char, - pazResult: *mut *mut *mut ::std::os::raw::c_char, - pnRow: *mut ::std::os::raw::c_int, - pnColumn: *mut ::std::os::raw::c_int, - pzErrmsg: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_free_table(result: *mut *mut ::std::os::raw::c_char); -} -extern "C" { - pub fn sqlite3_mprintf(arg1: *const ::std::os::raw::c_char, ...) - -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_vmprintf( - arg1: *const ::std::os::raw::c_char, - arg2: va_list, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_snprintf( - arg1: ::std::os::raw::c_int, - arg2: *mut ::std::os::raw::c_char, - arg3: *const ::std::os::raw::c_char, - ... - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_vsnprintf( - arg1: ::std::os::raw::c_int, - arg2: *mut ::std::os::raw::c_char, - arg3: *const ::std::os::raw::c_char, - arg4: va_list, - ) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_malloc(arg1: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_malloc64(arg1: sqlite3_uint64) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_realloc( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_realloc64( - arg1: *mut ::std::os::raw::c_void, - arg2: sqlite3_uint64, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_free(arg1: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn sqlite3_msize(arg1: *mut ::std::os::raw::c_void) -> sqlite3_uint64; -} -extern "C" { - pub fn sqlite3_memory_used() -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_memory_highwater(resetFlag: ::std::os::raw::c_int) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_randomness(N: ::std::os::raw::c_int, P: *mut ::std::os::raw::c_void); -} -extern "C" { - pub fn sqlite3_set_authorizer( - arg1: *mut sqlite3, - xAuth: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_char, - arg4: *const ::std::os::raw::c_char, - arg5: *const ::std::os::raw::c_char, - arg6: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pUserData: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_trace( - arg1: *mut sqlite3, - xTrace: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_char, - ), - >, - arg2: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_profile( - arg1: *mut sqlite3, - xProfile: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_char, - arg3: sqlite3_uint64, - ), - >, - arg2: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_trace_v2( - arg1: *mut sqlite3, - uMask: ::std::os::raw::c_uint, - xCallback: ::std::option::Option< - unsafe extern "C" fn( - arg1: ::std::os::raw::c_uint, - arg2: *mut ::std::os::raw::c_void, - arg3: *mut ::std::os::raw::c_void, - arg4: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - pCtx: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_progress_handler( - arg1: *mut sqlite3, - arg2: ::std::os::raw::c_int, - arg3: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - arg4: *mut ::std::os::raw::c_void, - ); -} -extern "C" { - pub fn sqlite3_open( - filename: *const ::std::os::raw::c_char, - ppDb: *mut *mut sqlite3, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_open16( - filename: *const ::std::os::raw::c_void, - ppDb: *mut *mut sqlite3, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_open_v2( - filename: *const ::std::os::raw::c_char, - ppDb: *mut *mut sqlite3, - flags: ::std::os::raw::c_int, - zVfs: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn libsql_open( - filename: *const ::std::os::raw::c_char, - ppDb: *mut *mut sqlite3, - flags: ::std::os::raw::c_int, - zVfs: *const ::std::os::raw::c_char, - create_wal: libsql_create_wal, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn libsql_try_initialize_wasm_func_table(db: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_uri_parameter( - z: sqlite3_filename, - zParam: *const ::std::os::raw::c_char, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_uri_boolean( - z: sqlite3_filename, - zParam: *const ::std::os::raw::c_char, - bDefault: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_uri_int64( - arg1: sqlite3_filename, - arg2: *const ::std::os::raw::c_char, - arg3: sqlite3_int64, - ) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_uri_key( - z: sqlite3_filename, - N: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_filename_database(arg1: sqlite3_filename) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_filename_journal(arg1: sqlite3_filename) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_filename_wal(arg1: sqlite3_filename) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_database_file_object(arg1: *const ::std::os::raw::c_char) -> *mut sqlite3_file; -} -extern "C" { - pub fn sqlite3_create_filename( - zDatabase: *const ::std::os::raw::c_char, - zJournal: *const ::std::os::raw::c_char, - zWal: *const ::std::os::raw::c_char, - nParam: ::std::os::raw::c_int, - azParam: *mut *const ::std::os::raw::c_char, - ) -> sqlite3_filename; -} -extern "C" { - pub fn sqlite3_free_filename(arg1: sqlite3_filename); -} -extern "C" { - pub fn sqlite3_errcode(db: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_extended_errcode(db: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_errmsg(arg1: *mut sqlite3) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_errmsg16(arg1: *mut sqlite3) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_errstr(arg1: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_error_offset(db: *mut sqlite3) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_stmt { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3_limit( - arg1: *mut sqlite3, - id: ::std::os::raw::c_int, - newVal: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_prepare( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_char, - nByte: ::std::os::raw::c_int, - ppStmt: *mut *mut sqlite3_stmt, - pzTail: *mut *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_prepare_v2( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_char, - nByte: ::std::os::raw::c_int, - ppStmt: *mut *mut sqlite3_stmt, - pzTail: *mut *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_prepare_v3( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_char, - nByte: ::std::os::raw::c_int, - prepFlags: ::std::os::raw::c_uint, - ppStmt: *mut *mut sqlite3_stmt, - pzTail: *mut *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_prepare16( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_void, - nByte: ::std::os::raw::c_int, - ppStmt: *mut *mut sqlite3_stmt, - pzTail: *mut *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_prepare16_v2( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_void, - nByte: ::std::os::raw::c_int, - ppStmt: *mut *mut sqlite3_stmt, - pzTail: *mut *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_prepare16_v3( - db: *mut sqlite3, - zSql: *const ::std::os::raw::c_void, - nByte: ::std::os::raw::c_int, - prepFlags: ::std::os::raw::c_uint, - ppStmt: *mut *mut sqlite3_stmt, - pzTail: *mut *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_sql(pStmt: *mut sqlite3_stmt) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_expanded_sql(pStmt: *mut sqlite3_stmt) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_stmt_readonly(pStmt: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_isexplain(pStmt: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_explain( - pStmt: *mut sqlite3_stmt, - eMode: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_busy(arg1: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_value { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_context { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3_bind_blob( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - arg4: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_blob64( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - arg4: sqlite3_uint64, - arg5: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_double( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: f64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_int( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_int64( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: sqlite3_int64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_null( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_text( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_char, - arg4: ::std::os::raw::c_int, - arg5: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_text16( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - arg4: ::std::os::raw::c_int, - arg5: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_text64( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_char, - arg4: sqlite3_uint64, - arg5: ::std::option::Option, - encoding: ::std::os::raw::c_uchar, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_value( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *const sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_pointer( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: *mut ::std::os::raw::c_void, - arg4: *const ::std::os::raw::c_char, - arg5: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_zeroblob( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - n: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_zeroblob64( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - arg3: sqlite3_uint64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_parameter_count(arg1: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_bind_parameter_name( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_bind_parameter_index( - arg1: *mut sqlite3_stmt, - zName: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_clear_bindings(arg1: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_column_count(pStmt: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_column_name( - arg1: *mut sqlite3_stmt, - N: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_column_name16( - arg1: *mut sqlite3_stmt, - N: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_column_database_name( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_column_database_name16( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_column_table_name( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_column_table_name16( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_column_origin_name( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_column_origin_name16( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_column_decltype( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_column_decltype16( - arg1: *mut sqlite3_stmt, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_step(arg1: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_data_count(pStmt: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_column_blob( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_column_double(arg1: *mut sqlite3_stmt, iCol: ::std::os::raw::c_int) -> f64; -} -extern "C" { - pub fn sqlite3_column_int( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_column_int64( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_column_text( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_uchar; -} -extern "C" { - pub fn sqlite3_column_text16( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_column_value( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> *mut sqlite3_value; -} -extern "C" { - pub fn sqlite3_column_bytes( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_column_bytes16( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_column_type( - arg1: *mut sqlite3_stmt, - iCol: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_finalize(pStmt: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_reset(pStmt: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_function( - db: *mut sqlite3, - zFunctionName: *const ::std::os::raw::c_char, - nArg: ::std::os::raw::c_int, - eTextRep: ::std::os::raw::c_int, - pApp: *mut ::std::os::raw::c_void, - xFunc: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xStep: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xFinal: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_function16( - db: *mut sqlite3, - zFunctionName: *const ::std::os::raw::c_void, - nArg: ::std::os::raw::c_int, - eTextRep: ::std::os::raw::c_int, - pApp: *mut ::std::os::raw::c_void, - xFunc: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xStep: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xFinal: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_function_v2( - db: *mut sqlite3, - zFunctionName: *const ::std::os::raw::c_char, - nArg: ::std::os::raw::c_int, - eTextRep: ::std::os::raw::c_int, - pApp: *mut ::std::os::raw::c_void, - xFunc: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xStep: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xFinal: ::std::option::Option, - xDestroy: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_window_function( - db: *mut sqlite3, - zFunctionName: *const ::std::os::raw::c_char, - nArg: ::std::os::raw::c_int, - eTextRep: ::std::os::raw::c_int, - pApp: *mut ::std::os::raw::c_void, - xStep: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xFinal: ::std::option::Option, - xValue: ::std::option::Option, - xInverse: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - xDestroy: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_aggregate_count(arg1: *mut sqlite3_context) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_expired(arg1: *mut sqlite3_stmt) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_transfer_bindings( - arg1: *mut sqlite3_stmt, - arg2: *mut sqlite3_stmt, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_global_recover() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_thread_cleanup(); -} -extern "C" { - pub fn sqlite3_memory_alarm( - arg1: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: sqlite3_int64, - arg3: ::std::os::raw::c_int, - ), - >, - arg2: *mut ::std::os::raw::c_void, - arg3: sqlite3_int64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_blob(arg1: *mut sqlite3_value) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_value_double(arg1: *mut sqlite3_value) -> f64; -} -extern "C" { - pub fn sqlite3_value_int(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_int64(arg1: *mut sqlite3_value) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_value_pointer( - arg1: *mut sqlite3_value, - arg2: *const ::std::os::raw::c_char, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_value_text(arg1: *mut sqlite3_value) -> *const ::std::os::raw::c_uchar; -} -extern "C" { - pub fn sqlite3_value_text16(arg1: *mut sqlite3_value) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_value_text16le(arg1: *mut sqlite3_value) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_value_text16be(arg1: *mut sqlite3_value) -> *const ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_value_bytes(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_bytes16(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_type(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_numeric_type(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_nochange(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_frombind(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_encoding(arg1: *mut sqlite3_value) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_value_subtype(arg1: *mut sqlite3_value) -> ::std::os::raw::c_uint; -} -extern "C" { - pub fn sqlite3_value_dup(arg1: *const sqlite3_value) -> *mut sqlite3_value; -} -extern "C" { - pub fn sqlite3_value_free(arg1: *mut sqlite3_value); -} -extern "C" { - pub fn sqlite3_aggregate_context( - arg1: *mut sqlite3_context, - nBytes: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_user_data(arg1: *mut sqlite3_context) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_context_db_handle(arg1: *mut sqlite3_context) -> *mut sqlite3; -} -extern "C" { - pub fn sqlite3_get_auxdata( - arg1: *mut sqlite3_context, - N: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_set_auxdata( - arg1: *mut sqlite3_context, - N: ::std::os::raw::c_int, - arg2: *mut ::std::os::raw::c_void, - arg3: ::std::option::Option, - ); -} -pub type sqlite3_destructor_type = - ::std::option::Option; -extern "C" { - pub fn sqlite3_result_blob( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_void, - arg3: ::std::os::raw::c_int, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_blob64( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_void, - arg3: sqlite3_uint64, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_double(arg1: *mut sqlite3_context, arg2: f64); -} -extern "C" { - pub fn sqlite3_result_error( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_char, - arg3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn sqlite3_result_error16( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_void, - arg3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn sqlite3_result_error_toobig(arg1: *mut sqlite3_context); -} -extern "C" { - pub fn sqlite3_result_error_nomem(arg1: *mut sqlite3_context); -} -extern "C" { - pub fn sqlite3_result_error_code(arg1: *mut sqlite3_context, arg2: ::std::os::raw::c_int); -} -extern "C" { - pub fn sqlite3_result_int(arg1: *mut sqlite3_context, arg2: ::std::os::raw::c_int); -} -extern "C" { - pub fn sqlite3_result_int64(arg1: *mut sqlite3_context, arg2: sqlite3_int64); -} -extern "C" { - pub fn sqlite3_result_null(arg1: *mut sqlite3_context); -} -extern "C" { - pub fn sqlite3_result_text( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_char, - arg3: ::std::os::raw::c_int, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_text64( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_char, - arg3: sqlite3_uint64, - arg4: ::std::option::Option, - encoding: ::std::os::raw::c_uchar, - ); -} -extern "C" { - pub fn sqlite3_result_text16( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_void, - arg3: ::std::os::raw::c_int, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_text16le( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_void, - arg3: ::std::os::raw::c_int, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_text16be( - arg1: *mut sqlite3_context, - arg2: *const ::std::os::raw::c_void, - arg3: ::std::os::raw::c_int, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_value(arg1: *mut sqlite3_context, arg2: *mut sqlite3_value); -} -extern "C" { - pub fn sqlite3_result_pointer( - arg1: *mut sqlite3_context, - arg2: *mut ::std::os::raw::c_void, - arg3: *const ::std::os::raw::c_char, - arg4: ::std::option::Option, - ); -} -extern "C" { - pub fn sqlite3_result_zeroblob(arg1: *mut sqlite3_context, n: ::std::os::raw::c_int); -} -extern "C" { - pub fn sqlite3_result_zeroblob64( - arg1: *mut sqlite3_context, - n: sqlite3_uint64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_result_subtype(arg1: *mut sqlite3_context, arg2: ::std::os::raw::c_uint); -} -extern "C" { - pub fn sqlite3_create_collation( - arg1: *mut sqlite3, - zName: *const ::std::os::raw::c_char, - eTextRep: ::std::os::raw::c_int, - pArg: *mut ::std::os::raw::c_void, - xCompare: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - arg4: ::std::os::raw::c_int, - arg5: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_collation_v2( - arg1: *mut sqlite3, - zName: *const ::std::os::raw::c_char, - eTextRep: ::std::os::raw::c_int, - pArg: *mut ::std::os::raw::c_void, - xCompare: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - arg4: ::std::os::raw::c_int, - arg5: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - xDestroy: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_collation16( - arg1: *mut sqlite3, - zName: *const ::std::os::raw::c_void, - eTextRep: ::std::os::raw::c_int, - pArg: *mut ::std::os::raw::c_void, - xCompare: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - arg4: ::std::os::raw::c_int, - arg5: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_collation_needed( - arg1: *mut sqlite3, - arg2: *mut ::std::os::raw::c_void, - arg3: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *mut sqlite3, - eTextRep: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_char, - ), - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_collation_needed16( - arg1: *mut sqlite3, - arg2: *mut ::std::os::raw::c_void, - arg3: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *mut sqlite3, - eTextRep: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_void, - ), - >, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_sleep(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub static mut sqlite3_temp_directory: *mut ::std::os::raw::c_char; -} -extern "C" { - pub static mut sqlite3_data_directory: *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_win32_set_directory( - type_: ::std::os::raw::c_ulong, - zValue: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_win32_set_directory8( - type_: ::std::os::raw::c_ulong, - zValue: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_win32_set_directory16( - type_: ::std::os::raw::c_ulong, - zValue: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_get_autocommit(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_db_handle(arg1: *mut sqlite3_stmt) -> *mut sqlite3; -} -extern "C" { - pub fn sqlite3_db_name( - db: *mut sqlite3, - N: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_db_filename( - db: *mut sqlite3, - zDbName: *const ::std::os::raw::c_char, - ) -> sqlite3_filename; -} -extern "C" { - pub fn sqlite3_db_readonly( - db: *mut sqlite3, - zDbName: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_txn_state( - arg1: *mut sqlite3, - zSchema: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_next_stmt(pDb: *mut sqlite3, pStmt: *mut sqlite3_stmt) -> *mut sqlite3_stmt; -} -extern "C" { - pub fn sqlite3_commit_hook( - arg1: *mut sqlite3, - arg2: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - arg3: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_rollback_hook( - arg1: *mut sqlite3, - arg2: ::std::option::Option, - arg3: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_autovacuum_pages( - db: *mut sqlite3, - arg1: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *const ::std::os::raw::c_char, - arg3: ::std::os::raw::c_uint, - arg4: ::std::os::raw::c_uint, - arg5: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_uint, - >, - arg2: *mut ::std::os::raw::c_void, - arg3: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_update_hook( - arg1: *mut sqlite3, - arg2: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_char, - arg4: *const ::std::os::raw::c_char, - arg5: sqlite3_int64, - ), - >, - arg3: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_enable_shared_cache(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_release_memory(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_db_release_memory(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_soft_heap_limit64(N: sqlite3_int64) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_hard_heap_limit64(N: sqlite3_int64) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3_soft_heap_limit(N: ::std::os::raw::c_int); -} -extern "C" { - pub fn sqlite3_table_column_metadata( - db: *mut sqlite3, - zDbName: *const ::std::os::raw::c_char, - zTableName: *const ::std::os::raw::c_char, - zColumnName: *const ::std::os::raw::c_char, - pzDataType: *mut *const ::std::os::raw::c_char, - pzCollSeq: *mut *const ::std::os::raw::c_char, - pNotNull: *mut ::std::os::raw::c_int, - pPrimaryKey: *mut ::std::os::raw::c_int, - pAutoinc: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_load_extension( - db: *mut sqlite3, - zFile: *const ::std::os::raw::c_char, - zProc: *const ::std::os::raw::c_char, - pzErrMsg: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_enable_load_extension( - db: *mut sqlite3, - onoff: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_reset_auto_extension(); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_module { - pub iVersion: ::std::os::raw::c_int, - pub xCreate: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3, - pAux: *mut ::std::os::raw::c_void, - argc: ::std::os::raw::c_int, - argv: *const *const ::std::os::raw::c_char, - ppVTab: *mut *mut sqlite3_vtab, - arg2: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xConnect: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3, - pAux: *mut ::std::os::raw::c_void, - argc: ::std::os::raw::c_int, - argv: *const *const ::std::os::raw::c_char, - ppVTab: *mut *mut sqlite3_vtab, - arg2: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xBestIndex: ::std::option::Option< - unsafe extern "C" fn( - pVTab: *mut sqlite3_vtab, - arg1: *mut sqlite3_index_info, - ) -> ::std::os::raw::c_int, - >, - pub xDisconnect: ::std::option::Option< - unsafe extern "C" fn(pVTab: *mut sqlite3_vtab) -> ::std::os::raw::c_int, - >, - pub xDestroy: ::std::option::Option< - unsafe extern "C" fn(pVTab: *mut sqlite3_vtab) -> ::std::os::raw::c_int, - >, - pub xOpen: ::std::option::Option< - unsafe extern "C" fn( - pVTab: *mut sqlite3_vtab, - ppCursor: *mut *mut sqlite3_vtab_cursor, - ) -> ::std::os::raw::c_int, - >, - pub xClose: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_vtab_cursor) -> ::std::os::raw::c_int, - >, - pub xFilter: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vtab_cursor, - idxNum: ::std::os::raw::c_int, - idxStr: *const ::std::os::raw::c_char, - argc: ::std::os::raw::c_int, - argv: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int, - >, - pub xNext: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_vtab_cursor) -> ::std::os::raw::c_int, - >, - pub xEof: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_vtab_cursor) -> ::std::os::raw::c_int, - >, - pub xColumn: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vtab_cursor, - arg2: *mut sqlite3_context, - arg3: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xRowid: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vtab_cursor, - pRowid: *mut sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xUpdate: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vtab, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - arg4: *mut sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xBegin: ::std::option::Option< - unsafe extern "C" fn(pVTab: *mut sqlite3_vtab) -> ::std::os::raw::c_int, - >, - pub xSync: ::std::option::Option< - unsafe extern "C" fn(pVTab: *mut sqlite3_vtab) -> ::std::os::raw::c_int, - >, - pub xCommit: ::std::option::Option< - unsafe extern "C" fn(pVTab: *mut sqlite3_vtab) -> ::std::os::raw::c_int, - >, - pub xRollback: ::std::option::Option< - unsafe extern "C" fn(pVTab: *mut sqlite3_vtab) -> ::std::os::raw::c_int, - >, - pub xFindFunction: ::std::option::Option< - unsafe extern "C" fn( - pVtab: *mut sqlite3_vtab, - nArg: ::std::os::raw::c_int, - zName: *const ::std::os::raw::c_char, - pxFunc: *mut ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_context, - arg2: ::std::os::raw::c_int, - arg3: *mut *mut sqlite3_value, - ), - >, - ppArg: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - pub xRename: ::std::option::Option< - unsafe extern "C" fn( - pVtab: *mut sqlite3_vtab, - zNew: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xSavepoint: ::std::option::Option< - unsafe extern "C" fn( - pVTab: *mut sqlite3_vtab, - arg1: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xRelease: ::std::option::Option< - unsafe extern "C" fn( - pVTab: *mut sqlite3_vtab, - arg1: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xRollbackTo: ::std::option::Option< - unsafe extern "C" fn( - pVTab: *mut sqlite3_vtab, - arg1: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xShadowName: ::std::option::Option< - unsafe extern "C" fn(arg1: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int, - >, - pub xPreparedSql: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_vtab_cursor, - arg2: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_index_info { - pub nConstraint: ::std::os::raw::c_int, - pub aConstraint: *mut sqlite3_index_constraint, - pub nOrderBy: ::std::os::raw::c_int, - pub aOrderBy: *mut sqlite3_index_orderby, - pub aConstraintUsage: *mut sqlite3_index_constraint_usage, - pub idxNum: ::std::os::raw::c_int, - pub idxStr: *mut ::std::os::raw::c_char, - pub needToFreeIdxStr: ::std::os::raw::c_int, - pub orderByConsumed: ::std::os::raw::c_int, - pub estimatedCost: f64, - pub estimatedRows: sqlite3_int64, - pub idxFlags: ::std::os::raw::c_int, - pub colUsed: sqlite3_uint64, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_index_constraint { - pub iColumn: ::std::os::raw::c_int, - pub op: ::std::os::raw::c_uchar, - pub usable: ::std::os::raw::c_uchar, - pub iTermOffset: ::std::os::raw::c_int, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_index_orderby { - pub iColumn: ::std::os::raw::c_int, - pub desc: ::std::os::raw::c_uchar, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_index_constraint_usage { - pub argvIndex: ::std::os::raw::c_int, - pub omit: ::std::os::raw::c_uchar, -} -extern "C" { - pub fn sqlite3_create_module( - db: *mut sqlite3, - zName: *const ::std::os::raw::c_char, - p: *const sqlite3_module, - pClientData: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_create_module_v2( - db: *mut sqlite3, - zName: *const ::std::os::raw::c_char, - p: *const sqlite3_module, - pClientData: *mut ::std::os::raw::c_void, - xDestroy: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_drop_modules( - db: *mut sqlite3, - azKeep: *mut *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_vtab { - pub pModule: *const sqlite3_module, - pub nRef: ::std::os::raw::c_int, - pub zErrMsg: *mut ::std::os::raw::c_char, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_vtab_cursor { - pub pVtab: *mut sqlite3_vtab, -} -extern "C" { - pub fn sqlite3_declare_vtab( - arg1: *mut sqlite3, - zSQL: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_overload_function( - arg1: *mut sqlite3, - zFuncName: *const ::std::os::raw::c_char, - nArg: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_blob { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3_blob_open( - arg1: *mut sqlite3, - zDb: *const ::std::os::raw::c_char, - zTable: *const ::std::os::raw::c_char, - zColumn: *const ::std::os::raw::c_char, - iRow: sqlite3_int64, - flags: ::std::os::raw::c_int, - ppBlob: *mut *mut sqlite3_blob, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_blob_reopen( - arg1: *mut sqlite3_blob, - arg2: sqlite3_int64, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_blob_close(arg1: *mut sqlite3_blob) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_blob_bytes(arg1: *mut sqlite3_blob) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_blob_read( - arg1: *mut sqlite3_blob, - Z: *mut ::std::os::raw::c_void, - N: ::std::os::raw::c_int, - iOffset: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_blob_write( - arg1: *mut sqlite3_blob, - z: *const ::std::os::raw::c_void, - n: ::std::os::raw::c_int, - iOffset: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vfs_find(zVfsName: *const ::std::os::raw::c_char) -> *mut sqlite3_vfs; -} -extern "C" { - pub fn sqlite3_vfs_register( - arg1: *mut sqlite3_vfs, - makeDflt: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vfs_unregister(arg1: *mut sqlite3_vfs) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_mutex_alloc(arg1: ::std::os::raw::c_int) -> *mut sqlite3_mutex; -} -extern "C" { - pub fn sqlite3_mutex_free(arg1: *mut sqlite3_mutex); -} -extern "C" { - pub fn sqlite3_mutex_enter(arg1: *mut sqlite3_mutex); -} -extern "C" { - pub fn sqlite3_mutex_try(arg1: *mut sqlite3_mutex) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_mutex_leave(arg1: *mut sqlite3_mutex); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_mutex_methods { - pub xMutexInit: ::std::option::Option ::std::os::raw::c_int>, - pub xMutexEnd: ::std::option::Option ::std::os::raw::c_int>, - pub xMutexAlloc: ::std::option::Option< - unsafe extern "C" fn(arg1: ::std::os::raw::c_int) -> *mut sqlite3_mutex, - >, - pub xMutexFree: ::std::option::Option, - pub xMutexEnter: ::std::option::Option, - pub xMutexTry: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_mutex) -> ::std::os::raw::c_int, - >, - pub xMutexLeave: ::std::option::Option, - pub xMutexHeld: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_mutex) -> ::std::os::raw::c_int, - >, - pub xMutexNotheld: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_mutex) -> ::std::os::raw::c_int, - >, -} -extern "C" { - pub fn sqlite3_mutex_held(arg1: *mut sqlite3_mutex) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_mutex_notheld(arg1: *mut sqlite3_mutex) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_db_mutex(arg1: *mut sqlite3) -> *mut sqlite3_mutex; -} -extern "C" { - pub fn sqlite3_file_control( - arg1: *mut sqlite3, - zDbName: *const ::std::os::raw::c_char, - op: ::std::os::raw::c_int, - arg2: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_test_control(op: ::std::os::raw::c_int, ...) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_keyword_count() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_keyword_name( - arg1: ::std::os::raw::c_int, - arg2: *mut *const ::std::os::raw::c_char, - arg3: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_keyword_check( - arg1: *const ::std::os::raw::c_char, - arg2: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_str { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3_str_new(arg1: *mut sqlite3) -> *mut sqlite3_str; -} -extern "C" { - pub fn sqlite3_str_finish(arg1: *mut sqlite3_str) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_str_appendf(arg1: *mut sqlite3_str, zFormat: *const ::std::os::raw::c_char, ...); -} -extern "C" { - pub fn sqlite3_str_vappendf( - arg1: *mut sqlite3_str, - zFormat: *const ::std::os::raw::c_char, - arg2: va_list, - ); -} -extern "C" { - pub fn sqlite3_str_append( - arg1: *mut sqlite3_str, - zIn: *const ::std::os::raw::c_char, - N: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn sqlite3_str_appendall(arg1: *mut sqlite3_str, zIn: *const ::std::os::raw::c_char); -} -extern "C" { - pub fn sqlite3_str_appendchar( - arg1: *mut sqlite3_str, - N: ::std::os::raw::c_int, - C: ::std::os::raw::c_char, - ); -} -extern "C" { - pub fn sqlite3_str_reset(arg1: *mut sqlite3_str); -} -extern "C" { - pub fn sqlite3_str_errcode(arg1: *mut sqlite3_str) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_str_length(arg1: *mut sqlite3_str) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_str_value(arg1: *mut sqlite3_str) -> *mut ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_status( - op: ::std::os::raw::c_int, - pCurrent: *mut ::std::os::raw::c_int, - pHighwater: *mut ::std::os::raw::c_int, - resetFlag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_status64( - op: ::std::os::raw::c_int, - pCurrent: *mut sqlite3_int64, - pHighwater: *mut sqlite3_int64, - resetFlag: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_db_status( - arg1: *mut sqlite3, - op: ::std::os::raw::c_int, - pCur: *mut ::std::os::raw::c_int, - pHiwtr: *mut ::std::os::raw::c_int, - resetFlg: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_status( - arg1: *mut sqlite3_stmt, - op: ::std::os::raw::c_int, - resetFlg: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_pcache { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_pcache_page { - pub pBuf: *mut ::std::os::raw::c_void, - pub pExtra: *mut ::std::os::raw::c_void, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_pcache_methods2 { - pub iVersion: ::std::os::raw::c_int, - pub pArg: *mut ::std::os::raw::c_void, - pub xInit: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub xShutdown: ::std::option::Option, - pub xCreate: ::std::option::Option< - unsafe extern "C" fn( - szPage: ::std::os::raw::c_int, - szExtra: ::std::os::raw::c_int, - bPurgeable: ::std::os::raw::c_int, - ) -> *mut sqlite3_pcache, - >, - pub xCachesize: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_pcache, nCachesize: ::std::os::raw::c_int), - >, - pub xPagecount: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_pcache) -> ::std::os::raw::c_int, - >, - pub xFetch: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_pcache, - key: ::std::os::raw::c_uint, - createFlag: ::std::os::raw::c_int, - ) -> *mut sqlite3_pcache_page, - >, - pub xUnpin: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_pcache, - arg2: *mut sqlite3_pcache_page, - discard: ::std::os::raw::c_int, - ), - >, - pub xRekey: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_pcache, - arg2: *mut sqlite3_pcache_page, - oldKey: ::std::os::raw::c_uint, - newKey: ::std::os::raw::c_uint, - ), - >, - pub xTruncate: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_pcache, iLimit: ::std::os::raw::c_uint), - >, - pub xDestroy: ::std::option::Option, - pub xShrink: ::std::option::Option, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_pcache_methods { - pub pArg: *mut ::std::os::raw::c_void, - pub xInit: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pub xShutdown: ::std::option::Option, - pub xCreate: ::std::option::Option< - unsafe extern "C" fn( - szPage: ::std::os::raw::c_int, - bPurgeable: ::std::os::raw::c_int, - ) -> *mut sqlite3_pcache, - >, - pub xCachesize: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_pcache, nCachesize: ::std::os::raw::c_int), - >, - pub xPagecount: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_pcache) -> ::std::os::raw::c_int, - >, - pub xFetch: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_pcache, - key: ::std::os::raw::c_uint, - createFlag: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void, - >, - pub xUnpin: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_pcache, - arg2: *mut ::std::os::raw::c_void, - discard: ::std::os::raw::c_int, - ), - >, - pub xRekey: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_pcache, - arg2: *mut ::std::os::raw::c_void, - oldKey: ::std::os::raw::c_uint, - newKey: ::std::os::raw::c_uint, - ), - >, - pub xTruncate: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_pcache, iLimit: ::std::os::raw::c_uint), - >, - pub xDestroy: ::std::option::Option, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_backup { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3_backup_init( - pDest: *mut sqlite3, - zDestName: *const ::std::os::raw::c_char, - pSource: *mut sqlite3, - zSourceName: *const ::std::os::raw::c_char, - ) -> *mut sqlite3_backup; -} -extern "C" { - pub fn sqlite3_backup_step( - p: *mut sqlite3_backup, - nPage: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_backup_finish(p: *mut sqlite3_backup) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_backup_remaining(p: *mut sqlite3_backup) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_backup_pagecount(p: *mut sqlite3_backup) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_unlock_notify( - pBlocked: *mut sqlite3, - xNotify: ::std::option::Option< - unsafe extern "C" fn( - apArg: *mut *mut ::std::os::raw::c_void, - nArg: ::std::os::raw::c_int, - ), - >, - pNotifyArg: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stricmp( - arg1: *const ::std::os::raw::c_char, - arg2: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_strnicmp( - arg1: *const ::std::os::raw::c_char, - arg2: *const ::std::os::raw::c_char, - arg3: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_strglob( - zGlob: *const ::std::os::raw::c_char, - zStr: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_strlike( - zGlob: *const ::std::os::raw::c_char, - zStr: *const ::std::os::raw::c_char, - cEsc: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_log( - iErrCode: ::std::os::raw::c_int, - zFormat: *const ::std::os::raw::c_char, - ... - ); -} -extern "C" { - pub fn sqlite3_wal_hook( - arg1: *mut sqlite3, - arg2: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: *mut sqlite3, - arg3: *const ::std::os::raw::c_char, - arg4: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - arg3: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_wal_autocheckpoint( - db: *mut sqlite3, - N: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_wal_checkpoint( - db: *mut sqlite3, - zDb: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_wal_checkpoint_v2( - db: *mut sqlite3, - zDb: *const ::std::os::raw::c_char, - eMode: ::std::os::raw::c_int, - pnLog: *mut ::std::os::raw::c_int, - pnCkpt: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_config( - arg1: *mut sqlite3, - op: ::std::os::raw::c_int, - ... - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_on_conflict(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_nochange(arg1: *mut sqlite3_context) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_collation( - arg1: *mut sqlite3_index_info, - arg2: ::std::os::raw::c_int, - ) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn sqlite3_vtab_distinct(arg1: *mut sqlite3_index_info) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_in( - arg1: *mut sqlite3_index_info, - iCons: ::std::os::raw::c_int, - bHandle: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_in_first( - pVal: *mut sqlite3_value, - ppOut: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_in_next( - pVal: *mut sqlite3_value, - ppOut: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_vtab_rhs_value( - arg1: *mut sqlite3_index_info, - arg2: ::std::os::raw::c_int, - ppVal: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_scanstatus( - pStmt: *mut sqlite3_stmt, - idx: ::std::os::raw::c_int, - iScanStatusOp: ::std::os::raw::c_int, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_scanstatus_v2( - pStmt: *mut sqlite3_stmt, - idx: ::std::os::raw::c_int, - iScanStatusOp: ::std::os::raw::c_int, - flags: ::std::os::raw::c_int, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_stmt_scanstatus_reset(arg1: *mut sqlite3_stmt); -} -extern "C" { - pub fn sqlite3_db_cacheflush(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn libsql_close_hook( - db: *mut sqlite3, - xClose: ::std::option::Option< - unsafe extern "C" fn(pCtx: *mut ::std::os::raw::c_void, db: *mut sqlite3), - >, - arg: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn sqlite3_system_errno(arg1: *mut sqlite3) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_snapshot { - pub hidden: [::std::os::raw::c_uchar; 48usize], -} -extern "C" { - pub fn sqlite3_snapshot_get( - db: *mut sqlite3, - zSchema: *const ::std::os::raw::c_char, - ppSnapshot: *mut *mut sqlite3_snapshot, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_snapshot_open( - db: *mut sqlite3, - zSchema: *const ::std::os::raw::c_char, - pSnapshot: *mut sqlite3_snapshot, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_snapshot_free(arg1: *mut sqlite3_snapshot); -} -extern "C" { - pub fn sqlite3_snapshot_cmp( - p1: *mut sqlite3_snapshot, - p2: *mut sqlite3_snapshot, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_snapshot_recover( - db: *mut sqlite3, - zDb: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3_serialize( - db: *mut sqlite3, - zSchema: *const ::std::os::raw::c_char, - piSize: *mut sqlite3_int64, - mFlags: ::std::os::raw::c_uint, - ) -> *mut ::std::os::raw::c_uchar; -} -extern "C" { - pub fn sqlite3_deserialize( - db: *mut sqlite3, - zSchema: *const ::std::os::raw::c_char, - pData: *mut ::std::os::raw::c_uchar, - szDb: sqlite3_int64, - szBuf: sqlite3_int64, - mFlags: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int; -} -pub type sqlite3_rtree_dbl = f64; -extern "C" { - pub fn sqlite3_rtree_geometry_callback( - db: *mut sqlite3, - zGeom: *const ::std::os::raw::c_char, - xGeom: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut sqlite3_rtree_geometry, - arg2: ::std::os::raw::c_int, - arg3: *mut sqlite3_rtree_dbl, - arg4: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pContext: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_rtree_geometry { - pub pContext: *mut ::std::os::raw::c_void, - pub nParam: ::std::os::raw::c_int, - pub aParam: *mut sqlite3_rtree_dbl, - pub pUser: *mut ::std::os::raw::c_void, - pub xDelUser: ::std::option::Option, -} -extern "C" { - pub fn sqlite3_rtree_query_callback( - db: *mut sqlite3, - zQueryFunc: *const ::std::os::raw::c_char, - xQueryFunc: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut sqlite3_rtree_query_info) -> ::std::os::raw::c_int, - >, - pContext: *mut ::std::os::raw::c_void, - xDestructor: ::std::option::Option, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_rtree_query_info { - pub pContext: *mut ::std::os::raw::c_void, - pub nParam: ::std::os::raw::c_int, - pub aParam: *mut sqlite3_rtree_dbl, - pub pUser: *mut ::std::os::raw::c_void, - pub xDelUser: ::std::option::Option, - pub aCoord: *mut sqlite3_rtree_dbl, - pub anQueue: *mut ::std::os::raw::c_uint, - pub nCoord: ::std::os::raw::c_int, - pub iLevel: ::std::os::raw::c_int, - pub mxLevel: ::std::os::raw::c_int, - pub iRowid: sqlite3_int64, - pub rParentScore: sqlite3_rtree_dbl, - pub eParentWithin: ::std::os::raw::c_int, - pub eWithin: ::std::os::raw::c_int, - pub rScore: sqlite3_rtree_dbl, - pub apSqlParam: *mut *mut sqlite3_value, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_session { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_changeset_iter { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3session_create( - db: *mut sqlite3, - zDb: *const ::std::os::raw::c_char, - ppSession: *mut *mut sqlite3_session, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_delete(pSession: *mut sqlite3_session); -} -extern "C" { - pub fn sqlite3session_object_config( - arg1: *mut sqlite3_session, - op: ::std::os::raw::c_int, - pArg: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_enable( - pSession: *mut sqlite3_session, - bEnable: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_indirect( - pSession: *mut sqlite3_session, - bIndirect: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_attach( - pSession: *mut sqlite3_session, - zTab: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_table_filter( - pSession: *mut sqlite3_session, - xFilter: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - zTab: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pCtx: *mut ::std::os::raw::c_void, - ); -} -extern "C" { - pub fn sqlite3session_changeset( - pSession: *mut sqlite3_session, - pnChangeset: *mut ::std::os::raw::c_int, - ppChangeset: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_changeset_size(pSession: *mut sqlite3_session) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3session_diff( - pSession: *mut sqlite3_session, - zFromDb: *const ::std::os::raw::c_char, - zTbl: *const ::std::os::raw::c_char, - pzErrMsg: *mut *mut ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_patchset( - pSession: *mut sqlite3_session, - pnPatchset: *mut ::std::os::raw::c_int, - ppPatchset: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_isempty(pSession: *mut sqlite3_session) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_memory_used(pSession: *mut sqlite3_session) -> sqlite3_int64; -} -extern "C" { - pub fn sqlite3changeset_start( - pp: *mut *mut sqlite3_changeset_iter, - nChangeset: ::std::os::raw::c_int, - pChangeset: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_start_v2( - pp: *mut *mut sqlite3_changeset_iter, - nChangeset: ::std::os::raw::c_int, - pChangeset: *mut ::std::os::raw::c_void, - flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_next(pIter: *mut sqlite3_changeset_iter) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_op( - pIter: *mut sqlite3_changeset_iter, - pzTab: *mut *const ::std::os::raw::c_char, - pnCol: *mut ::std::os::raw::c_int, - pOp: *mut ::std::os::raw::c_int, - pbIndirect: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_pk( - pIter: *mut sqlite3_changeset_iter, - pabPK: *mut *mut ::std::os::raw::c_uchar, - pnCol: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_old( - pIter: *mut sqlite3_changeset_iter, - iVal: ::std::os::raw::c_int, - ppValue: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_new( - pIter: *mut sqlite3_changeset_iter, - iVal: ::std::os::raw::c_int, - ppValue: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_conflict( - pIter: *mut sqlite3_changeset_iter, - iVal: ::std::os::raw::c_int, - ppValue: *mut *mut sqlite3_value, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_fk_conflicts( - pIter: *mut sqlite3_changeset_iter, - pnOut: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_finalize(pIter: *mut sqlite3_changeset_iter) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_invert( - nIn: ::std::os::raw::c_int, - pIn: *const ::std::os::raw::c_void, - pnOut: *mut ::std::os::raw::c_int, - ppOut: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_concat( - nA: ::std::os::raw::c_int, - pA: *mut ::std::os::raw::c_void, - nB: ::std::os::raw::c_int, - pB: *mut ::std::os::raw::c_void, - pnOut: *mut ::std::os::raw::c_int, - ppOut: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_changegroup { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3changegroup_new(pp: *mut *mut sqlite3_changegroup) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changegroup_add( - arg1: *mut sqlite3_changegroup, - nData: ::std::os::raw::c_int, - pData: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changegroup_output( - arg1: *mut sqlite3_changegroup, - pnData: *mut ::std::os::raw::c_int, - ppData: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changegroup_delete(arg1: *mut sqlite3_changegroup); -} -extern "C" { - pub fn sqlite3changeset_apply( - db: *mut sqlite3, - nChangeset: ::std::os::raw::c_int, - pChangeset: *mut ::std::os::raw::c_void, - xFilter: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - zTab: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - xConflict: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - eConflict: ::std::os::raw::c_int, - p: *mut sqlite3_changeset_iter, - ) -> ::std::os::raw::c_int, - >, - pCtx: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_apply_v2( - db: *mut sqlite3, - nChangeset: ::std::os::raw::c_int, - pChangeset: *mut ::std::os::raw::c_void, - xFilter: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - zTab: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - xConflict: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - eConflict: ::std::os::raw::c_int, - p: *mut sqlite3_changeset_iter, - ) -> ::std::os::raw::c_int, - >, - pCtx: *mut ::std::os::raw::c_void, - ppRebase: *mut *mut ::std::os::raw::c_void, - pnRebase: *mut ::std::os::raw::c_int, - flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_rebaser { - _unused: [u8; 0], -} -extern "C" { - pub fn sqlite3rebaser_create(ppNew: *mut *mut sqlite3_rebaser) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3rebaser_configure( - arg1: *mut sqlite3_rebaser, - nRebase: ::std::os::raw::c_int, - pRebase: *const ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3rebaser_rebase( - arg1: *mut sqlite3_rebaser, - nIn: ::std::os::raw::c_int, - pIn: *const ::std::os::raw::c_void, - pnOut: *mut ::std::os::raw::c_int, - ppOut: *mut *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3rebaser_delete(p: *mut sqlite3_rebaser); -} -extern "C" { - pub fn sqlite3changeset_apply_strm( - db: *mut sqlite3, - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - xFilter: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - zTab: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - xConflict: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - eConflict: ::std::os::raw::c_int, - p: *mut sqlite3_changeset_iter, - ) -> ::std::os::raw::c_int, - >, - pCtx: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_apply_v2_strm( - db: *mut sqlite3, - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - xFilter: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - zTab: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - xConflict: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - eConflict: ::std::os::raw::c_int, - p: *mut sqlite3_changeset_iter, - ) -> ::std::os::raw::c_int, - >, - pCtx: *mut ::std::os::raw::c_void, - ppRebase: *mut *mut ::std::os::raw::c_void, - pnRebase: *mut ::std::os::raw::c_int, - flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_concat_strm( - xInputA: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pInA: *mut ::std::os::raw::c_void, - xInputB: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pInB: *mut ::std::os::raw::c_void, - xOutput: ::std::option::Option< - unsafe extern "C" fn( - pOut: *mut ::std::os::raw::c_void, - pData: *const ::std::os::raw::c_void, - nData: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_invert_strm( - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - xOutput: ::std::option::Option< - unsafe extern "C" fn( - pOut: *mut ::std::os::raw::c_void, - pData: *const ::std::os::raw::c_void, - nData: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_start_strm( - pp: *mut *mut sqlite3_changeset_iter, - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changeset_start_v2_strm( - pp: *mut *mut sqlite3_changeset_iter, - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - flags: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_changeset_strm( - pSession: *mut sqlite3_session, - xOutput: ::std::option::Option< - unsafe extern "C" fn( - pOut: *mut ::std::os::raw::c_void, - pData: *const ::std::os::raw::c_void, - nData: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_patchset_strm( - pSession: *mut sqlite3_session, - xOutput: ::std::option::Option< - unsafe extern "C" fn( - pOut: *mut ::std::os::raw::c_void, - pData: *const ::std::os::raw::c_void, - nData: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changegroup_add_strm( - arg1: *mut sqlite3_changegroup, - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3changegroup_output_strm( - arg1: *mut sqlite3_changegroup, - xOutput: ::std::option::Option< - unsafe extern "C" fn( - pOut: *mut ::std::os::raw::c_void, - pData: *const ::std::os::raw::c_void, - nData: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3rebaser_rebase_strm( - pRebaser: *mut sqlite3_rebaser, - xInput: ::std::option::Option< - unsafe extern "C" fn( - pIn: *mut ::std::os::raw::c_void, - pData: *mut ::std::os::raw::c_void, - pnData: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pIn: *mut ::std::os::raw::c_void, - xOutput: ::std::option::Option< - unsafe extern "C" fn( - pOut: *mut ::std::os::raw::c_void, - pData: *const ::std::os::raw::c_void, - nData: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pOut: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn sqlite3session_config( - op: ::std::os::raw::c_int, - pArg: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Fts5Context { - _unused: [u8; 0], -} -pub type fts5_extension_function = ::std::option::Option< - unsafe extern "C" fn( - pApi: *const Fts5ExtensionApi, - pFts: *mut Fts5Context, - pCtx: *mut sqlite3_context, - nVal: ::std::os::raw::c_int, - apVal: *mut *mut sqlite3_value, - ), ->; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Fts5PhraseIter { - pub a: *const ::std::os::raw::c_uchar, - pub b: *const ::std::os::raw::c_uchar, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Fts5ExtensionApi { - pub iVersion: ::std::os::raw::c_int, - pub xUserData: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut Fts5Context) -> *mut ::std::os::raw::c_void, - >, - pub xColumnCount: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut Fts5Context) -> ::std::os::raw::c_int, - >, - pub xRowCount: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - pnRow: *mut sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xColumnTotalSize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iCol: ::std::os::raw::c_int, - pnToken: *mut sqlite3_int64, - ) -> ::std::os::raw::c_int, - >, - pub xTokenize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - pText: *const ::std::os::raw::c_char, - nText: ::std::os::raw::c_int, - pCtx: *mut ::std::os::raw::c_void, - xToken: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_int, - arg3: *const ::std::os::raw::c_char, - arg4: ::std::os::raw::c_int, - arg5: ::std::os::raw::c_int, - arg6: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int, - >, - pub xPhraseCount: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut Fts5Context) -> ::std::os::raw::c_int, - >, - pub xPhraseSize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iPhrase: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xInstCount: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - pnInst: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xInst: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iIdx: ::std::os::raw::c_int, - piPhrase: *mut ::std::os::raw::c_int, - piCol: *mut ::std::os::raw::c_int, - piOff: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xRowid: - ::std::option::Option sqlite3_int64>, - pub xColumnText: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iCol: ::std::os::raw::c_int, - pz: *mut *const ::std::os::raw::c_char, - pn: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xColumnSize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iCol: ::std::os::raw::c_int, - pnToken: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xQueryPhrase: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iPhrase: ::std::os::raw::c_int, - pUserData: *mut ::std::os::raw::c_void, - arg2: ::std::option::Option< - unsafe extern "C" fn( - arg1: *const Fts5ExtensionApi, - arg2: *mut Fts5Context, - arg3: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int, - >, - pub xSetAuxdata: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - pAux: *mut ::std::os::raw::c_void, - xDelete: ::std::option::Option, - ) -> ::std::os::raw::c_int, - >, - pub xGetAuxdata: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - bClear: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void, - >, - pub xPhraseFirst: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iPhrase: ::std::os::raw::c_int, - arg2: *mut Fts5PhraseIter, - arg3: *mut ::std::os::raw::c_int, - arg4: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xPhraseNext: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - arg2: *mut Fts5PhraseIter, - piCol: *mut ::std::os::raw::c_int, - piOff: *mut ::std::os::raw::c_int, - ), - >, - pub xPhraseFirstColumn: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - iPhrase: ::std::os::raw::c_int, - arg2: *mut Fts5PhraseIter, - arg3: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xPhraseNextColumn: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Context, - arg2: *mut Fts5PhraseIter, - piCol: *mut ::std::os::raw::c_int, - ), - >, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Fts5Tokenizer { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct fts5_tokenizer { - pub xCreate: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - azArg: *mut *const ::std::os::raw::c_char, - nArg: ::std::os::raw::c_int, - ppOut: *mut *mut Fts5Tokenizer, - ) -> ::std::os::raw::c_int, - >, - pub xDelete: ::std::option::Option, - pub xTokenize: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut Fts5Tokenizer, - pCtx: *mut ::std::os::raw::c_void, - flags: ::std::os::raw::c_int, - pText: *const ::std::os::raw::c_char, - nText: ::std::os::raw::c_int, - xToken: ::std::option::Option< - unsafe extern "C" fn( - pCtx: *mut ::std::os::raw::c_void, - tflags: ::std::os::raw::c_int, - pToken: *const ::std::os::raw::c_char, - nToken: ::std::os::raw::c_int, - iStart: ::std::os::raw::c_int, - iEnd: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - ) -> ::std::os::raw::c_int, - >, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct fts5_api { - pub iVersion: ::std::os::raw::c_int, - pub xCreateTokenizer: ::std::option::Option< - unsafe extern "C" fn( - pApi: *mut fts5_api, - zName: *const ::std::os::raw::c_char, - pUserData: *mut ::std::os::raw::c_void, - pTokenizer: *mut fts5_tokenizer, - xDestroy: ::std::option::Option, - ) -> ::std::os::raw::c_int, - >, - pub xFindTokenizer: ::std::option::Option< - unsafe extern "C" fn( - pApi: *mut fts5_api, - zName: *const ::std::os::raw::c_char, - ppUserData: *mut *mut ::std::os::raw::c_void, - pTokenizer: *mut fts5_tokenizer, - ) -> ::std::os::raw::c_int, - >, - pub xCreateFunction: ::std::option::Option< - unsafe extern "C" fn( - pApi: *mut fts5_api, - zName: *const ::std::os::raw::c_char, - pUserData: *mut ::std::os::raw::c_void, - xFunction: fts5_extension_function, - xDestroy: ::std::option::Option, - ) -> ::std::os::raw::c_int, - >, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct Pager { - _unused: [u8; 0], -} -pub type PgHdr = libsql_pghdr; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct PCache { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct libsql_pghdr { - pub pPage: *mut sqlite3_pcache_page, - pub pData: *mut ::std::os::raw::c_void, - pub pExtra: *mut ::std::os::raw::c_void, - pub pCache: *mut PCache, - pub pDirty: *mut PgHdr, - pub pPager: *mut Pager, - pub pgno: ::std::os::raw::c_uint, - pub pageHash: ::std::os::raw::c_uint, - pub flags: ::std::os::raw::c_ushort, - #[doc = " Elements above, except pCache, are public. All that follow are\n private to pcache.c and should not be accessed by other modules.\n pCache is grouped with the public elements for efficiency."] - pub nRef: ::std::os::raw::c_ulonglong, - pub pDirtyNext: *mut PgHdr, - pub pDirtyPrev: *mut PgHdr, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct wal_impl { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct create_wal_impl { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct libsql_wal_methods { - pub iVersion: ::std::os::raw::c_int, - pub xLimit: ::std::option::Option< - unsafe extern "C" fn(pWal: *mut wal_impl, limit: ::std::os::raw::c_longlong), - >, - pub xBeginReadTransaction: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - arg1: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xEndReadTransaction: ::std::option::Option, - pub xFindFrame: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - arg1: ::std::os::raw::c_uint, - arg2: *mut ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int, - >, - pub xReadFrame: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - arg1: ::std::os::raw::c_uint, - arg2: ::std::os::raw::c_int, - arg3: *mut ::std::os::raw::c_uchar, - ) -> ::std::os::raw::c_int, - >, - pub xDbsize: - ::std::option::Option ::std::os::raw::c_uint>, - pub xBeginWriteTransaction: - ::std::option::Option ::std::os::raw::c_int>, - pub xEndWriteTransaction: - ::std::option::Option ::std::os::raw::c_int>, - pub xUndo: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - xUndo: ::std::option::Option< - unsafe extern "C" fn( - arg1: *mut ::std::os::raw::c_void, - arg2: ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int, - >, - pUndoCtx: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int, - >, - pub xSavepoint: ::std::option::Option< - unsafe extern "C" fn(pWal: *mut wal_impl, aWalData: *mut ::std::os::raw::c_uint), - >, - pub xSavepointUndo: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - aWalData: *mut ::std::os::raw::c_uint, - ) -> ::std::os::raw::c_int, - >, - pub xFrames: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - arg1: ::std::os::raw::c_int, - arg2: *mut libsql_pghdr, - arg3: ::std::os::raw::c_uint, - arg4: ::std::os::raw::c_int, - arg5: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xCheckpoint: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - db: *mut sqlite3, - eMode: ::std::os::raw::c_int, - xBusy: ::std::option::Option< - unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, - >, - pBusyArg: *mut ::std::os::raw::c_void, - sync_flags: ::std::os::raw::c_int, - nBuf: ::std::os::raw::c_int, - zBuf: *mut ::std::os::raw::c_uchar, - pnLog: *mut ::std::os::raw::c_int, - pnCkpt: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xCallback: - ::std::option::Option ::std::os::raw::c_int>, - pub xExclusiveMode: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - op: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xHeapMemory: - ::std::option::Option ::std::os::raw::c_int>, - pub xSnapshotGet: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - ppSnapshot: *mut *mut sqlite3_snapshot, - ) -> ::std::os::raw::c_int, - >, - pub xSnapshotOpen: ::std::option::Option< - unsafe extern "C" fn(pWal: *mut wal_impl, pSnapshot: *mut sqlite3_snapshot), - >, - pub xSnapshotRecover: - ::std::option::Option ::std::os::raw::c_int>, - pub xSnapshotCheck: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut ::std::os::raw::c_void, - pSnapshot: *mut sqlite3_snapshot, - ) -> ::std::os::raw::c_int, - >, - pub xSnapshotUnlock: ::std::option::Option, - pub xFramesize: - ::std::option::Option ::std::os::raw::c_int>, - pub xFile: - ::std::option::Option *mut sqlite3_file>, - pub xWriteLock: ::std::option::Option< - unsafe extern "C" fn( - pWal: *mut wal_impl, - bLock: ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xDb: ::std::option::Option, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct WalIterator { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct WalCkptInfo { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct WalIndexHdr { - pub iVersion: ::std::os::raw::c_uint, - pub unused: ::std::os::raw::c_uint, - pub iChange: ::std::os::raw::c_uint, - pub isInit: ::std::os::raw::c_uchar, - pub bigEndCksum: ::std::os::raw::c_uchar, - pub szPage: ::std::os::raw::c_ushort, - pub mxFrame: ::std::os::raw::c_uint, - pub nPage: ::std::os::raw::c_uint, - pub aFrameCksum: [::std::os::raw::c_uint; 2usize], - pub aSalt: [::std::os::raw::c_uint; 2usize], - pub aCksum: [::std::os::raw::c_uint; 2usize], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct libsql_create_wal { - pub bUsesShm: ::std::os::raw::c_int, - pub xOpen: ::std::option::Option< - unsafe extern "C" fn( - pData: *mut create_wal_impl, - arg1: *mut sqlite3_vfs, - arg2: *mut sqlite3_file, - no_shm_mode: ::std::os::raw::c_int, - max_size: ::std::os::raw::c_longlong, - zMainDbFileName: *const ::std::os::raw::c_char, - out_wal: *mut libsql_wal, - ) -> ::std::os::raw::c_int, - >, - pub xClose: ::std::option::Option< - unsafe extern "C" fn( - pData: *mut create_wal_impl, - pWal: *mut wal_impl, - db: *mut sqlite3, - sync_flags: ::std::os::raw::c_int, - nBuf: ::std::os::raw::c_int, - zBuf: *mut ::std::os::raw::c_uchar, - ) -> ::std::os::raw::c_int, - >, - pub xLogDestroy: ::std::option::Option< - unsafe extern "C" fn( - pData: *mut create_wal_impl, - vfs: *mut sqlite3_vfs, - zMainDbFileName: *const ::std::os::raw::c_char, - ) -> ::std::os::raw::c_int, - >, - pub xLogExists: ::std::option::Option< - unsafe extern "C" fn( - pData: *mut create_wal_impl, - vfs: *mut sqlite3_vfs, - zMainDbFileName: *const ::std::os::raw::c_char, - exist: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int, - >, - pub xDestroy: ::std::option::Option, - pub pData: *mut create_wal_impl, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct sqlite3_wal { - pub pVfs: *mut sqlite3_vfs, - pub pDbFd: *mut sqlite3_file, - pub pWalFd: *mut sqlite3_file, - pub iCallback: ::std::os::raw::c_uint, - pub mxWalSize: ::std::os::raw::c_longlong, - pub nWiData: ::std::os::raw::c_int, - pub szFirstBlock: ::std::os::raw::c_int, - pub apWiData: *mut *mut ::std::os::raw::c_uint, - pub szPage: ::std::os::raw::c_uint, - pub readLock: ::std::os::raw::c_short, - pub syncFlags: ::std::os::raw::c_uchar, - pub exclusiveMode: ::std::os::raw::c_uchar, - pub writeLock: ::std::os::raw::c_uchar, - pub ckptLock: ::std::os::raw::c_uchar, - pub readOnly: ::std::os::raw::c_uchar, - pub truncateOnCommit: ::std::os::raw::c_uchar, - pub syncHeader: ::std::os::raw::c_uchar, - pub padToSectorBoundary: ::std::os::raw::c_uchar, - pub bShmUnreliable: ::std::os::raw::c_uchar, - pub hdr: WalIndexHdr, - pub minFrame: ::std::os::raw::c_uint, - pub iReCksum: ::std::os::raw::c_uint, - pub zWalName: *const ::std::os::raw::c_char, - pub nCkpt: ::std::os::raw::c_uint, - pub lockError: ::std::os::raw::c_uchar, - pub pSnapshot: *mut WalIndexHdr, - pub db: *mut sqlite3, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct libsql_wal { - pub methods: libsql_wal_methods, - pub pData: *mut wal_impl, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct RefCountCreateWal { - pub n: ::std::os::raw::c_int, - pub ref_: libsql_create_wal, -} -extern "C" { - pub fn make_ref_counted_create_wal( - create_wal: libsql_create_wal, - out: *mut *mut RefCountCreateWal, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn destroy_create_wal(p: *mut RefCountCreateWal); -} -extern "C" { - pub fn clone_create_wal(p: *mut RefCountCreateWal) -> *mut RefCountCreateWal; -} -extern "C" { - pub static mut sqlite3_create_wal: libsql_create_wal; -} -pub type __builtin_va_list = *mut ::std::os::raw::c_char; diff --git a/libsql-ffi/src/lib.rs b/libsql-ffi/src/lib.rs index e039091921..b475968c80 100644 --- a/libsql-ffi/src/lib.rs +++ b/libsql-ffi/src/lib.rs @@ -7,6 +7,11 @@ use std::fmt; use std::mem; use std::os::raw::c_int; +#[cfg(feature = "wasmtime-bindings")] +pub use libsql_wasm::{ + libsql_compile_wasm_module, libsql_free_wasm_module, libsql_run_wasm, libsql_wasm_engine_new, +}; + include!(concat!(env!("OUT_DIR"), "/bindgen.rs")); #[must_use] diff --git a/libsql-sqlite3/test/rust_suite/Cargo.toml b/libsql-sqlite3/test/rust_suite/Cargo.toml index 42d5da6ae0..6c2425d1c4 100644 --- a/libsql-sqlite3/test/rust_suite/Cargo.toml +++ b/libsql-sqlite3/test/rust_suite/Cargo.toml @@ -8,13 +8,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dev-dependencies] -rusqlite = { version = "0.29.0", git = "https://github.com/psarna/rusqlite", rev = "d9a97c0f25", default-features = false, features = [ - "buildtime_bindgen", - "libsql-experimental", - "libsql-wasm-experimental", - "column_decltype", - "load_extension" -] } +libsql-sys = { path = "../../../libsql-sys", features = ["wal", "wasmtime-bindings", "rusqlite"], default_features = false } itertools = "0.10" tempfile = "3.3" diff --git a/libsql-sqlite3/test/rust_suite/src/alter_column.rs b/libsql-sqlite3/test/rust_suite/src/alter_column.rs index 380587d40a..e101e57e2c 100644 --- a/libsql-sqlite3/test/rust_suite/src/alter_column.rs +++ b/libsql-sqlite3/test/rust_suite/src/alter_column.rs @@ -1,4 +1,4 @@ -use rusqlite::Connection; +use libsql_sys::rusqlite::Connection; #[test] fn test_update_column_check() { @@ -60,6 +60,9 @@ fn test_update_not_null_constraint() { fn test_update_references_foreign_key() { let conn = Connection::open_in_memory().unwrap(); + // default foreign key is set to 1 in compile options. + conn.execute("PRAGMA foreign_keys = OFF", ()).unwrap(); + conn.execute("CREATE TABLE t1(id int primary key)", ()) .unwrap(); conn.execute("CREATE TABLE t2(id int primary key, v text, t1_id)", ()) @@ -73,6 +76,7 @@ fn test_update_references_foreign_key() { // Inserting a row with a non-existent foreign key is ok, because those are not validated by default assert!(conn .execute("INSERT INTO t2 VALUES (1, 'a', 42)", ()) + .map_err(|e| dbg!(e)) .is_ok()); // Now they should be validated conn.execute("PRAGMA foreign_keys = ON", ()).unwrap(); diff --git a/libsql-sqlite3/test/rust_suite/src/lib.rs b/libsql-sqlite3/test/rust_suite/src/lib.rs index 607fddae55..86c2f517ea 100644 --- a/libsql-sqlite3/test/rust_suite/src/lib.rs +++ b/libsql-sqlite3/test/rust_suite/src/lib.rs @@ -12,15 +12,17 @@ mod user_defined_functions_src; mod tests { extern "C" { fn libsql_close_hook( - db: *mut rusqlite::ffi::sqlite3, + db: *mut libsql_sys::ffi::sqlite3, callback: Option< - unsafe fn(arg: *mut std::ffi::c_void, db: *mut rusqlite::ffi::sqlite3), + extern "C" fn(arg: *mut std::ffi::c_void, db: *mut libsql_sys::ffi::sqlite3), >, arg: *mut std::ffi::c_void, ); } - use rusqlite::Connection; + use std::ffi::c_void; + + use libsql_sys::rusqlite::Connection; #[derive(Debug, PartialEq)] struct Person { @@ -73,8 +75,8 @@ mod tests { let mut rows = stmt.query(()).unwrap(); while let Ok(Some(_)) = rows.next() {} drop(rows); - let mut rows_read = rusqlite::StatementStatus::FullscanStep; - let mut rows_written = rusqlite::StatementStatus::FullscanStep; + let mut rows_read = libsql_sys::rusqlite::StatementStatus::FullscanStep; + let mut rows_written = libsql_sys::rusqlite::StatementStatus::FullscanStep; // FIXME: there's no API for ROWS_READ/WRITTEN yet, so let's rewrite to checking ROWS_* instead unsafe { std::ptr::copy( @@ -152,14 +154,18 @@ mod tests { fn test_close_hook() { let conn = Connection::open_in_memory().unwrap(); let mut closed = false; + + extern "C" fn cb(closed: *mut c_void, _db: *mut libsql_sys::ffi::sqlite3) { + unsafe { + println!("Close hook called!"); + let closed = &mut *(closed as *mut bool); + *closed = true; + } + } unsafe { libsql_close_hook( conn.handle(), - Some(|closed, _db| { - println!("Close hook called!"); - let closed = &mut *(closed as *mut bool); - *closed = true; - }), + Some(cb), &mut closed as *mut _ as *mut _, ); } diff --git a/libsql-sqlite3/test/rust_suite/src/random_rowid.rs b/libsql-sqlite3/test/rust_suite/src/random_rowid.rs index 2425d672ee..ce5cbf3cb3 100644 --- a/libsql-sqlite3/test/rust_suite/src/random_rowid.rs +++ b/libsql-sqlite3/test/rust_suite/src/random_rowid.rs @@ -1,6 +1,6 @@ #[cfg(test)] mod tests { - use rusqlite::Connection; + use libsql_sys::rusqlite::Connection; // Test that RANDOM ROWID tables indeed generate rowid values in a pseudorandom way #[test] diff --git a/libsql-sqlite3/test/rust_suite/src/virtual_wal.rs b/libsql-sqlite3/test/rust_suite/src/virtual_wal.rs index 735c50776c..30bea33cc3 100644 --- a/libsql-sqlite3/test/rust_suite/src/virtual_wal.rs +++ b/libsql-sqlite3/test/rust_suite/src/virtual_wal.rs @@ -1,413 +1,160 @@ #![allow(improper_ctypes)] #[cfg(test)] mod tests { - use rusqlite::Connection; - use std::ffi::c_void; + use libsql_sys::wal::{CreateWal, CreateSqlite3Wal, Sqlite3Wal, Wal, make_create_wal}; + use libsql_sys::rusqlite::{Connection, OpenFlags}; - const ERR_MISUSE: i32 = 21; - - #[repr(C)] - struct Wal { - vfs: *const c_void, - db_fd: *const c_void, - wal_fd: *const c_void, - callback_value: u32, - max_wal_size: i64, - wi_data: i32, - size_first_block: i32, - ap_wi_data: *const *mut u32, - page_size: u32, - read_lock: i16, - sync_flags: u8, - exclusive_mode: u8, - write_lock: u8, - checkpoint_lock: u8, - read_only: u8, - truncate_on_commit: u8, - sync_header: u8, - pad_to_section_boundary: u8, - b_shm_unreliable: u8, - hdr: WalIndexHdr, - min_frame: u32, - recalculate_checksums: u32, - wal_name: *const u8, - n_checkpoints: u32, - lock_error: u8, - p_snapshot: *const c_void, - p_db: *const c_void, - wal_methods: *mut libsql_wal_methods, - p_methods_data: *mut c_void, + /// A create_wal the simple wraps sqlite3 WAL + struct WrapCreateWal { + inner: CreateSqlite3Wal, } - #[repr(C)] - struct WalIndexHdr { - version: u32, - unused: u32, - change: u32, - is_init: u8, - big_endian_checksum: u8, - page_size: u16, - last_valid_frame: u32, - n_pages: u32, - frame_checksum: [u32; 2], - salt: [u32; 2], - checksum: [u32; 2], - } + impl CreateWal for WrapCreateWal { + type Wal = WrapWal; - #[repr(C)] - struct libsql_wal_methods { - iversion: i32, - open: extern "C" fn( - vfs: *const c_void, - file: *const c_void, - wal_name: *const u8, - no_shm_mode: i32, - max_size: i64, - methods: *mut libsql_wal_methods, - wal: *mut *const Wal, - ) -> i32, - close: extern "C" fn( - wal: *mut Wal, - db: *mut c_void, - sync_flags: i32, - n_buf: i32, - z_buf: *mut u8, - ) -> i32, - limit: extern "C" fn(wal: *mut Wal, limit: i64), - begin_read: extern "C" fn(wal: *mut Wal, changed: *mut i32) -> i32, - end_read: extern "C" fn(wal: *mut Wal) -> i32, - find_frame: extern "C" fn(wal: *mut Wal, pgno: i32, frame: *mut i32) -> i32, - read_frame: extern "C" fn(wal: *mut Wal, frame: u32, n_out: i32, p_out: *mut u8) -> i32, - db_size: extern "C" fn(wal: *mut Wal) -> i32, - begin_write: extern "C" fn(wal: *mut Wal) -> i32, - end_write: extern "C" fn(wal: *mut Wal) -> i32, - undo: extern "C" fn( - wal: *const extern "C" fn(*mut c_void, i32) -> i32, - ctx: *mut c_void, - ) -> i32, - savepoint: extern "C" fn(wal: *mut Wal, wal_data: *mut u32), - savepoint_undo: extern "C" fn(wal: *mut Wal, wal_data: *mut u32) -> i32, - frames: extern "C" fn( - wal: *mut Wal, - page_size: u32, - page_headers: *const PgHdr, - size_after: i32, - is_commit: i32, - sync_flags: i32, - ) -> i32, - checkpoint: extern "C" fn( - wal: *mut Wal, - db: *mut c_void, - emode: i32, - busy_handler: extern "C" fn(busy_param: *mut c_void) -> i32, - sync_flags: i32, - n_buf: i32, - z_buf: *mut u8, - frames_in_wal: *mut i32, - backfilled_frames: *mut i32, - ) -> i32, - callback: extern "C" fn(wal: *mut Wal) -> i32, - exclusive_mode: extern "C" fn(wal: *mut Wal) -> i32, - heap_memory: extern "C" fn(wal: *mut Wal) -> i32, - // stubs, only useful with snapshot support compiled-in - snapshot_get_stub: *const c_void, - snapshot_open_stub: *const c_void, - snapshot_recover_stub: *const c_void, - snapshot_check_stub: *const c_void, - snapshot_unlock_stub: *const c_void, - // stub, only useful with zipfs support compiled-in - framesize_stub: *const c_void, - file: extern "C" fn(wal: *mut Wal) -> *const c_void, - // stub, only useful with setlk timeout compiled-in - write_lock_stub: *const c_void, - db: extern "C" fn(wal: *mut Wal, db: *const c_void), - pathname_len: extern "C" fn(orig_len: i32) -> i32, - get_pathname: extern "C" fn(buf: *mut u8, orig: *const u8, orig_len: i32), - pre_main_db_open: extern "C" fn(methods: *mut libsql_wal_methods, name: *const i8) -> i32, - b_uses_shm: i32, - name: *const u8, - p_next: *const c_void, + fn use_shared_memory(&self) -> bool { + self.inner.use_shared_memory() + } - // User data - pages: std::collections::HashMap>, - } + fn open( + &self, + vfs: &mut libsql_sys::wal::Vfs, + file: &mut libsql_sys::wal::Sqlite3File, + no_shm_mode: std::ffi::c_int, + max_log_size: i64, + db_path: &std::ffi::CStr, + ) -> libsql_sys::wal::Result { + self.inner.open(vfs, file, no_shm_mode, max_log_size, db_path).map(WrapWal) + } - #[repr(C)] - struct PgHdr { - page: *const c_void, - data: *const c_void, - extra: *const c_void, - pcache: *const c_void, - dirty: *const PgHdr, - pager: *const c_void, - pgno: i32, - flags: u16, - } + fn close( + &self, + wal: &mut Self::Wal, + db: &mut libsql_sys::wal::Sqlite3Db, + sync_flags: std::ffi::c_int, + scratch: &mut [u8], + ) -> libsql_sys::wal::Result<()> { + self.inner.close(&mut wal.0, db, sync_flags, scratch) + } - extern "C" { - fn libsql_open( - filename: *const u8, - ppdb: *mut *mut rusqlite::ffi::sqlite3, - flags: i32, - vfs: *const u8, - wal: *const u8, - ) -> i32; - fn libsql_wal_methods_register(wal_methods: *const libsql_wal_methods) -> i32; - fn sqlite3_initialize(); - } + fn destroy_log(&self, vfs: &mut libsql_sys::wal::Vfs, db_path: &std::ffi::CStr) -> libsql_sys::wal::Result<()> { + self.inner.destroy_log(vfs, db_path) + } - extern "C" fn open( - vfs: *const c_void, - _file: *const c_void, - wal_name: *const u8, - _no_shm_mode: i32, - max_size: i64, - methods: *mut libsql_wal_methods, - wal: *mut *const Wal, - ) -> i32 { - let new_wal = Box::new(Wal { - vfs, - db_fd: std::ptr::null(), - wal_fd: std::ptr::null(), - callback_value: 0, - max_wal_size: max_size, - wi_data: 0, - size_first_block: 0, - ap_wi_data: std::ptr::null(), - page_size: 4096, - read_lock: 0, - sync_flags: 0, - exclusive_mode: 1, - write_lock: 0, - checkpoint_lock: 0, - read_only: 0, - truncate_on_commit: 0, - sync_header: 0, - pad_to_section_boundary: 0, - b_shm_unreliable: 1, - hdr: WalIndexHdr { - version: 1, - unused: 0, - change: 0, - is_init: 0, - big_endian_checksum: 0, - page_size: 4096, - last_valid_frame: 1, - n_pages: 1, - frame_checksum: [0, 0], - salt: [0, 0], - checksum: [0, 0], - }, - min_frame: 0, - recalculate_checksums: 0, - wal_name, - n_checkpoints: 0, - lock_error: 0, - p_snapshot: std::ptr::null(), - p_db: std::ptr::null(), - wal_methods: methods, - p_methods_data: std::ptr::null_mut(), - }); - unsafe { *wal = &*new_wal } - Box::leak(new_wal); - 0 - } - extern "C" fn close( - _wal: *mut Wal, - _db: *mut c_void, - _sync_flags: i32, - _n_buf: i32, - _z_buf: *mut u8, - ) -> i32 { - println!("Closing WAL"); - 0 - } - extern "C" fn limit(wal: *mut Wal, limit: i64) { - println!("Limit: {limit}"); - unsafe { (*wal).max_wal_size = limit } - } - extern "C" fn begin_read(_wal: *mut Wal, changed: *mut i32) -> i32 { - println!("Read started"); - unsafe { *changed = 1 } - 0 - } - extern "C" fn end_read(_wal: *mut Wal) -> i32 { - println!("Read ended"); - 0 - } - extern "C" fn find_frame(wal: *mut Wal, pgno: i32, frame: *mut i32) -> i32 { - println!("\tLooking for page {pgno}"); - let methods = unsafe { &*(*wal).wal_methods }; - if methods.pages.contains_key(&pgno) { - println!("\t\tpage found"); - unsafe { *frame = pgno }; - } else { - println!("\t\tpage not found - serving from the main database file"); + fn log_exists(&self, vfs: &mut libsql_sys::wal::Vfs, db_path: &std::ffi::CStr) -> libsql_sys::wal::Result { + self.inner.log_exists(vfs, db_path) } - 0 - } - extern "C" fn read_frame(wal: *mut Wal, frame: u32, n_out: i32, p_out: *mut u8) -> i32 { - println!("\tReading frame {frame}"); - let n_out = n_out as usize; - let methods = unsafe { &*(*wal).wal_methods }; - let data = methods.pages.get(&(frame as i32)).unwrap(); - if n_out < data.len() { - return ERR_MISUSE; + + fn destroy(self) + where + Self: Sized { + self.inner.destroy() } - let out_buffer = unsafe { std::slice::from_raw_parts_mut(p_out, n_out) }; - out_buffer.copy_from_slice(data); - println!("\t\tread {} bytes", data.len()); - 0 - } - extern "C" fn db_size(wal: *mut Wal) -> i32 { - println!("Db size called"); - let methods = unsafe { &*(*wal).wal_methods }; - methods.pages.len() as i32 } - extern "C" fn begin_write(_wal: *mut Wal) -> i32 { - println!("Write started"); - 0 - } - extern "C" fn end_write(_wal: *mut Wal) -> i32 { - println!("Write ended"); - 0 - } - extern "C" fn undo( - _wal: *const extern "C" fn(*mut c_void, i32) -> i32, - _ctx: *mut c_void, - ) -> i32 { - panic!("Not implemented") - } - extern "C" fn savepoint(_wal: *mut Wal, _wal_data: *mut u32) { - panic!("Not implemented") - } - extern "C" fn savepoint_undo(_wal: *mut Wal, _wal_data: *mut u32) -> i32 { - panic!("Not implemented") - } - extern "C" fn frames( - wal: *mut Wal, - page_size: u32, - page_headers: *const PgHdr, - _size_after: i32, - _is_commit: i32, - _sync_flags: i32, - ) -> i32 { - println!("\tWriting frames..."); - unsafe { (*wal).page_size = page_size }; - let methods = unsafe { &mut *(*wal).wal_methods }; - let mut current_ptr = page_headers; - loop { - let current: &PgHdr = unsafe { &*current_ptr }; - println!("\t\tpage {} written", current.pgno); - let data = unsafe { - std::slice::from_raw_parts(current.data as *const u8, page_size as usize) - } - .to_vec(); - methods.pages.insert(current.pgno, data); - if current.dirty.is_null() { - break; - } - current_ptr = current.dirty + + struct WrapWal(Sqlite3Wal); + + impl Wal for WrapWal { + fn limit(&mut self, size: i64) { + self.0.limit(size) } - 0 - } - extern "C" fn checkpoint( - _wal: *mut Wal, - _db: *mut c_void, - _emode: i32, - _busy_handler: extern "C" fn(busy_param: *mut c_void) -> i32, - _sync_flags: i32, - _n_buf: i32, - _z_buf: *mut u8, - _frames_in_wal: *mut i32, - _backfilled_frames: *mut i32, - ) -> i32 { - println!("Checkpointed"); - 0 - } - extern "C" fn callback(_wal: *mut Wal) -> i32 { - ERR_MISUSE - } - extern "C" fn exclusive_mode(_wal: *mut Wal) -> i32 { - 1 - } - extern "C" fn heap_memory(wal: *mut Wal) -> i32 { - unsafe { &*(*wal).wal_methods }.pages.len() as i32 * 64 - } - extern "C" fn file(_wal: *mut Wal) -> *const c_void { - panic!("Should never be called") - } - extern "C" fn db(_wal: *mut Wal, _db: *const c_void) {} - extern "C" fn pathname_len(orig_len: i32) -> i32 { - orig_len + 4 - } - extern "C" fn get_pathname(buf: *mut u8, orig: *const u8, orig_len: i32) { - unsafe { - std::ptr::copy_nonoverlapping(orig, buf, orig_len as usize); - std::ptr::copy_nonoverlapping(".wal".as_ptr(), buf.offset(orig_len as isize), 4); + + fn begin_read_txn(&mut self) -> libsql_sys::wal::Result { + self.0.begin_read_txn() + } + + fn end_read_txn(&mut self) { + self.0.end_read_txn() + } + + fn find_frame(&mut self, page_no: u32) -> libsql_sys::wal::Result { + self.0.find_frame(page_no) + } + + fn read_frame(&mut self, frame_no: u32, buffer: &mut [u8]) -> libsql_sys::wal::Result<()> { + self.0.read_frame(frame_no, buffer) + } + + fn db_size(&self) -> u32 { + self.0.db_size() + } + + fn begin_write_txn(&mut self) -> libsql_sys::wal::Result<()> { + self.0.begin_write_txn() + } + + fn end_write_txn(&mut self) -> libsql_sys::wal::Result<()> { + self.0.end_write_txn() + } + + fn undo(&mut self, handler: Option<&mut U>) -> libsql_sys::wal::Result<()> { + self.0.undo(handler) + } + + fn savepoint(&mut self, rollback_data: &mut [u32]) { + self.0.savepoint(rollback_data) + } + + fn savepoint_undo(&mut self, rollback_data: &mut [u32]) -> libsql_sys::wal::Result<()> { + self.0.savepoint_undo(rollback_data) + } + + fn insert_frames( + &mut self, + page_size: std::ffi::c_int, + page_headers: &mut libsql_sys::wal::PageHeaders, + size_after: u32, + is_commit: bool, + sync_flags: std::ffi::c_int, + ) -> libsql_sys::wal::Result<()> { + self.0.insert_frames(page_size, page_headers, size_after, is_commit, sync_flags) + } + + fn checkpoint( + &mut self, + db: &mut libsql_sys::wal::Sqlite3Db, + mode: libsql_sys::wal::CheckpointMode, + busy_handler: Option<&mut B>, + sync_flags: u32, + // temporary scratch buffer + buf: &mut [u8], + ) -> libsql_sys::wal::Result<(u32, u32)> { + self.0.checkpoint(db, mode, busy_handler, sync_flags, buf) + } + + fn exclusive_mode(&mut self, op: std::ffi::c_int) -> libsql_sys::wal::Result<()> { + self.0.exclusive_mode(op) + } + + fn uses_heap_memory(&self) -> bool { + self.0.uses_heap_memory() + } + + fn set_db(&mut self, db: &mut libsql_sys::wal::Sqlite3Db) { + self.0.set_db(db) + } + + fn callback(&self) -> i32 { + self.0.callback() + } + + fn last_fame_index(&self) -> u32 { + self.0.last_fame_index() } - } - extern "C" fn pre_main_db_open(_methods: *mut libsql_wal_methods, _name: *const i8) -> i32 { - 0 } #[test] fn test_vwal_register() { let tmpfile = tempfile::NamedTempFile::new().unwrap(); - let path = format!("{}\0", tmpfile.path().to_str().unwrap()); - println!("Temporary database created at {path}"); - - let conn = unsafe { - let mut pdb: *mut rusqlite::ffi::sqlite3 = std::ptr::null_mut(); - let ppdb: *mut *mut rusqlite::ffi::sqlite3 = &mut pdb; - let mut vwal = Box::new(libsql_wal_methods { - iversion: 1, - open, - close, - limit, - begin_read, - end_read, - find_frame, - read_frame, - db_size, - begin_write, - end_write, - undo, - savepoint, - savepoint_undo, - frames, - checkpoint, - callback, - exclusive_mode, - heap_memory, - snapshot_get_stub: std::ptr::null(), - snapshot_open_stub: std::ptr::null(), - snapshot_recover_stub: std::ptr::null(), - snapshot_check_stub: std::ptr::null(), - snapshot_unlock_stub: std::ptr::null(), - // stub, only useful with zipfs support compiled-in - framesize_stub: std::ptr::null(), - file, - // stub, only useful with setlk timeout compiled-in - write_lock_stub: std::ptr::null(), - db, - pathname_len, - get_pathname, - pre_main_db_open, - b_uses_shm: 0, - name: "vwal\0".as_ptr(), - p_next: std::ptr::null(), - pages: std::collections::HashMap::new(), - }); + let create_wal = make_create_wal(WrapCreateWal { inner: CreateSqlite3Wal::new() }); + let conn = Connection::open_with_flags_and_wal( + tmpfile.path(), + OpenFlags::default(), + create_wal + ).unwrap(); - sqlite3_initialize(); - let register_err = libsql_wal_methods_register(&mut *vwal as *mut libsql_wal_methods); - assert_eq!(register_err, 0); - let open_err = libsql_open(path.as_ptr(), ppdb, 6, std::ptr::null(), "vwal\0".as_ptr()); - assert_eq!(open_err, 0); - Box::leak(vwal); - Connection::from_handle(pdb).unwrap() - }; + conn.pragma(None, "journal_mode", "wal", |_| Ok(())).unwrap(); + println!("Temporary database created at {:?}", tmpfile.path()); let journal_mode: String = conn .query_row("PRAGMA journal_mode", [], |r| r.get(0)) .unwrap(); diff --git a/libsql-sys/Cargo.toml b/libsql-sys/Cargo.toml index de3e76be5e..80cad8f343 100644 --- a/libsql-sys/Cargo.toml +++ b/libsql-sys/Cargo.toml @@ -21,3 +21,4 @@ default = ["api"] api = ["wal"] wal = [] rusqlite = ["dep:rusqlite"] +wasmtime-bindings = ["libsql-ffi/wasmtime-bindings"] diff --git a/libsql-sys/src/lib.rs b/libsql-sys/src/lib.rs index 6e9c754cff..15fe479b72 100644 --- a/libsql-sys/src/lib.rs +++ b/libsql-sys/src/lib.rs @@ -22,3 +22,6 @@ pub use statement::{prepare_stmt, Statement}; pub use types::*; #[cfg(feature = "api")] pub use value::{Value, ValueType}; + +#[cfg(feature = "rusqlite")] +pub use rusqlite; diff --git a/libsql-sys/src/wal/ffi.rs b/libsql-sys/src/wal/ffi.rs index 01b2dfe0a4..a67dc98ef9 100644 --- a/libsql-sys/src/wal/ffi.rs +++ b/libsql-sys/src/wal/ffi.rs @@ -46,7 +46,9 @@ pub(crate) fn construct_libsql_wal(wal: *mut W) -> libsql_wal { } } -pub(crate) fn make_create_wal(create_wal: T) -> libsql_create_wal { +/// Turn a `CreateWal` into a `libsql_create_wal`. +/// The caller is responsible for deallocating `libsql_create_wal.pData` +pub fn make_create_wal(create_wal: T) -> libsql_create_wal { libsql_create_wal { bUsesShm: create_wal.use_shared_memory() as _, xOpen: Some(open::), diff --git a/libsql-sys/src/wal/mod.rs b/libsql-sys/src/wal/mod.rs index c2b765fd17..f17534bfb9 100644 --- a/libsql-sys/src/wal/mod.rs +++ b/libsql-sys/src/wal/mod.rs @@ -9,6 +9,7 @@ pub(crate) mod ffi; mod sqlite3_wal; pub type Result = std::result::Result; +pub use ffi::make_create_wal; pub trait CreateWal { type Wal: Wal; diff --git a/libsql-sys/src/wal_hook.rs b/libsql-sys/src/wal_hook.rs deleted file mode 100644 index aec98264e4..0000000000 --- a/libsql-sys/src/wal_hook.rs +++ /dev/null @@ -1,452 +0,0 @@ -#![allow(clippy::not_unsafe_ptr_arg_deref)] -use std::{ - ffi::{c_char, c_int, c_void, CStr}, - marker::PhantomData, -}; - -type Wal = crate::ffi::libsql_wal; -use crate::ffi::{ - libsql_wal_methods, libsql_wal_methods_find, sqlite3, sqlite3_file, sqlite3_vfs, PgHdr, -}; -use crate::types::*; - -fn get_orig_wal_methods() -> crate::Result<*mut libsql_wal_methods> { - let orig: *mut libsql_wal_methods = unsafe { libsql_wal_methods_find(std::ptr::null()) }; - if orig.is_null() { - return Err(crate::Error::Bug("no underlying methods")); - } - - Ok(orig) -} - -/// This macro handles the registering of a WalHook within libSQL. It first instantiates `WalMethodsHook` -/// to a stable location in memory, and then calls `libsql_wal_methods_register` with the WAL methods. -/// -/// The methods are never unregistered, since they're expected to live for the entirety of the program. -#[macro_export] -macro_rules! init_static_wal_method { - ($name:ident, $ty:path) => { - #[allow(dead_code)] - pub static $name: once_cell::sync::Lazy<&'static $crate::WalMethodsHook<$ty>> = - once_cell::sync::Lazy::new(|| { - // we need a 'static address before we can register the methods. - static METHODS: once_cell::sync::Lazy<$crate::WalMethodsHook<$ty>> = - once_cell::sync::Lazy::new(|| $crate::WalMethodsHook::<$ty>::new()); - - let ret = unsafe { - $crate::ffi::libsql_wal_methods_register(METHODS.as_wal_methods_ptr() as *mut _) - }; - - assert!( - ret == 0, - "failed to register wal methods for {}", - stringify!($ty) - ); - - &METHODS - }); - }; -} - -/// The `WalHook` trait allows to intercept WAL method call. -/// -/// All the methods in this trait have the following format: - arguments to the WAL method - -/// function pointer to the wrapped WAL method -/// -/// The default implementations for this trait methods is to transparently call the wrapped methods -/// with the passed arguments -/// -/// # Safety -/// The implementer is responsible for calling the orig method with valid arguments. -pub unsafe trait WalHook { - type Context; - - fn name() -> &'static CStr; - /// Intercept `xFrame` call. `orig` is the function pointer to the underlying wal method. - /// The default implementation of this trait simply calls orig with the other passed arguments. - #[allow(clippy::too_many_arguments)] - fn on_frames( - wal: &mut Wal, - page_size: c_int, - page_headers: *mut PgHdr, - size_after: u32, - is_commit: c_int, - sync_flags: c_int, - orig: XWalFrameFn, - ) -> c_int { - unsafe { - (orig)( - wal, - page_size, - page_headers, - size_after, - is_commit, - sync_flags, - ) - } - } - - /// Intercept `xUndo` call. `orig` is the function pointer to the underlying wal method. - /// The default implementation of this trait simply calls orig with the other passed arguments. - fn on_undo( - wal: &mut Wal, - func: Option i32>, - undo_ctx: *mut c_void, - orig: XWalUndoFn, - ) -> i32 { - unsafe { orig(wal, func, undo_ctx) } - } - - fn wal_extract_ctx(wal: &mut Wal) -> &mut Self::Context { - let ctx_ptr = wal.pMethodsData as *mut Self::Context; - assert!(!ctx_ptr.is_null(), "missing wal context"); - unsafe { &mut *ctx_ptr } - } - - fn on_savepoint_undo(wal: &mut Wal, wal_data: *mut u32, orig: XWalSavePointUndoFn) -> i32 { - unsafe { orig(wal, wal_data) } - } - - #[allow(clippy::too_many_arguments)] - fn on_checkpoint( - wal: &mut Wal, - db: *mut sqlite3, - emode: i32, - busy_handler: Option i32>, - busy_arg: *mut c_void, - sync_flags: i32, - n_buf: i32, - z_buf: *mut u8, - frames_in_wal: *mut i32, - backfilled_frames: *mut i32, - orig: XWalCheckpointFn, - ) -> i32 { - unsafe { - orig( - wal, - db, - emode, - busy_handler, - busy_arg, - sync_flags, - n_buf, - z_buf, - frames_in_wal, - backfilled_frames, - ) - } - } -} - -init_static_wal_method!(TRANSPARENT_METHODS, TransparentMethods); - -/// Wal implemementation that just proxies calls to the wrapped WAL methods implementation -pub enum TransparentMethods {} - -unsafe impl WalHook for TransparentMethods { - type Context = (); - - fn name() -> &'static CStr { - CStr::from_bytes_with_nul(b"transparent\0").unwrap() - } -} - -impl Default for WalMethodsHook { - fn default() -> Self { - Self::new() - } -} - -impl WalMethodsHook { - pub fn new() -> Self { - let default_methods = get_orig_wal_methods().expect("failed to get original WAL methods"); - - WalMethodsHook { - methods: libsql_wal_methods { - iVersion: 1, - xOpen: Some(xOpen::), - xClose: Some(xClose::), - xLimit: Some(xLimit::), - xBeginReadTransaction: Some(xBeginReadTransaction::), - xEndReadTransaction: Some(xEndReadTransaction::), - xFindFrame: Some(xFindFrame::), - xReadFrame: Some(xReadFrame::), - xDbsize: Some(xDbsize::), - xBeginWriteTransaction: Some(xBeginWriteTransaction::), - xEndWriteTransaction: Some(xEndWriteTransaction::), - xUndo: Some(xUndo::), - xSavepoint: Some(xSavepoint::), - xSavepointUndo: Some(xSavepointUndo::), - xFrames: Some(xFrames::), - xCheckpoint: Some(xCheckpoint::), - xCallback: Some(xCallback::), - xExclusiveMode: Some(xExclusiveMode::), - xHeapMemory: Some(xHeapMemory::), - xSnapshotGet: None, - xSnapshotOpen: None, - xSnapshotRecover: None, - xSnapshotCheck: None, - xSnapshotUnlock: None, - xFramesize: None, - xFile: Some(xFile::), - xWriteLock: None, - xDb: Some(xDb::), - xPathnameLen: Some(xPathnameLen), - xGetWalPathname: Some(xGetPathname), - xPreMainDbOpen: Some(xPreMainDbOpen::), - zName: T::name().as_ptr(), - bUsesShm: 0, - pNext: std::ptr::null_mut(), - }, - underlying_methods: default_methods, - _pth: PhantomData, - } - } - - pub fn as_wal_methods_ptr(&self) -> *const libsql_wal_methods { - self as *const _ as *mut _ - } -} - -#[allow(non_snake_case)] -pub extern "C" fn xOpen( - vfs: *mut sqlite3_vfs, - db_file: *mut sqlite3_file, - wal_name: *const c_char, - no_shm_mode: i32, - max_size: i64, - methods: *mut libsql_wal_methods, - wal: *mut *mut Wal, -) -> i32 { - tracing::debug!("Opening WAL {}", unsafe { - std::ffi::CStr::from_ptr(wal_name).to_str().unwrap() - }); - let ref_methods = unsafe { &*(methods as *mut WalMethodsHook) }; - let origxOpen = unsafe { (*ref_methods.underlying_methods).xOpen.unwrap() }; - unsafe { (origxOpen)(vfs, db_file, wal_name, no_shm_mode, max_size, methods, wal) } -} - -fn get_orig_methods(wal: &mut Wal) -> &libsql_wal_methods { - let methods = get_methods::(wal); - assert!(!methods.underlying_methods.is_null()); - unsafe { &*methods.underlying_methods } -} - -fn get_methods(wal: &mut Wal) -> &mut WalMethodsHook { - assert!(!wal.pMethods.is_null()); - unsafe { &mut *(wal.pMethods as *mut _ as *mut WalMethodsHook) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xClose( - wal: *mut Wal, - db: *mut sqlite3, - sync_flags: i32, - n_buf: c_int, - z_buf: *mut u8, -) -> c_int { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xClose.unwrap())(wal, db, sync_flags, n_buf, z_buf) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xLimit(wal: *mut Wal, limit: i64) { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xLimit.unwrap())(wal, limit) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xBeginReadTransaction(wal: *mut Wal, changed: *mut i32) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xBeginReadTransaction.unwrap())(wal, changed) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xEndReadTransaction(wal: *mut Wal) { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xEndReadTransaction.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xFindFrame(wal: *mut Wal, pgno: u32, frame: *mut u32) -> c_int { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xFindFrame.unwrap())(wal, pgno, frame) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xReadFrame( - wal: *mut Wal, - frame: u32, - n_out: c_int, - p_out: *mut u8, -) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xReadFrame.unwrap())(wal, frame, n_out, p_out) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xDbsize(wal: *mut Wal) -> u32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xDbsize.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xBeginWriteTransaction(wal: *mut Wal) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xBeginWriteTransaction.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xEndWriteTransaction(wal: *mut Wal) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xEndWriteTransaction.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xUndo( - wal: *mut Wal, - func: Option i32>, - undo_ctx: *mut c_void, -) -> i32 { - assert!(!wal.is_null()); - let wal = unsafe { &mut *wal }; - let orig_methods = get_orig_methods::(wal); - let orig_xundo = orig_methods.xUndo.unwrap(); - T::on_undo(wal, func, undo_ctx, orig_xundo) -} - -#[allow(non_snake_case)] -pub extern "C" fn xSavepoint(wal: *mut Wal, wal_data: *mut u32) { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xSavepoint.unwrap())(wal, wal_data) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xSavepointUndo(wal: *mut Wal, wal_data: *mut u32) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xSavepointUndo.unwrap())(wal, wal_data) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xFrames( - wal: *mut Wal, - page_size: c_int, - page_headers: *mut PgHdr, - size_after: u32, - is_commit: c_int, - sync_flags: c_int, -) -> c_int { - assert!(!wal.is_null()); - let wal = unsafe { &mut *wal }; - let orig_methods = get_orig_methods::(wal); - let orig_xframe = orig_methods.xFrames.unwrap(); - - T::on_frames( - wal, - page_size, - page_headers, - size_after, - is_commit, - sync_flags, - orig_xframe, - ) -} - -#[tracing::instrument(skip(wal, db))] -#[allow(non_snake_case)] -pub extern "C" fn xCheckpoint( - wal: *mut Wal, - db: *mut sqlite3, - emode: c_int, - busy_handler: Option c_int>, - busy_arg: *mut c_void, - sync_flags: c_int, - n_buf: c_int, - z_buf: *mut u8, - frames_in_wal: *mut c_int, - backfilled_frames: *mut c_int, -) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { - (orig_methods.xCheckpoint.unwrap())( - wal, - db, - emode, - busy_handler, - busy_arg, - sync_flags, - n_buf, - z_buf, - frames_in_wal, - backfilled_frames, - ) - } -} - -#[allow(non_snake_case)] -pub extern "C" fn xCallback(wal: *mut Wal) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xCallback.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xExclusiveMode(wal: *mut Wal, op: c_int) -> c_int { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xExclusiveMode.unwrap())(wal, op) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xHeapMemory(wal: *mut Wal) -> i32 { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xHeapMemory.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xFile(wal: *mut Wal) -> *mut sqlite3_file { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xFile.unwrap())(wal) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xDb(wal: *mut Wal, db: *mut sqlite3) { - let orig_methods = unsafe { get_orig_methods::(&mut *wal) }; - unsafe { (orig_methods.xDb.unwrap())(wal, db) } -} - -#[allow(non_snake_case)] -pub extern "C" fn xPathnameLen(orig_len: i32) -> i32 { - orig_len + 4 -} - -#[allow(non_snake_case)] -pub extern "C" fn xGetPathname(buf: *mut c_char, orig: *const c_char, orig_len: c_int) { - unsafe { std::ptr::copy(orig, buf, orig_len as usize) } - unsafe { - std::ptr::copy( - "-wal".as_ptr(), - (buf as *mut u8).offset(orig_len as isize), - 4, - ) - } -} - -#[allow(non_snake_case)] -pub extern "C" fn xPreMainDbOpen( - methods: *mut libsql_wal_methods, - path: *const c_char, -) -> i32 { - let orig_methods = unsafe { &*(*(methods as *mut WalMethodsHook)).underlying_methods }; - unsafe { (orig_methods.xPreMainDbOpen.unwrap())(methods, path) } -} - -unsafe impl Send for WalMethodsHook {} -unsafe impl Sync for WalMethodsHook {} - -#[repr(C)] -#[allow(non_snake_case)] -pub struct WalMethodsHook { - pub methods: libsql_wal_methods, - // user data - underlying_methods: *mut libsql_wal_methods, - _pth: PhantomData, -}