mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
Drop urlencoding dependency (#3162)
This commit is contained in:
parent
352b02de6a
commit
e0a72cf8f2
3 changed files with 10 additions and 14 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -3541,12 +3541,12 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_urlencoded",
|
||||
"sqlx",
|
||||
"sqlx-core",
|
||||
"time",
|
||||
"tracing",
|
||||
"url",
|
||||
"urlencoding",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
|
@ -4018,12 +4018,6 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "urlencoding"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
|
|
|
@ -33,6 +33,7 @@ uuid = { workspace = true, optional = true }
|
|||
|
||||
url = { version = "2.2.2", default-features = false }
|
||||
percent-encoding = "2.1.0"
|
||||
serde_urlencoded = "0.7"
|
||||
|
||||
flume = { version = "0.11.0", default-features = false, features = ["async"] }
|
||||
|
||||
|
@ -43,7 +44,6 @@ tracing = { version = "0.1.37", features = ["log"] }
|
|||
|
||||
serde = { version = "1.0.145", features = ["derive"], optional = true }
|
||||
regex = { version = "1.5.5", optional = true }
|
||||
urlencoding = "2.1.3"
|
||||
|
||||
[dependencies.libsqlite3-sys]
|
||||
version = "0.28.0"
|
||||
|
|
|
@ -9,7 +9,9 @@ use libsqlite3_sys::{
|
|||
SQLITE_OPEN_CREATE, SQLITE_OPEN_FULLMUTEX, SQLITE_OPEN_MEMORY, SQLITE_OPEN_NOMUTEX,
|
||||
SQLITE_OPEN_PRIVATECACHE, SQLITE_OPEN_READONLY, SQLITE_OPEN_READWRITE, SQLITE_OPEN_SHAREDCACHE,
|
||||
};
|
||||
use percent_encoding::NON_ALPHANUMERIC;
|
||||
use sqlx_core::IndexMap;
|
||||
use std::collections::BTreeMap;
|
||||
use std::ffi::{c_void, CStr, CString};
|
||||
use std::io;
|
||||
use std::os::raw::c_int;
|
||||
|
@ -92,21 +94,21 @@ impl EstablishParams {
|
|||
SQLITE_OPEN_PRIVATECACHE
|
||||
};
|
||||
|
||||
let mut query_params: Vec<String> = vec![];
|
||||
let mut query_params = BTreeMap::new();
|
||||
|
||||
if options.immutable {
|
||||
query_params.push("immutable=true".into())
|
||||
query_params.insert("immutable", "true");
|
||||
}
|
||||
|
||||
if let Some(vfs) = &options.vfs {
|
||||
query_params.push(format!("vfs={vfs}"))
|
||||
if let Some(vfs) = options.vfs.as_deref() {
|
||||
query_params.insert("vfs", &vfs);
|
||||
}
|
||||
|
||||
if !query_params.is_empty() {
|
||||
filename = format!(
|
||||
"file:{}?{}",
|
||||
urlencoding::encode(&filename),
|
||||
query_params.join("&")
|
||||
percent_encoding::percent_encode(filename.as_bytes(), &NON_ALPHANUMERIC),
|
||||
serde_urlencoded::to_string(&query_params).unwrap()
|
||||
);
|
||||
flags |= libsqlite3_sys::SQLITE_OPEN_URI;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue