Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

rusqlite 0.40 (#83)

Lars Talianb53248b9e68e
diff --git a/Cargo.lock b/Cargo.lock
index 237d1ec..f68b65c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -882,12 +882,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-[[package]]
-name = "foldhash"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
-
[[package]]
name = "foldhash"
version = "0.2.0"
@@ -1122,31 +1116,22 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "hashbrown"
-version = "0.15.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
-dependencies = [
- "foldhash 0.1.5",
-]
-
[[package]]
name = "hashbrown"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
dependencies = [
- "foldhash 0.2.0",
+ "foldhash",
]
[[package]]
name = "hashlink"
-version = "0.10.0"
+version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
+checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb"
dependencies = [
- "hashbrown 0.15.5",
+ "hashbrown",
]
[[package]]
@@ -1500,7 +1485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
dependencies = [
"equivalent",
- "hashbrown 0.17.1",
+ "hashbrown",
"serde",
"serde_core",
]
@@ -1850,9 +1835,9 @@ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
[[package]]
name = "libsqlite3-sys"
-version = "0.35.0"
+version = "0.38.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f"
+checksum = "f1d20bef17f513b9b3004532233187769cd072d790971f4e4da0e346eb6401e8"
dependencies = [
"cc",
"pkg-config",
@@ -1899,7 +1884,7 @@ version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5"
dependencies = [
- "hashbrown 0.17.1",
+ "hashbrown",
]
[[package]]
@@ -2993,9 +2978,9 @@ dependencies = [
[[package]]
name = "rusqlite"
-version = "0.37.0"
+version = "0.40.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f"
+checksum = "23f2a97da3e3873c73cb2a2e71b35c40ff95e0b1eefa8d72d8499a6928c3b5b3"
dependencies = [
"bitflags",
"fallible-iterator",
@@ -3261,7 +3246,7 @@ version = "1.0.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
dependencies = [
- "foldhash 0.2.0",
+ "foldhash",
"indexmap",
"itoa",
"memchr",
diff --git a/Cargo.toml b/Cargo.toml
index 4db4907..efd433b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ iroh = "1.3"
iroh-mdns-address-lookup = "0.6"
ring = "0.17"
rmcp = { version = "3.5", features = ["server", "macros", "transport-io"] }
-rusqlite = { version = "0.37", features = ["bundled"] }
+rusqlite = { version = "0.40", default-features = false, features = ["bundled", "cache"] }
schemars = "1"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
diff --git a/src/store.rs b/src/store.rs
index 392e36d..d48ffea 100644
--- a/src/store.rs
+++ b/src/store.rs
@@ -382,8 +382,10 @@ impl Store {
"SELECT day, sent, received FROM counts
WHERE day BETWEEN date(?1 / 1000, 'unixepoch', ?2) AND date(?1 / 1000, 'unixepoch', ?3) ORDER BY day",
)?;
+ // SQLite integers are i64; a count is never negative.
+ let count = |r: &rusqlite::Row, i: usize| r.get::<_, i64>(i).map(|n| n.max(0) as u64);
let rows = st.query_map(params![now, COUNTS_FROM, COUNTS_TO], |r| {
- Ok(DayCount { day: r.get(0)?, sent: r.get(1)?, received: r.get(2)? })
+ Ok(DayCount { day: r.get(0)?, sent: count(r, 1)?, received: count(r, 2)? })
})?;
Ok(rows.collect::<rusqlite::Result<_>>()?)
}