Bug 1628447 - Bump vendored rusqlite version to 0.22.0 r=lina

This gets us off the prerelease.

Differential Revision: https://phabricator.services.mozilla.com/D70434

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thom Chiovoloni 2020-04-10 20:55:16 +00:00
Родитель 91e2985a09
Коммит be606b9953
23 изменённых файлов: 191 добавлений и 179 удалений

8
Cargo.lock сгенерированный
Просмотреть файл

@ -2249,9 +2249,9 @@ dependencies = [
[[package]] [[package]]
name = "libsqlite3-sys" name = "libsqlite3-sys"
version = "0.17.2" version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38c4446f020dfbfab9f8a1ab605c15e6c03a8924c08522dcb67314acc8d2b523" checksum = "56d90181c2904c287e5390186be820e5ef311a3c62edebb7d6ca3d6a48ce041d"
dependencies = [ dependencies = [
"pkg-config", "pkg-config",
"vcpkg", "vcpkg",
@ -3705,9 +3705,9 @@ checksum = "5d79b4b604167921892e84afbbaad9d5ad74e091bf6c511d9dbfb0593f09fabd"
[[package]] [[package]]
name = "rusqlite" name = "rusqlite"
version = "0.22.0-beta.0" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5c02d0acf7e60bbf900bfc46c287a336473aedf6b7658039441b474289643de" checksum = "57edf4c4cea4d7e0fab069acb5da9e8e8e5403c78abc81b1f37d83af02148ea5"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"fallible-iterator", "fallible-iterator",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"26fd709d367e0191effa2bc278ff3a8b46d861d239e656ea56da32f73f146e53","bindgen-bindings/bindgen_3.6.23.rs":"923457005065475fafe323ccfae5b66ce1a4920da76b3c95b4645ebf1297cef1","bindgen-bindings/bindgen_3.6.8.rs":"b753ddee60f0a29defc2c6ec763472080114f1fd8a0cddc014e0cbafeb1853a5","bindgen-bindings/bindgen_3.7.16.rs":"73099dae580b3c099d2847d04c4c84fecde44795a65bdab72e6640cfcd7b95ee","bindgen-bindings/bindgen_3.7.7.rs":"d1a2f0f4f842778f0eea0abfbd2f1a7d089a9ab946536a81af9029bbf5dda94b","build.rs":"4d12a7357c8b0f9e57bd2265a365c745b553c4d7363997db31caa3238b5590e3","sqlite3/bindgen_bundled_version.rs":"0ecb163cf9013b029694a2c8b4b307ffa89b774234b5c0fb25a696437e1e4840","sqlite3/sqlite3.c":"3340d6b1508b0035e0d8721d552001ed8000612006fe4db84dca96bc2a0b08b2","sqlite3/sqlite3.h":"ce9e08c10e16f06d73f44ff2638e5a562a517dfb284c1d0179dbb1ea64ea655f","sqlite3/sqlite3ext.h":"f394387f383e932d0bbb75b7809767287ba5333f52a2b68b2add4f1dac7f4d50","src/error.rs":"8feec722b66490d4313570b7956aec751b34bf99cb8755e2004da71219f33a7e","src/lib.rs":"91f72096cf588c02035963c55d262925fdcf6cbddc08338b8b1ee10ee740a0d3","upgrade.sh":"6cc0fbdab7edb27c0415f3ce40387dbcfcb675c5f8ea289a7f2907718cd74d67","wrapper.h":"b78f576f7eeabf316e183d476b0f16344b6897680b4df47628d3ce38c0aa979a"},"package":"38c4446f020dfbfab9f8a1ab605c15e6c03a8924c08522dcb67314acc8d2b523"} {"files":{"Cargo.toml":"7a953ee91fb12dc0bb2acfd214c184ae2826210b4cc4517c0ac6eb87ca3d2a5b","bindgen-bindings/bindgen_3.6.23.rs":"923457005065475fafe323ccfae5b66ce1a4920da76b3c95b4645ebf1297cef1","bindgen-bindings/bindgen_3.6.8.rs":"b753ddee60f0a29defc2c6ec763472080114f1fd8a0cddc014e0cbafeb1853a5","bindgen-bindings/bindgen_3.7.16.rs":"73099dae580b3c099d2847d04c4c84fecde44795a65bdab72e6640cfcd7b95ee","bindgen-bindings/bindgen_3.7.7.rs":"d1a2f0f4f842778f0eea0abfbd2f1a7d089a9ab946536a81af9029bbf5dda94b","build.rs":"6bc112359cf4bc24114b1ee99af7258637dbd260807cf566fa3f94ac85533626","sqlite3/bindgen_bundled_version.rs":"0ecb163cf9013b029694a2c8b4b307ffa89b774234b5c0fb25a696437e1e4840","sqlite3/sqlite3.c":"3340d6b1508b0035e0d8721d552001ed8000612006fe4db84dca96bc2a0b08b2","sqlite3/sqlite3.h":"ce9e08c10e16f06d73f44ff2638e5a562a517dfb284c1d0179dbb1ea64ea655f","sqlite3/sqlite3ext.h":"f394387f383e932d0bbb75b7809767287ba5333f52a2b68b2add4f1dac7f4d50","src/error.rs":"7be60a8c4fd8c83d9d8979415f3242d9007ceb4188c3b35caa3b06ad463649e2","src/lib.rs":"2d1fe7b7e19a92c9f7f5e697b209fde13322deb70c782b52e24bd920d9aa9583","upgrade.sh":"6cc0fbdab7edb27c0415f3ce40387dbcfcb675c5f8ea289a7f2907718cd74d67","wrapper.h":"b78f576f7eeabf316e183d476b0f16344b6897680b4df47628d3ce38c0aa979a"},"package":"56d90181c2904c287e5390186be820e5ef311a3c62edebb7d6ca3d6a48ce041d"}

2
third_party/rust/libsqlite3-sys/Cargo.toml поставляемый
Просмотреть файл

@ -13,7 +13,7 @@
[package] [package]
edition = "2018" edition = "2018"
name = "libsqlite3-sys" name = "libsqlite3-sys"
version = "0.17.2" version = "0.17.3"
authors = ["John Gallagher <jgallagher@bignerdranch.com>"] authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
build = "build.rs" build = "build.rs"
links = "sqlite3" links = "sqlite3"

3
third_party/rust/libsqlite3-sys/build.rs поставляемый
Просмотреть файл

@ -78,7 +78,8 @@ mod build_bundled {
.flag("-DSQLITE_SOUNDEX") .flag("-DSQLITE_SOUNDEX")
.flag("-DSQLITE_THREADSAFE=1") .flag("-DSQLITE_THREADSAFE=1")
.flag("-DSQLITE_USE_URI") .flag("-DSQLITE_USE_URI")
.flag("-DHAVE_USLEEP=1"); .flag("-DHAVE_USLEEP=1")
.warnings(false);
// Older versions of visual studio don't support c99 (including isnan), which // Older versions of visual studio don't support c99 (including isnan), which
// causes a build failure when the linker fails to find the `isnan` // causes a build failure when the linker fails to find the `isnan`
// function. `sqlite` provides its own implmentation, using the fact // function. `sqlite` provides its own implmentation, using the fact

Просмотреть файл

@ -4,6 +4,7 @@ use std::os::raw::c_int;
/// Error Codes /// Error Codes
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum ErrorCode { pub enum ErrorCode {
/// Internal logic error in SQLite /// Internal logic error in SQLite
InternalMalfunction, InternalMalfunction,

1
third_party/rust/libsqlite3-sys/src/lib.rs поставляемый
Просмотреть файл

@ -17,6 +17,7 @@ pub fn SQLITE_TRANSIENT() -> sqlite3_destructor_type {
/// Run-Time Limit Categories /// Run-Time Limit Categories
#[repr(i32)] #[repr(i32)]
#[non_exhaustive]
pub enum Limit { pub enum Limit {
/// The maximum size of any string or BLOB or table row, in bytes. /// The maximum size of any string or BLOB or table row, in bytes.
SQLITE_LIMIT_LENGTH = SQLITE_LIMIT_LENGTH, SQLITE_LIMIT_LENGTH = SQLITE_LIMIT_LENGTH,

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"80a50abd20e22f24c5d096f1e31f673ec1a872b87f26b49c2fd32fcfa439ce8a","Changelog.md":"160abc7629d828e0a6db22d2d58274bbc8b72f2fdb252622a79c8674f0479ab4","LICENSE":"acf819aeb6d09017873bf75127c0f395cfd3016c90b8431d3b9a3e7f2336661b","README.md":"da8a0fb3622a302d6e734793ab08c63f924a8104a26200c246153028c7b848de","appveyor.yml":"0bcc97462ce19ea2d7018b5a0f322d4d0ffc085a31cd18abe540ede05c770ff2","benches/lib.rs":"3837206f4de397723be15c58968e13185bd3cddb08b3d699e4a0a9703a24b6e4","clippy.toml":"98f90bbe52849b3078daeccfbe87aec1c08d02b94a453a15149a1fcccb7cafd0","publish-ghp-docs.sh":"3e2c59e09ce377c46a62511aa17389e6bf824c17d2fc5a818409ede40ba64c23","src/backup.rs":"4fa7163d48329d94da670d437bd18a0b50f93e79a08c1305f0bd7280575c884d","src/blob.rs":"34da23c4db566eee51c43f386ebce47ad03e46345683e8b830950cd232574fa6","src/busy.rs":"0b9bdc85ad1e4dc8b7ad42dd175516ea9e76cc70e64d615b41e7d60ca967347b","src/cache.rs":"914c5823fe8a427b3a4aad09da05fd1788abecd1c7b05ceab5414646b908d618","src/collation.rs":"46dd1478f195421ef60dbf7718ac8aeae7e78060935c6567348344bff51232b4","src/column.rs":"e92e5e3c2f26280bb90b6da01928a32a03de78cc8c317ed9f302b7728bf54d81","src/config.rs":"29a73e56e68b65bb3e413162dfa463e7946f0e2c950669b63339710845884f85","src/context.rs":"811d7e5eb529a637c548be39724477173e2d9c967769d9a513f6863c3b26acd5","src/error.rs":"c4ee9aeebf786e313923bd25f89f585e1e17ee95de7ea3fe291877323d60bef0","src/functions.rs":"ce24e6171d8ce5234c21f6f0178b6e835caf09f281106161183c548b0d70455f","src/hooks.rs":"ca147e4d079af25cf5b9d9b97327ce4c35ccec7d292d39bc7f7a75bb80506d34","src/inner_connection.rs":"771f6f35fc9cec1909cbf37425bb88c22a14c3daf26f9d412a70785b802b2cba","src/lib.rs":"9bd957ca41c88f82ab17b63e50ed66095ebdb384a884b46f5149de46b9e28f14","src/limits.rs":"75d339cf1f21c744f42f339dcfccf44e149bd2d1294ad0fe412b0792d9c809ab","src/load_extension_guard.rs":"cd349613067410fa4be811d7522fc50004fbc48feb050c19f80a097ab919f9fb","src/pragma.rs":"4b7f5b129bb94c2a99909ca14550034d05f5394ae20838eac938cb9464f4507d","src/raw_statement.rs":"ab00bc4b58b293d39ad579614540909465a04622323aabae86c29337845d3eb9","src/row.rs":"cfb4c765e5b79b5dc42c37efe158c43524193a878797769619381afe1dc3aeeb","src/session.rs":"4cee8108b2ad4e1e7b99ce5b5be8fc4465a50e3d47a93f71c5ebac72b591a2f4","src/statement.rs":"8db19b7fd5a4701ffaf8291d11d41b7d7231c6a9387f64ea2d21aba0f9d5e1ae","src/trace.rs":"d764dfa98056b607634cae685d0b4b84693cfbe8d91208a649ba755ff23f1e53","src/transaction.rs":"c3305be85d5f5e18881154f0456883c317775b9fe8ccb1f939c39ee1f5ea700b","src/types/chrono.rs":"1d6aebb7b8efc6038ec30c95d91cee7a16c826bf5a78aca1bc75c86349e17c83","src/types/from_sql.rs":"d1adf2db5cf0051d9a3bd7e98f20a6cd91e9ac93b0961925adad42a9027951bd","src/types/mod.rs":"fc06c3ee27602088b1fe12519b584207c9a826280f631d3a630f5da91b8d5642","src/types/serde_json.rs":"a3f11fd63cf5f3ffc9e89134dd3d139ac275aff1948d315b1eb1673d81e8fe95","src/types/time.rs":"a26b008c86c76f639292b635d30603c6b3ef870d6009606222860dad3e7d4f74","src/types/to_sql.rs":"9c75c53b7da4f14166c4841979a68df84d094c2125900d62f9c41520d78815a7","src/types/url.rs":"b476ca2386a4cc4e8ac500f870993c0445abe91754d4e004bfd19a1b95b53816","src/types/value.rs":"ae803c1d4e6f3e50a59152f38e3d8d98eda32fecafd456214febd9645839bc4d","src/types/value_ref.rs":"f83c99443aa402003bd2437fe1fb199dba1e73711f18a897a1f7e92bf0b0c0e2","src/unlock_notify.rs":"4e2e2af5673af3009dbd9c3bbfd7d7db2d0163ccf6fec759c034d16b66d2fbf0","src/version.rs":"6df3d88ff62b1f4c46692b515a16d1f02ff27732a3e371788566e6a75d5c1d4d","src/vtab/array.rs":"db825b214e87badc07fb767a12ac13ae9858534b1b7b10cd00b289c702a6229f","src/vtab/csvtab.rs":"80d8716126b34979063122b8e42cc8bf70025a0d5520b17670f9a0de0cf4d300","src/vtab/mod.rs":"77f38ae8879087ff2050703a48987150ac901a194cc38ae6789094e881bc4850","src/vtab/series.rs":"3ada0d600031e55798c6d5a24e450fc8c863f9a197ddcac2df2c9d5a78240ca4","test.csv":"3f5649d7b9f80468999b80d4d0e747c6f4f1bba80ade792689eeb4359dc1834a","tests/config_log.rs":"e786bb1a0ca1b560788b24a2091e7d294753a7bee8a39f0e6037b435809267df","tests/deny_single_threaded_sqlite_config.rs":"586ee163d42d886d88ae319cb2184c021bdf9f6da9a8325d799ba10ddeadcbe0","tests/vtab.rs":"9d6376287598511fa43d34e0249159457a99ba47a72e937e08292d776c18b979"},"package":"d5c02d0acf7e60bbf900bfc46c287a336473aedf6b7658039441b474289643de"} {"files":{"Cargo.toml":"2fbb6309bee89812463013e7d2ade80e9da3fda1dfc158c302b5c21321d76e9c","Changelog.md":"160abc7629d828e0a6db22d2d58274bbc8b72f2fdb252622a79c8674f0479ab4","LICENSE":"acf819aeb6d09017873bf75127c0f395cfd3016c90b8431d3b9a3e7f2336661b","README.md":"1551434bfdc18c6de86aeaf8a6d2f048c87c37079f0b1d3ce7db7b0488821827","appveyor.yml":"0bcc97462ce19ea2d7018b5a0f322d4d0ffc085a31cd18abe540ede05c770ff2","benches/cache.rs":"30459d8d7f65dd684909a53590f9be32e2e545a0775cd93ee0ce85dd08410955","clippy.toml":"98f90bbe52849b3078daeccfbe87aec1c08d02b94a453a15149a1fcccb7cafd0","publish-ghp-docs.sh":"3e2c59e09ce377c46a62511aa17389e6bf824c17d2fc5a818409ede40ba64c23","src/backup.rs":"360ed194fee64f92ca66950a720d8855be7949700bd20c106ee09880453bf1d1","src/blob.rs":"34da23c4db566eee51c43f386ebce47ad03e46345683e8b830950cd232574fa6","src/busy.rs":"0b9bdc85ad1e4dc8b7ad42dd175516ea9e76cc70e64d615b41e7d60ca967347b","src/cache.rs":"914c5823fe8a427b3a4aad09da05fd1788abecd1c7b05ceab5414646b908d618","src/collation.rs":"46dd1478f195421ef60dbf7718ac8aeae7e78060935c6567348344bff51232b4","src/column.rs":"e92e5e3c2f26280bb90b6da01928a32a03de78cc8c317ed9f302b7728bf54d81","src/config.rs":"29a73e56e68b65bb3e413162dfa463e7946f0e2c950669b63339710845884f85","src/context.rs":"811d7e5eb529a637c548be39724477173e2d9c967769d9a513f6863c3b26acd5","src/error.rs":"96501aebaf239044170e1175fd6ca2035b4388772e9fb97790326ce6b6542fef","src/functions.rs":"ce24e6171d8ce5234c21f6f0178b6e835caf09f281106161183c548b0d70455f","src/hooks.rs":"83a4b6ee25b1094022d6eb518906e4c18e48da4a9b060f7a090a0b62d7751d1e","src/inner_connection.rs":"5fa580ae09cfac46903d2ce607070c432d3769ce7c59d41683bff43a72af9008","src/lib.rs":"e9556869e37162bfe1d638caf1bd0ea4467bbd2593255b3a247cb1e3243c97e1","src/limits.rs":"75d339cf1f21c744f42f339dcfccf44e149bd2d1294ad0fe412b0792d9c809ab","src/load_extension_guard.rs":"cd349613067410fa4be811d7522fc50004fbc48feb050c19f80a097ab919f9fb","src/pragma.rs":"4b7f5b129bb94c2a99909ca14550034d05f5394ae20838eac938cb9464f4507d","src/raw_statement.rs":"abe4635b8a473ede8cdef069deab390bed365dd918b8b4fbdac905e9d2c79377","src/row.rs":"cfb4c765e5b79b5dc42c37efe158c43524193a878797769619381afe1dc3aeeb","src/session.rs":"85167583278e4c6ee49ab4c77f30d33eec34e5bdaec71c1eb216b39b12ba32ee","src/statement.rs":"6d9857e72c7d09ae7a4df83ad7119d18c655ee8947bfa97f5dd737b4654456cb","src/trace.rs":"d764dfa98056b607634cae685d0b4b84693cfbe8d91208a649ba755ff23f1e53","src/transaction.rs":"c3305be85d5f5e18881154f0456883c317775b9fe8ccb1f939c39ee1f5ea700b","src/types/chrono.rs":"1d6aebb7b8efc6038ec30c95d91cee7a16c826bf5a78aca1bc75c86349e17c83","src/types/from_sql.rs":"d1adf2db5cf0051d9a3bd7e98f20a6cd91e9ac93b0961925adad42a9027951bd","src/types/mod.rs":"fc06c3ee27602088b1fe12519b584207c9a826280f631d3a630f5da91b8d5642","src/types/serde_json.rs":"a3f11fd63cf5f3ffc9e89134dd3d139ac275aff1948d315b1eb1673d81e8fe95","src/types/time.rs":"a26b008c86c76f639292b635d30603c6b3ef870d6009606222860dad3e7d4f74","src/types/to_sql.rs":"34093985551c23c32da1e124823348f7bfc299633b0a7b974d36eb9dbe4799b6","src/types/url.rs":"b476ca2386a4cc4e8ac500f870993c0445abe91754d4e004bfd19a1b95b53816","src/types/value.rs":"ae803c1d4e6f3e50a59152f38e3d8d98eda32fecafd456214febd9645839bc4d","src/types/value_ref.rs":"f83c99443aa402003bd2437fe1fb199dba1e73711f18a897a1f7e92bf0b0c0e2","src/unlock_notify.rs":"33747f10e4aa2ff8d11b295672d15f677117d2c23037f9361ffc931763796907","src/version.rs":"6df3d88ff62b1f4c46692b515a16d1f02ff27732a3e371788566e6a75d5c1d4d","src/vtab/array.rs":"db825b214e87badc07fb767a12ac13ae9858534b1b7b10cd00b289c702a6229f","src/vtab/csvtab.rs":"80d8716126b34979063122b8e42cc8bf70025a0d5520b17670f9a0de0cf4d300","src/vtab/mod.rs":"ce462dd1d691370bff06925b67cb16ca3ea76da83ed197f77706fe0c3583c749","src/vtab/series.rs":"3ada0d600031e55798c6d5a24e450fc8c863f9a197ddcac2df2c9d5a78240ca4","test.csv":"3f5649d7b9f80468999b80d4d0e747c6f4f1bba80ade792689eeb4359dc1834a","tests/config_log.rs":"e786bb1a0ca1b560788b24a2091e7d294753a7bee8a39f0e6037b435809267df","tests/deny_single_threaded_sqlite_config.rs":"586ee163d42d886d88ae319cb2184c021bdf9f6da9a8325d799ba10ddeadcbe0","tests/vtab.rs":"9d6376287598511fa43d34e0249159457a99ba47a72e937e08292d776c18b979"},"package":"57edf4c4cea4d7e0fab069acb5da9e8e8e5403c78abc81b1f37d83af02148ea5"}

17
third_party/rust/rusqlite/Cargo.toml поставляемый
Просмотреть файл

@ -13,7 +13,7 @@
[package] [package]
edition = "2018" edition = "2018"
name = "rusqlite" name = "rusqlite"
version = "0.22.0-beta.0" version = "0.22.0"
authors = ["John Gallagher <jgallagher@bignerdranch.com>"] authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
description = "Ergonomic wrapper for SQLite" description = "Ergonomic wrapper for SQLite"
documentation = "http://docs.rs/rusqlite/" documentation = "http://docs.rs/rusqlite/"
@ -30,7 +30,7 @@ no-default-features = true
[package.metadata.playground] [package.metadata.playground]
all-features = false all-features = false
features = ["array", "backup", "blob", "bundled", "chrono", "collation", "csvtab", "extra_check", "functions", "hooks", "i128_blob", "limits", "load_extension", "modern_sqlite", "serde_json", "series", "trace", "url", "vtab_v3", "vtab", "window"] features = ["bundled-full"]
[lib] [lib]
name = "rusqlite" name = "rusqlite"
@ -44,6 +44,10 @@ name = "deny_single_threaded_sqlite_config"
[[test]] [[test]]
name = "vtab" name = "vtab"
[[bench]]
name = "cache"
harness = false
[dependencies.bitflags] [dependencies.bitflags]
version = "1.0" version = "1.0"
@ -71,7 +75,7 @@ version = "1.0"
optional = true optional = true
[dependencies.libsqlite3-sys] [dependencies.libsqlite3-sys]
version = "0.17.2" version = "0.17.3"
[dependencies.lru-cache] [dependencies.lru-cache]
version = "0.1" version = "0.1"
@ -93,6 +97,9 @@ optional = true
[dependencies.uuid] [dependencies.uuid]
version = "0.8" version = "0.8"
optional = true optional = true
[dev-dependencies.bencher]
version = "0.1"
[dev-dependencies.doc-comment] [dev-dependencies.doc-comment]
version = "0.3" version = "0.3"
@ -118,6 +125,8 @@ backup = ["libsqlite3-sys/min_sqlite_version_3_6_23"]
blob = ["libsqlite3-sys/min_sqlite_version_3_7_7"] blob = ["libsqlite3-sys/min_sqlite_version_3_7_7"]
buildtime_bindgen = ["libsqlite3-sys/buildtime_bindgen"] buildtime_bindgen = ["libsqlite3-sys/buildtime_bindgen"]
bundled = ["libsqlite3-sys/bundled", "modern_sqlite"] bundled = ["libsqlite3-sys/bundled", "modern_sqlite"]
bundled-full = ["array", "backup", "blob", "bundled", "chrono", "collation", "csvtab", "extra_check", "functions", "hooks", "i128_blob", "limits", "load_extension", "serde_json", "series", "trace", "unlock_notify", "url", "uuid", "vtab", "window"]
bundled-windows = ["libsqlite3-sys/bundled-windows"]
collation = [] collation = []
csvtab = ["csv", "vtab"] csvtab = ["csv", "vtab"]
extra_check = [] extra_check = []
@ -133,9 +142,7 @@ session = ["libsqlite3-sys/session", "hooks"]
sqlcipher = ["libsqlite3-sys/sqlcipher"] sqlcipher = ["libsqlite3-sys/sqlcipher"]
trace = ["libsqlite3-sys/min_sqlite_version_3_6_23"] trace = ["libsqlite3-sys/min_sqlite_version_3_6_23"]
unlock_notify = ["libsqlite3-sys/unlock_notify"] unlock_notify = ["libsqlite3-sys/unlock_notify"]
unstable = []
vtab = ["libsqlite3-sys/min_sqlite_version_3_7_7", "lazy_static"] vtab = ["libsqlite3-sys/min_sqlite_version_3_7_7", "lazy_static"]
vtab_v3 = ["vtab"]
window = ["functions"] window = ["functions"]
[badges.appveyor] [badges.appveyor]
repository = "jgallagher/rusqlite" repository = "jgallagher/rusqlite"

22
third_party/rust/rusqlite/README.md поставляемый
Просмотреть файл

@ -101,7 +101,7 @@ features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-s
* [`array`](https://sqlite.org/carray.html), The `rarray()` Table-Valued Function. * [`array`](https://sqlite.org/carray.html), The `rarray()` Table-Valued Function.
* `i128_blob` allows storing values of type `i128` type in SQLite databases. Internally, the data is stored as a 16 byte big-endian blob, with the most significant bit flipped, which allows ordering and comparison between different blobs storing i128s to work as expected. * `i128_blob` allows storing values of type `i128` type in SQLite databases. Internally, the data is stored as a 16 byte big-endian blob, with the most significant bit flipped, which allows ordering and comparison between different blobs storing i128s to work as expected.
* `uuid` allows storing and retrieving `Uuid` values from the [`uuid`](https://docs.rs/uuid/) crate using blobs. * `uuid` allows storing and retrieving `Uuid` values from the [`uuid`](https://docs.rs/uuid/) crate using blobs.
* [`session`](https://sqlite.org/sessionintro.html), Session module extension. * [`session`](https://sqlite.org/sessionintro.html), Session module extension. Requires `buildtime_bindgen` feature.
## Notes on building rusqlite and libsqlite3-sys ## Notes on building rusqlite and libsqlite3-sys
@ -166,6 +166,26 @@ enabled if you turn this on, as otherwise you'll need to keep the version of
SQLite you link with in sync with what rusqlite would have bundled, (usually the SQLite you link with in sync with what rusqlite would have bundled, (usually the
most recent release of sqlite). Failing to do this will cause a runtime error. most recent release of sqlite). Failing to do this will cause a runtime error.
## Contributing
Rusqlite has many features, and many of them impact the build configuration in
incompatible ways. This is unfortunate, and makes testing changes hard.
To help here: you generally should ensure that you run tests/lint for
`--features bundled`, and `--features bundled-full session buildtime_bindgen`.
If running bindgen is problematic for you, `--features bundled-full` enables
bundled and all features which don't require binding generation, and can be used
instead.
### Checklist
- Run `cargo fmt` to ensure your Rust code is correctly formatted.
- Ensure `cargo clippy --all-targets --workspace --features bundled` passes without warnings.
- Ensure `cargo test --all-targets --workspace --features bundled-full session buildtime_bindgen` reports no failures.
- Ensure `cargo test --all-targets --workspace --features bundled` reports no failures.
- Ensure `cargo test --all-targets --workspace --features bundled-full session buildtime_bindgen` reports no failures.
## Author ## Author
John Gallagher, johnkgallagher@gmail.com John Gallagher, johnkgallagher@gmail.com

18
third_party/rust/rusqlite/benches/cache.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,18 @@
use bencher::{benchmark_group, benchmark_main, Bencher};
use rusqlite::Connection;
fn bench_no_cache(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
db.set_prepared_statement_cache_capacity(0);
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
b.iter(|| db.prepare(sql).unwrap());
}
fn bench_cache(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
b.iter(|| db.prepare_cached(sql).unwrap());
}
benchmark_group!(cache_benches, bench_no_cache, bench_cache);
benchmark_main!(cache_benches);

24
third_party/rust/rusqlite/benches/lib.rs поставляемый
Просмотреть файл

@ -1,24 +0,0 @@
#![cfg_attr(feature = "unstable", feature(test))]
#[cfg(feature = "unstable")]
mod bench {
extern crate test;
use rusqlite::Connection;
use test::Bencher;
#[bench]
fn bench_no_cache(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
db.set_prepared_statement_cache_capacity(0);
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
b.iter(|| db.prepare(sql).unwrap());
}
#[bench]
fn bench_cache(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
b.iter(|| db.prepare_cached(sql).unwrap());
}
}

8
third_party/rust/rusqlite/src/backup.rs поставляемый
Просмотреть файл

@ -77,8 +77,8 @@ impl Connection {
match r { match r {
Done => Ok(()), Done => Ok(()),
Busy => Err(error_from_handle(ptr::null_mut(), ffi::SQLITE_BUSY)), Busy => Err(unsafe { error_from_handle(ptr::null_mut(), ffi::SQLITE_BUSY) }),
Locked => Err(error_from_handle(ptr::null_mut(), ffi::SQLITE_LOCKED)), Locked => Err(unsafe { error_from_handle(ptr::null_mut(), ffi::SQLITE_LOCKED) }),
More => unreachable!(), More => unreachable!(),
} }
} }
@ -123,8 +123,8 @@ impl Connection {
match r { match r {
Done => Ok(()), Done => Ok(()),
Busy => Err(error_from_handle(ptr::null_mut(), ffi::SQLITE_BUSY)), Busy => Err(unsafe { error_from_handle(ptr::null_mut(), ffi::SQLITE_BUSY) }),
Locked => Err(error_from_handle(ptr::null_mut(), ffi::SQLITE_LOCKED)), Locked => Err(unsafe { error_from_handle(ptr::null_mut(), ffi::SQLITE_LOCKED) }),
More => unreachable!(), More => unreachable!(),
} }
} }

12
third_party/rust/rusqlite/src/error.rs поставляемый
Просмотреть файл

@ -21,7 +21,7 @@ pub enum Error {
/// Error when the value of a particular column is requested, but it cannot /// Error when the value of a particular column is requested, but it cannot
/// be converted to the requested Rust type. /// be converted to the requested Rust type.
FromSqlConversionFailure(usize, Type, Box<dyn error::Error + Send + Sync>), FromSqlConversionFailure(usize, Type, Box<dyn error::Error + Send + Sync + 'static>),
/// Error when SQLite gives us an integral value outside the range of the /// Error when SQLite gives us an integral value outside the range of the
/// requested type (e.g., trying to get the value 1000 into a `u8`). /// requested type (e.g., trying to get the value 1000 into a `u8`).
@ -80,10 +80,10 @@ pub enum Error {
/// `create_scalar_function`). /// `create_scalar_function`).
#[cfg(feature = "functions")] #[cfg(feature = "functions")]
#[allow(dead_code)] #[allow(dead_code)]
UserFunctionError(Box<dyn error::Error + Send + Sync>), UserFunctionError(Box<dyn error::Error + Send + Sync + 'static>),
/// Error available for the implementors of the `ToSql` trait. /// Error available for the implementors of the `ToSql` trait.
ToSqlConversionFailure(Box<dyn error::Error + Send + Sync>), ToSqlConversionFailure(Box<dyn error::Error + Send + Sync + 'static>),
/// Error when the SQL is not a `SELECT`, is not read-only. /// Error when the SQL is not a `SELECT`, is not read-only.
InvalidQuery, InvalidQuery,
@ -308,7 +308,7 @@ impl error::Error for Error {
} }
} }
fn cause(&self) -> Option<&dyn error::Error> { fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match *self { match *self {
Error::SqliteFailure(ref err, _) => Some(err), Error::SqliteFailure(ref err, _) => Some(err),
Error::Utf8Error(ref err) => Some(err), Error::Utf8Error(ref err) => Some(err),
@ -357,11 +357,11 @@ pub fn error_from_sqlite_code(code: c_int, message: Option<String>) -> Error {
Error::SqliteFailure(ffi::Error::new(code), message) Error::SqliteFailure(ffi::Error::new(code), message)
} }
pub fn error_from_handle(db: *mut ffi::sqlite3, code: c_int) -> Error { pub unsafe fn error_from_handle(db: *mut ffi::sqlite3, code: c_int) -> Error {
let message = if db.is_null() { let message = if db.is_null() {
None None
} else { } else {
Some(unsafe { errmsg_to_string(ffi::sqlite3_errmsg(db)) }) Some(errmsg_to_string(ffi::sqlite3_errmsg(db)))
}; };
error_from_sqlite_code(code, message) error_from_sqlite_code(code, message)
} }

16
third_party/rust/rusqlite/src/hooks.rs поставляемый
Просмотреть файл

@ -102,7 +102,7 @@ impl InnerConnection {
// `sqlite3_commit_hook`. so we keep the `xDestroy` function in // `sqlite3_commit_hook`. so we keep the `xDestroy` function in
// `InnerConnection.free_boxed_hook`. // `InnerConnection.free_boxed_hook`.
let free_commit_hook = if hook.is_some() { let free_commit_hook = if hook.is_some() {
Some(free_boxed_hook::<F> as fn(*mut c_void)) Some(free_boxed_hook::<F> as unsafe fn(*mut c_void))
} else { } else {
None None
}; };
@ -122,7 +122,7 @@ impl InnerConnection {
}; };
if !previous_hook.is_null() { if !previous_hook.is_null() {
if let Some(free_boxed_hook) = self.free_commit_hook { if let Some(free_boxed_hook) = self.free_commit_hook {
free_boxed_hook(previous_hook); unsafe { free_boxed_hook(previous_hook) };
} }
} }
self.free_commit_hook = free_commit_hook; self.free_commit_hook = free_commit_hook;
@ -143,7 +143,7 @@ impl InnerConnection {
} }
let free_rollback_hook = if hook.is_some() { let free_rollback_hook = if hook.is_some() {
Some(free_boxed_hook::<F> as fn(*mut c_void)) Some(free_boxed_hook::<F> as unsafe fn(*mut c_void))
} else { } else {
None None
}; };
@ -163,7 +163,7 @@ impl InnerConnection {
}; };
if !previous_hook.is_null() { if !previous_hook.is_null() {
if let Some(free_boxed_hook) = self.free_rollback_hook { if let Some(free_boxed_hook) = self.free_rollback_hook {
free_boxed_hook(previous_hook); unsafe { free_boxed_hook(previous_hook) };
} }
} }
self.free_rollback_hook = free_rollback_hook; self.free_rollback_hook = free_rollback_hook;
@ -202,7 +202,7 @@ impl InnerConnection {
} }
let free_update_hook = if hook.is_some() { let free_update_hook = if hook.is_some() {
Some(free_boxed_hook::<F> as fn(*mut c_void)) Some(free_boxed_hook::<F> as unsafe fn(*mut c_void))
} else { } else {
None None
}; };
@ -222,15 +222,15 @@ impl InnerConnection {
}; };
if !previous_hook.is_null() { if !previous_hook.is_null() {
if let Some(free_boxed_hook) = self.free_update_hook { if let Some(free_boxed_hook) = self.free_update_hook {
free_boxed_hook(previous_hook); unsafe { free_boxed_hook(previous_hook) };
} }
} }
self.free_update_hook = free_update_hook; self.free_update_hook = free_update_hook;
} }
} }
fn free_boxed_hook<F>(p: *mut c_void) { unsafe fn free_boxed_hook<F>(p: *mut c_void) {
drop(unsafe { Box::from_raw(p as *mut F) }); drop(Box::from_raw(p as *mut F));
} }
#[cfg(test)] #[cfg(test)]

Просмотреть файл

@ -1,5 +1,4 @@
use std::ffi::CString; use std::ffi::CString;
use std::mem::MaybeUninit;
use std::os::raw::{c_char, c_int}; use std::os::raw::{c_char, c_int};
#[cfg(feature = "load_extension")] #[cfg(feature = "load_extension")]
use std::path::Path; use std::path::Path;
@ -27,33 +26,25 @@ pub struct InnerConnection {
// interrupt would only acquire the lock after the query's completion. // interrupt would only acquire the lock after the query's completion.
interrupt_lock: Arc<Mutex<*mut ffi::sqlite3>>, interrupt_lock: Arc<Mutex<*mut ffi::sqlite3>>,
#[cfg(feature = "hooks")] #[cfg(feature = "hooks")]
pub free_commit_hook: Option<fn(*mut ::std::os::raw::c_void)>, pub free_commit_hook: Option<unsafe fn(*mut ::std::os::raw::c_void)>,
#[cfg(feature = "hooks")] #[cfg(feature = "hooks")]
pub free_rollback_hook: Option<fn(*mut ::std::os::raw::c_void)>, pub free_rollback_hook: Option<unsafe fn(*mut ::std::os::raw::c_void)>,
#[cfg(feature = "hooks")] #[cfg(feature = "hooks")]
pub free_update_hook: Option<fn(*mut ::std::os::raw::c_void)>, pub free_update_hook: Option<unsafe fn(*mut ::std::os::raw::c_void)>,
owned: bool, owned: bool,
} }
impl InnerConnection { impl InnerConnection {
#[cfg(not(feature = "hooks"))]
#[allow(clippy::mutex_atomic)] #[allow(clippy::mutex_atomic)]
pub fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection { pub unsafe fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection {
InnerConnection { InnerConnection {
db, db,
interrupt_lock: Arc::new(Mutex::new(db)), interrupt_lock: Arc::new(Mutex::new(db)),
owned,
}
}
#[cfg(feature = "hooks")] #[cfg(feature = "hooks")]
#[allow(clippy::mutex_atomic)]
pub fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection {
InnerConnection {
db,
interrupt_lock: Arc::new(Mutex::new(db)),
free_commit_hook: None, free_commit_hook: None,
#[cfg(feature = "hooks")]
free_rollback_hook: None, free_rollback_hook: None,
#[cfg(feature = "hooks")]
free_update_hook: None, free_update_hook: None,
owned, owned,
} }
@ -89,9 +80,8 @@ impl InnerConnection {
}; };
unsafe { unsafe {
let mut db = MaybeUninit::uninit(); let mut db: *mut ffi::sqlite3 = ptr::null_mut();
let r = ffi::sqlite3_open_v2(c_path.as_ptr(), db.as_mut_ptr(), flags.bits(), z_vfs); let r = ffi::sqlite3_open_v2(c_path.as_ptr(), &mut db, flags.bits(), z_vfs);
let db: *mut ffi::sqlite3 = db.assume_init();
if r != ffi::SQLITE_OK { if r != ffi::SQLITE_OK {
let e = if db.is_null() { let e = if db.is_null() {
error_from_sqlite_code(r, Some(c_path.to_string_lossy().to_string())) error_from_sqlite_code(r, Some(c_path.to_string_lossy().to_string()))
@ -135,10 +125,10 @@ impl InnerConnection {
} }
pub fn decode_result(&mut self, code: c_int) -> Result<()> { pub fn decode_result(&mut self, code: c_int) -> Result<()> {
InnerConnection::decode_result_raw(self.db(), code) unsafe { InnerConnection::decode_result_raw(self.db(), code) }
} }
fn decode_result_raw(db: *mut ffi::sqlite3, code: c_int) -> Result<()> { unsafe fn decode_result_raw(db: *mut ffi::sqlite3, code: c_int) -> Result<()> {
if code == ffi::SQLITE_OK { if code == ffi::SQLITE_OK {
Ok(()) Ok(())
} else { } else {
@ -204,28 +194,22 @@ impl InnerConnection {
pub fn load_extension(&self, dylib_path: &Path, entry_point: Option<&str>) -> Result<()> { pub fn load_extension(&self, dylib_path: &Path, entry_point: Option<&str>) -> Result<()> {
let dylib_str = super::path_to_cstring(dylib_path)?; let dylib_str = super::path_to_cstring(dylib_path)?;
unsafe { unsafe {
let mut errmsg = MaybeUninit::uninit(); let mut errmsg: *mut c_char = ptr::null_mut();
let r = if let Some(entry_point) = entry_point { let r = if let Some(entry_point) = entry_point {
let c_entry = str_to_cstring(entry_point)?; let c_entry = str_to_cstring(entry_point)?;
ffi::sqlite3_load_extension( ffi::sqlite3_load_extension(
self.db, self.db,
dylib_str.as_ptr(), dylib_str.as_ptr(),
c_entry.as_ptr(), c_entry.as_ptr(),
errmsg.as_mut_ptr(), &mut errmsg,
) )
} else { } else {
ffi::sqlite3_load_extension( ffi::sqlite3_load_extension(self.db, dylib_str.as_ptr(), ptr::null(), &mut errmsg)
self.db,
dylib_str.as_ptr(),
ptr::null(),
errmsg.as_mut_ptr(),
)
}; };
if r == ffi::SQLITE_OK { if r == ffi::SQLITE_OK {
Ok(()) Ok(())
} else { } else {
let errmsg: *mut c_char = errmsg.assume_init(); let message = super::errmsg_to_string(errmsg);
let message = super::errmsg_to_string(&*errmsg);
ffi::sqlite3_free(errmsg as *mut ::std::os::raw::c_void); ffi::sqlite3_free(errmsg as *mut ::std::os::raw::c_void);
Err(error_from_sqlite_code(r, Some(message))) Err(error_from_sqlite_code(r, Some(message)))
} }
@ -237,9 +221,9 @@ impl InnerConnection {
} }
pub fn prepare<'a>(&mut self, conn: &'a Connection, sql: &str) -> Result<Statement<'a>> { pub fn prepare<'a>(&mut self, conn: &'a Connection, sql: &str) -> Result<Statement<'a>> {
let mut c_stmt = MaybeUninit::uninit(); let mut c_stmt = ptr::null_mut();
let (c_sql, len, _) = str_for_sqlite(sql.as_bytes())?; let (c_sql, len, _) = str_for_sqlite(sql.as_bytes())?;
let mut c_tail = MaybeUninit::uninit(); let mut c_tail = ptr::null();
let r = unsafe { let r = unsafe {
if cfg!(feature = "unlock_notify") { if cfg!(feature = "unlock_notify") {
let mut rc; let mut rc;
@ -248,8 +232,8 @@ impl InnerConnection {
self.db(), self.db(),
c_sql, c_sql,
len, len,
c_stmt.as_mut_ptr(), &mut c_stmt as *mut *mut ffi::sqlite3_stmt,
c_tail.as_mut_ptr(), &mut c_tail as *mut *const c_char,
); );
if !unlock_notify::is_locked(self.db, rc) { if !unlock_notify::is_locked(self.db, rc) {
break; break;
@ -265,8 +249,8 @@ impl InnerConnection {
self.db(), self.db(),
c_sql, c_sql,
len, len,
c_stmt.as_mut_ptr(), &mut c_stmt as *mut *mut ffi::sqlite3_stmt,
c_tail.as_mut_ptr(), &mut c_tail as *mut *const c_char,
) )
} }
}; };
@ -274,11 +258,13 @@ impl InnerConnection {
self.decode_result(r)?; self.decode_result(r)?;
// If the input text contains no SQL (if the input is an empty string or a // If the input text contains no SQL (if the input is an empty string or a
// comment) then *ppStmt is set to NULL. // comment) then *ppStmt is set to NULL.
let c_stmt: *mut ffi::sqlite3_stmt = unsafe { c_stmt.assume_init() }; let c_stmt: *mut ffi::sqlite3_stmt = c_stmt;
let c_tail: *const c_char = unsafe { c_tail.assume_init() }; let c_tail: *const c_char = c_tail;
// TODO ignore spaces, comments, ... at the end // TODO ignore spaces, comments, ... at the end
let tail = !c_tail.is_null() && unsafe { c_tail != c_sql.offset(len as isize) }; let tail = !c_tail.is_null() && unsafe { c_tail != c_sql.offset(len as isize) };
Ok(Statement::new(conn, RawStatement::new(c_stmt, tail))) Ok(Statement::new(conn, unsafe {
RawStatement::new(c_stmt, tail)
}))
} }
pub fn changes(&mut self) -> usize { pub fn changes(&mut self) -> usize {

6
third_party/rust/rusqlite/src/lib.rs поставляемый
Просмотреть файл

@ -1028,25 +1028,23 @@ mod test {
// statement first. // statement first.
let raw_stmt = { let raw_stmt = {
use super::str_to_cstring; use super::str_to_cstring;
use std::mem::MaybeUninit;
use std::os::raw::c_int; use std::os::raw::c_int;
use std::ptr; use std::ptr;
let raw_db = db.db.borrow_mut().db; let raw_db = db.db.borrow_mut().db;
let sql = "SELECT 1"; let sql = "SELECT 1";
let mut raw_stmt = MaybeUninit::uninit(); let mut raw_stmt: *mut ffi::sqlite3_stmt = ptr::null_mut();
let cstring = str_to_cstring(sql).unwrap(); let cstring = str_to_cstring(sql).unwrap();
let rc = unsafe { let rc = unsafe {
ffi::sqlite3_prepare_v2( ffi::sqlite3_prepare_v2(
raw_db, raw_db,
cstring.as_ptr(), cstring.as_ptr(),
(sql.len() + 1) as c_int, (sql.len() + 1) as c_int,
raw_stmt.as_mut_ptr(), &mut raw_stmt,
ptr::null_mut(), ptr::null_mut(),
) )
}; };
assert_eq!(rc, ffi::SQLITE_OK); assert_eq!(rc, ffi::SQLITE_OK);
let raw_stmt: *mut ffi::sqlite3_stmt = unsafe { raw_stmt.assume_init() };
raw_stmt raw_stmt
}; };

Просмотреть файл

@ -10,7 +10,7 @@ use std::ptr;
pub struct RawStatement(*mut ffi::sqlite3_stmt, bool); pub struct RawStatement(*mut ffi::sqlite3_stmt, bool);
impl RawStatement { impl RawStatement {
pub fn new(stmt: *mut ffi::sqlite3_stmt, tail: bool) -> RawStatement { pub unsafe fn new(stmt: *mut ffi::sqlite3_stmt, tail: bool) -> RawStatement {
RawStatement(stmt, tail) RawStatement(stmt, tail)
} }
@ -64,10 +64,10 @@ impl RawStatement {
let mut rc; let mut rc;
loop { loop {
rc = unsafe { ffi::sqlite3_step(self.0) }; rc = unsafe { ffi::sqlite3_step(self.0) };
if !unlock_notify::is_locked(db, rc) { if unsafe { !unlock_notify::is_locked(db, rc) } {
break; break;
} }
rc = unlock_notify::wait_for_unlock_notify(db); rc = unsafe { unlock_notify::wait_for_unlock_notify(db) };
if rc != ffi::SQLITE_OK { if rc != ffi::SQLITE_OK {
break; break;
} }

88
third_party/rust/rusqlite/src/session.rs поставляемый
Просмотреть файл

@ -4,7 +4,6 @@
use std::ffi::CStr; use std::ffi::CStr;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem::MaybeUninit;
use std::os::raw::{c_char, c_int, c_uchar, c_void}; use std::os::raw::{c_char, c_int, c_uchar, c_void};
use std::panic::{catch_unwind, RefUnwindSafe}; use std::panic::{catch_unwind, RefUnwindSafe};
use std::ptr; use std::ptr;
@ -43,9 +42,8 @@ impl Session<'_> {
let db = db.db.borrow_mut().db; let db = db.db.borrow_mut().db;
let mut s = MaybeUninit::uninit(); let mut s: *mut ffi::sqlite3_session = ptr::null_mut();
check!(unsafe { ffi::sqlite3session_create(db, name.as_ptr(), s.as_mut_ptr()) }); check!(unsafe { ffi::sqlite3session_create(db, name.as_ptr(), &mut s) });
let s: *mut ffi::sqlite3_session = unsafe { s.assume_init() };
Ok(Session { Ok(Session {
phantom: PhantomData, phantom: PhantomData,
@ -113,9 +111,8 @@ impl Session<'_> {
/// Generate a Changeset /// Generate a Changeset
pub fn changeset(&mut self) -> Result<Changeset> { pub fn changeset(&mut self) -> Result<Changeset> {
let mut n = 0; let mut n = 0;
let mut cs = MaybeUninit::uninit(); let mut cs: *mut c_void = ptr::null_mut();
check!(unsafe { ffi::sqlite3session_changeset(self.s, &mut n, cs.as_mut_ptr()) }); check!(unsafe { ffi::sqlite3session_changeset(self.s, &mut n, &mut cs) });
let cs: *mut c_void = unsafe { cs.assume_init() };
Ok(Changeset { cs, n }) Ok(Changeset { cs, n })
} }
@ -135,9 +132,8 @@ impl Session<'_> {
/// Generate a Patchset /// Generate a Patchset
pub fn patchset(&mut self) -> Result<Changeset> { pub fn patchset(&mut self) -> Result<Changeset> {
let mut n = 0; let mut n = 0;
let mut ps = MaybeUninit::uninit(); let mut ps: *mut c_void = ptr::null_mut();
check!(unsafe { ffi::sqlite3session_patchset(self.s, &mut n, ps.as_mut_ptr()) }); check!(unsafe { ffi::sqlite3session_patchset(self.s, &mut n, &mut ps) });
let ps: *mut c_void = unsafe { ps.assume_init() };
// TODO Validate: same struct // TODO Validate: same struct
Ok(Changeset { cs: ps, n }) Ok(Changeset { cs: ps, n })
} }
@ -160,10 +156,11 @@ impl Session<'_> {
let from = from.to_cstring()?; let from = from.to_cstring()?;
let table = str_to_cstring(table)?.as_ptr(); let table = str_to_cstring(table)?.as_ptr();
unsafe { unsafe {
let mut errmsg = MaybeUninit::uninit(); let mut errmsg = ptr::null_mut();
let r = ffi::sqlite3session_diff(self.s, from.as_ptr(), table, errmsg.as_mut_ptr()); let r =
ffi::sqlite3session_diff(self.s, from.as_ptr(), table, &mut errmsg as *mut *mut _);
if r != ffi::SQLITE_OK { if r != ffi::SQLITE_OK {
let errmsg: *mut c_char = errmsg.assume_init(); let errmsg: *mut c_char = errmsg;
let message = errmsg_to_string(&*errmsg); let message = errmsg_to_string(&*errmsg);
ffi::sqlite3_free(errmsg as *mut ::std::os::raw::c_void); ffi::sqlite3_free(errmsg as *mut ::std::os::raw::c_void);
return Err(error_from_sqlite_code(r, Some(message))); return Err(error_from_sqlite_code(r, Some(message)));
@ -258,17 +255,17 @@ impl Changeset {
/// Invert a changeset /// Invert a changeset
pub fn invert(&self) -> Result<Changeset> { pub fn invert(&self) -> Result<Changeset> {
let mut n = 0; let mut n = 0;
let mut cs = MaybeUninit::uninit(); let mut cs = ptr::null_mut();
check!(unsafe { ffi::sqlite3changeset_invert(self.n, self.cs, &mut n, cs.as_mut_ptr()) }); check!(unsafe {
let cs: *mut c_void = unsafe { cs.assume_init() }; ffi::sqlite3changeset_invert(self.n, self.cs, &mut n, &mut cs as *mut *mut _)
});
Ok(Changeset { cs, n }) Ok(Changeset { cs, n })
} }
/// Create an iterator to traverse a changeset /// Create an iterator to traverse a changeset
pub fn iter(&self) -> Result<ChangesetIter<'_>> { pub fn iter(&self) -> Result<ChangesetIter<'_>> {
let mut it = MaybeUninit::uninit(); let mut it = ptr::null_mut();
check!(unsafe { ffi::sqlite3changeset_start(it.as_mut_ptr(), self.n, self.cs) }); check!(unsafe { ffi::sqlite3changeset_start(&mut it as *mut *mut _, self.n, self.cs) });
let it: *mut ffi::sqlite3_changeset_iter = unsafe { it.assume_init() };
Ok(ChangesetIter { Ok(ChangesetIter {
phantom: PhantomData, phantom: PhantomData,
it, it,
@ -279,11 +276,10 @@ impl Changeset {
/// Concatenate two changeset objects /// Concatenate two changeset objects
pub fn concat(a: &Changeset, b: &Changeset) -> Result<Changeset> { pub fn concat(a: &Changeset, b: &Changeset) -> Result<Changeset> {
let mut n = 0; let mut n = 0;
let mut cs = MaybeUninit::uninit(); let mut cs = ptr::null_mut();
check!(unsafe { check!(unsafe {
ffi::sqlite3changeset_concat(a.n, a.cs, b.n, b.cs, &mut n, cs.as_mut_ptr()) ffi::sqlite3changeset_concat(a.n, a.cs, b.n, b.cs, &mut n, &mut cs as *mut *mut _)
}); });
let cs: *mut c_void = unsafe { cs.assume_init() };
Ok(Changeset { cs, n }) Ok(Changeset { cs, n })
} }
} }
@ -307,15 +303,14 @@ pub struct ChangesetIter<'changeset> {
impl ChangesetIter<'_> { impl ChangesetIter<'_> {
/// Create an iterator on `input` /// Create an iterator on `input`
pub fn start_strm<'input>(input: &&'input mut dyn Read) -> Result<ChangesetIter<'input>> { pub fn start_strm<'input>(input: &&'input mut dyn Read) -> Result<ChangesetIter<'input>> {
let mut it = MaybeUninit::uninit(); let mut it = ptr::null_mut();
check!(unsafe { check!(unsafe {
ffi::sqlite3changeset_start_strm( ffi::sqlite3changeset_start_strm(
it.as_mut_ptr(), &mut it as *mut *mut _,
Some(x_input), Some(x_input),
input as *const &mut dyn Read as *mut c_void, input as *const &mut dyn Read as *mut c_void,
) )
}); });
let it: *mut ffi::sqlite3_changeset_iter = unsafe { it.assume_init() };
Ok(ChangesetIter { Ok(ChangesetIter {
phantom: PhantomData, phantom: PhantomData,
it, it,
@ -396,13 +391,12 @@ impl ChangesetItem {
/// `SQLITE_CHANGESET_CONFLICT` conflict handler callback. /// `SQLITE_CHANGESET_CONFLICT` conflict handler callback.
pub fn conflict(&self, col: usize) -> Result<ValueRef<'_>> { pub fn conflict(&self, col: usize) -> Result<ValueRef<'_>> {
unsafe { unsafe {
let mut p_value = MaybeUninit::uninit(); let mut p_value: *mut ffi::sqlite3_value = ptr::null_mut();
check!(ffi::sqlite3changeset_conflict( check!(ffi::sqlite3changeset_conflict(
self.it, self.it,
col as i32, col as i32,
p_value.as_mut_ptr() &mut p_value,
)); ));
let p_value: *mut ffi::sqlite3_value = p_value.assume_init();
Ok(ValueRef::from_value(p_value)) Ok(ValueRef::from_value(p_value))
} }
} }
@ -425,13 +419,8 @@ impl ChangesetItem {
/// `SQLITE_INSERT`. /// `SQLITE_INSERT`.
pub fn new_value(&self, col: usize) -> Result<ValueRef<'_>> { pub fn new_value(&self, col: usize) -> Result<ValueRef<'_>> {
unsafe { unsafe {
let mut p_value = MaybeUninit::uninit(); let mut p_value: *mut ffi::sqlite3_value = ptr::null_mut();
check!(ffi::sqlite3changeset_new( check!(ffi::sqlite3changeset_new(self.it, col as i32, &mut p_value,));
self.it,
col as i32,
p_value.as_mut_ptr()
));
let p_value: *mut ffi::sqlite3_value = p_value.assume_init();
Ok(ValueRef::from_value(p_value)) Ok(ValueRef::from_value(p_value))
} }
} }
@ -442,13 +431,8 @@ impl ChangesetItem {
/// `SQLITE_UPDATE`. /// `SQLITE_UPDATE`.
pub fn old_value(&self, col: usize) -> Result<ValueRef<'_>> { pub fn old_value(&self, col: usize) -> Result<ValueRef<'_>> {
unsafe { unsafe {
let mut p_value = MaybeUninit::uninit(); let mut p_value: *mut ffi::sqlite3_value = ptr::null_mut();
check!(ffi::sqlite3changeset_old( check!(ffi::sqlite3changeset_old(self.it, col as i32, &mut p_value,));
self.it,
col as i32,
p_value.as_mut_ptr()
));
let p_value: *mut ffi::sqlite3_value = p_value.assume_init();
Ok(ValueRef::from_value(p_value)) Ok(ValueRef::from_value(p_value))
} }
} }
@ -459,15 +443,14 @@ impl ChangesetItem {
let mut code = 0; let mut code = 0;
let mut indirect = 0; let mut indirect = 0;
let tab = unsafe { let tab = unsafe {
let mut pz_tab = MaybeUninit::uninit(); let mut pz_tab: *const c_char = ptr::null();
check!(ffi::sqlite3changeset_op( check!(ffi::sqlite3changeset_op(
self.it, self.it,
pz_tab.as_mut_ptr(), &mut pz_tab,
&mut number_of_columns, &mut number_of_columns,
&mut code, &mut code,
&mut indirect &mut indirect
)); ));
let pz_tab: *const c_char = pz_tab.assume_init();
CStr::from_ptr(pz_tab) CStr::from_ptr(pz_tab)
}; };
let table_name = tab.to_str()?; let table_name = tab.to_str()?;
@ -483,13 +466,12 @@ impl ChangesetItem {
pub fn pk(&self) -> Result<&[u8]> { pub fn pk(&self) -> Result<&[u8]> {
let mut number_of_columns = 0; let mut number_of_columns = 0;
unsafe { unsafe {
let mut pks = MaybeUninit::uninit(); let mut pks: *mut c_uchar = ptr::null_mut();
check!(ffi::sqlite3changeset_pk( check!(ffi::sqlite3changeset_pk(
self.it, self.it,
pks.as_mut_ptr(), &mut pks,
&mut number_of_columns &mut number_of_columns
)); ));
let pks: *mut c_uchar = pks.assume_init();
Ok(from_raw_parts(pks, number_of_columns as usize)) Ok(from_raw_parts(pks, number_of_columns as usize))
} }
} }
@ -503,9 +485,8 @@ pub struct Changegroup {
impl Changegroup { impl Changegroup {
pub fn new() -> Result<Self> { pub fn new() -> Result<Self> {
let mut cg = MaybeUninit::uninit(); let mut cg = ptr::null_mut();
check!(unsafe { ffi::sqlite3changegroup_new(cg.as_mut_ptr()) }); check!(unsafe { ffi::sqlite3changegroup_new(&mut cg) });
let cg: *mut ffi::sqlite3_changegroup = unsafe { cg.assume_init() };
Ok(Changegroup { cg }) Ok(Changegroup { cg })
} }
@ -531,9 +512,8 @@ impl Changegroup {
/// Obtain a composite Changeset /// Obtain a composite Changeset
pub fn output(&mut self) -> Result<Changeset> { pub fn output(&mut self) -> Result<Changeset> {
let mut n = 0; let mut n = 0;
let mut output = MaybeUninit::uninit(); let mut output: *mut c_void = ptr::null_mut();
check!(unsafe { ffi::sqlite3changegroup_output(self.cg, &mut n, output.as_mut_ptr()) }); check!(unsafe { ffi::sqlite3changegroup_output(self.cg, &mut n, &mut output) });
let output: *mut c_void = unsafe { output.assume_init() };
Ok(Changeset { cs: output, n }) Ok(Changeset { cs: output, n })
} }

4
third_party/rust/rusqlite/src/statement.rs поставляемый
Просмотреть файл

@ -619,7 +619,7 @@ impl Statement<'_> {
} }
fn finalize_(&mut self) -> Result<()> { fn finalize_(&mut self) -> Result<()> {
let mut stmt = RawStatement::new(ptr::null_mut(), false); let mut stmt = unsafe { RawStatement::new(ptr::null_mut(), false) };
mem::swap(&mut stmt, &mut self.stmt); mem::swap(&mut stmt, &mut self.stmt);
self.conn.decode_result(stmt.finalize()) self.conn.decode_result(stmt.finalize())
} }
@ -710,7 +710,7 @@ impl Statement<'_> {
impl Into<RawStatement> for Statement<'_> { impl Into<RawStatement> for Statement<'_> {
fn into(mut self) -> RawStatement { fn into(mut self) -> RawStatement {
let mut stmt = RawStatement::new(ptr::null_mut(), false); let mut stmt = unsafe { RawStatement::new(ptr::null_mut(), false) };
mem::swap(&mut stmt, &mut self.stmt); mem::swap(&mut stmt, &mut self.stmt);
stmt stmt
} }

37
third_party/rust/rusqlite/src/types/to_sql.rs поставляемый
Просмотреть файл

@ -90,7 +90,7 @@ pub trait ToSql {
fn to_sql(&self) -> Result<ToSqlOutput<'_>>; fn to_sql(&self) -> Result<ToSqlOutput<'_>>;
} }
impl<T: ToSql + Clone + ?Sized> ToSql for Cow<'_, T> { impl<T: ToSql + ToOwned + ?Sized> ToSql for Cow<'_, T> {
fn to_sql(&self) -> Result<ToSqlOutput<'_>> { fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
self.as_ref().to_sql() self.as_ref().to_sql()
} }
@ -223,17 +223,20 @@ mod test {
fn test_cow_str() { fn test_cow_str() {
use std::borrow::Cow; use std::borrow::Cow;
let s = "str"; let s = "str";
let cow = Cow::Borrowed(s); let cow: Cow<str> = Cow::Borrowed(s);
let r = cow.to_sql(); let r = cow.to_sql();
assert!(r.is_ok()); assert!(r.is_ok());
let cow = Cow::Owned::<str>(String::from(s)); let cow: Cow<str> = Cow::Owned::<str>(String::from(s));
let r = cow.to_sql(); let r = cow.to_sql();
assert!(r.is_ok()); assert!(r.is_ok());
// Ensure this compiles.
let _p: &[&dyn ToSql] = crate::params![cow];
} }
#[test] #[test]
fn test_box_dyn() { fn test_box_dyn() {
let s: Box<dyn ToSql> = Box::new("Hello world!"); let s: Box<dyn ToSql> = Box::new("Hello world!");
let _s: &[&dyn ToSql] = crate::params![s];
let r = ToSql::to_sql(&s); let r = ToSql::to_sql(&s);
assert!(r.is_ok()); assert!(r.is_ok());
@ -242,6 +245,7 @@ mod test {
#[test] #[test]
fn test_box_deref() { fn test_box_deref() {
let s: Box<str> = "Hello world!".into(); let s: Box<str> = "Hello world!".into();
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql(); let r = s.to_sql();
assert!(r.is_ok()); assert!(r.is_ok());
@ -250,6 +254,7 @@ mod test {
#[test] #[test]
fn test_box_direct() { fn test_box_direct() {
let s: Box<str> = "Hello world!".into(); let s: Box<str> = "Hello world!".into();
let _s: &[&dyn ToSql] = crate::params![s];
let r = ToSql::to_sql(&s); let r = ToSql::to_sql(&s);
assert!(r.is_ok()); assert!(r.is_ok());
@ -261,11 +266,33 @@ mod test {
let source_str: Box<str> = "Hello world!".into(); let source_str: Box<str> = "Hello world!".into();
let s: Rc<_> = Rc::new(source_str.clone()); let s: Rc<Box<str>> = Rc::new(source_str.clone());
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql(); let r = s.to_sql();
assert!(r.is_ok()); assert!(r.is_ok());
let s: Arc<_> = Arc::new(source_str); let s: Arc<Box<str>> = Arc::new(source_str.clone());
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql();
assert!(r.is_ok());
let s: Arc<str> = Arc::from(&*source_str);
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql();
assert!(r.is_ok());
let s: Arc<dyn ToSql> = Arc::new(source_str.clone());
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql();
assert!(r.is_ok());
let s: Rc<str> = Rc::from(&*source_str);
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql();
assert!(r.is_ok());
let s: Rc<dyn ToSql> = Rc::new(source_str);
let _s: &[&dyn ToSql] = crate::params![s];
let r = s.to_sql(); let r = s.to_sql();
assert!(r.is_ok()); assert!(r.is_ok());
} }

Просмотреть файл

@ -53,10 +53,10 @@ unsafe extern "C" fn unlock_notify_cb(ap_arg: *mut *mut c_void, n_arg: c_int) {
} }
#[cfg(feature = "unlock_notify")] #[cfg(feature = "unlock_notify")]
pub fn is_locked(db: *mut ffi::sqlite3, rc: c_int) -> bool { pub unsafe fn is_locked(db: *mut ffi::sqlite3, rc: c_int) -> bool {
rc == ffi::SQLITE_LOCKED_SHAREDCACHE rc == ffi::SQLITE_LOCKED_SHAREDCACHE
|| (rc & 0xFF) == ffi::SQLITE_LOCKED || (rc & 0xFF) == ffi::SQLITE_LOCKED
&& unsafe { ffi::sqlite3_extended_errcode(db) } == ffi::SQLITE_LOCKED_SHAREDCACHE && ffi::sqlite3_extended_errcode(db) == ffi::SQLITE_LOCKED_SHAREDCACHE
} }
/// This function assumes that an SQLite API call (either `sqlite3_prepare_v2()` /// This function assumes that an SQLite API call (either `sqlite3_prepare_v2()`
@ -72,16 +72,14 @@ pub fn is_locked(db: *mut ffi::sqlite3, rc: c_int) -> bool {
/// this case the caller should not retry the operation and should roll /// this case the caller should not retry the operation and should roll
/// back the current transaction (if any). /// back the current transaction (if any).
#[cfg(feature = "unlock_notify")] #[cfg(feature = "unlock_notify")]
pub fn wait_for_unlock_notify(db: *mut ffi::sqlite3) -> c_int { pub unsafe fn wait_for_unlock_notify(db: *mut ffi::sqlite3) -> c_int {
let mut un = UnlockNotification::new(); let mut un = UnlockNotification::new();
/* Register for an unlock-notify callback. */ /* Register for an unlock-notify callback. */
let rc = unsafe { let rc = ffi::sqlite3_unlock_notify(
ffi::sqlite3_unlock_notify(
db, db,
Some(unlock_notify_cb), Some(unlock_notify_cb),
&mut un as *mut UnlockNotification as *mut c_void, &mut un as *mut UnlockNotification as *mut c_void,
) );
};
debug_assert!( debug_assert!(
rc == ffi::SQLITE_LOCKED || rc == ffi::SQLITE_LOCKED_SHAREDCACHE || rc == ffi::SQLITE_OK rc == ffi::SQLITE_LOCKED || rc == ffi::SQLITE_LOCKED_SHAREDCACHE || rc == ffi::SQLITE_OK
); );
@ -92,12 +90,12 @@ pub fn wait_for_unlock_notify(db: *mut ffi::sqlite3) -> c_int {
} }
#[cfg(not(feature = "unlock_notify"))] #[cfg(not(feature = "unlock_notify"))]
pub fn is_locked(_db: *mut ffi::sqlite3, _rc: c_int) -> bool { pub unsafe fn is_locked(_db: *mut ffi::sqlite3, _rc: c_int) -> bool {
unreachable!() unreachable!()
} }
#[cfg(not(feature = "unlock_notify"))] #[cfg(not(feature = "unlock_notify"))]
pub fn wait_for_unlock_notify(_db: *mut ffi::sqlite3) -> c_int { pub unsafe fn wait_for_unlock_notify(_db: *mut ffi::sqlite3) -> c_int {
unreachable!() unreachable!()
} }

3
third_party/rust/rusqlite/src/vtab/mod.rs поставляемый
Просмотреть файл

@ -70,8 +70,7 @@ unsafe impl<T: VTab> Send for Module<T> {}
unsafe impl<T: VTab> Sync for Module<T> {} unsafe impl<T: VTab> Sync for Module<T> {}
// Used as a trailing initializer for sqlite3_module -- this way we avoid having // Used as a trailing initializer for sqlite3_module -- this way we avoid having
// the build fail if buildtime_bindgen is on, our bindings have // the build fail if buildtime_bindgen is on
// `sqlite3_module::xShadowName`, but vtab_v3 wasn't specified.
fn zeroed_module() -> ffi::sqlite3_module { fn zeroed_module() -> ffi::sqlite3_module {
// This is safe, as bindgen-generated structs are allowed to be zeroed. // This is safe, as bindgen-generated structs are allowed to be zeroed.
unsafe { std::mem::MaybeUninit::zeroed().assume_init() } unsafe { std::mem::MaybeUninit::zeroed().assume_init() }

Просмотреть файл

@ -58,7 +58,7 @@ fluent-langneg-ffi = { path = "../../../../intl/locale/rust/fluent-langneg-ffi"
# version less than or equal to what we link to. This isn't a problem because we # version less than or equal to what we link to. This isn't a problem because we
# tend to keep this up to date, but it needs to be taken into consideration when # tend to keep this up to date, but it needs to be taken into consideration when
# changing this version. # changing this version.
rusqlite = { version = "=0.22.0-beta.0", features = ["modern_sqlite", "in_gecko"] } rusqlite = { version = "0.22.0", features = ["modern_sqlite", "in_gecko"] }
fluent = { version = "0.11" , features = ["fluent-pseudo"] } fluent = { version = "0.11" , features = ["fluent-pseudo"] }
fluent-ffi = { path = "../../../../intl/l10n/rust/fluent-ffi" } fluent-ffi = { path = "../../../../intl/l10n/rust/fluent-ffi" }