Questions tagged [rusqlite]
27 questions
0
votes
0 answers
One to many relationships with rusqlite and query_map
Im new to learning Rust. I am trying to create a POS as a side project for myself. I have a couple different sqlite database tables that match to these rust structs. These are the important ones for this question. Excuse the weird names I will…

Nate_Levin
- 1
- 1
0
votes
1 answer
Deleting an item from a database using form data in Rocket.rs
I'm trying to recreate a simple note app I built in JavaScript in Rust but I've ran into an issue with trying to delete an item from my database using form data. I've followed the docs for help but I have no idea how to implement it, I'm pretty new…

Oscar S
- 11
- 2
0
votes
0 answers
the trait `std::convert::From` is not implemented for `std::io::Error`
I've tried replacing Result<()> with Result<(), std::io::Error> But it results in: more errors.
Error:
error[E0277]: `?` couldn't convert the error to `std::io::Error`
--> src/main.rs:48:53
|
48 | let conn =…

Deera Wijesundara
- 580
- 4
- 15
0
votes
1 answer
Rust: Match statement mismatched type error for enum Result
I'm still a Rust noob and I'm writing a CLI tool that reads user input and makes API calls or local DB queries through a match statement. The error I'm encountering is on the line "new" => util::db::insert_number(&conn, user_input).await I'm able to…

zig
- 11
- 3
0
votes
1 answer
What is the best way to store an enum in a database in rusqlite?
If I have a simple struct, one attribute of which contains a simple enum, how can I best store examples of this struct with their enumerations in the rusqlite database? Something like:
use rusqlite::{params, Connection, Result};
enum Sex{
…

FinleyGibson
- 911
- 5
- 18
0
votes
1 answer
rusqlite: How can I pass a vector with different data types as params to the execute function of a prepared statement
Background
To give a little bit of context: I have to mention that I am fairly new to Rust, so some of my questions might be really basic/silly - apologies for that! I am trying to implement a thin wrapper around rusqlite, which should allow to…

Dan0175
- 97
- 1
- 5
0
votes
1 answer
How to optimize querying multiple unrelated tables in SQLite?
I have scenario when I have to iterate through multiple tables in quite big sqlite database. In tables I store informations about planet position on sky through years. So e.g. for Mars I have tables Mars_2000, Mars_2001 and so on. Table structure is…

Mateusz Pydych
- 117
- 8
0
votes
1 answer
How to close a rusqlite connection in a mutex?
I have a rusqlite connect in a mutex
as follows:
struct MyStruct {
connection: std::sync::Mutex,
}
When I'm finished with it I want to close it, which I attempted to do as follows:
let lock_ro =…

trampster
- 8,598
- 4
- 37
- 52
0
votes
1 answer
How to pass Vec> in rusqlite as query param
I'm following the example from the rusqlite git hub https://github.com/rusqlite/rusqlite/blob/master/src/vtab/array.rs#L206. I have the exact same code but I get the compile error
the trait bound `std::vec::Vec:…

Dave
- 179
- 1
- 1
- 7
0
votes
1 answer
Convert Vec to std::rc::RC>
I have a function that receives a list of ids and then selects them from a database. I'm passing in a Vec and I found this issue https://github.com/rusqlite/rusqlite/issues/430 which linked to here…

Dave
- 179
- 1
- 1
- 7
0
votes
1 answer
Can a SQLite user-defined function take a row argument?
They are described as scalar, but I think that refers to the return type rather than the arguments.
I'm trying to define one in rust that will provide a TEXT value derived from other columns in the row, for convenience/readability at point of use,…

OJFord
- 10,522
- 8
- 64
- 98
0
votes
1 answer
rusqlite and pyo3 PyResult handling errors
I'm attempting to open and write to a database in a Rust library I will call from python, with the help of pyo3. If an error occurs, I would like to raise an exception that can be caught in the calling Python process, but I'm having difficulties…

Simen Russnes
- 2,002
- 2
- 26
- 56