SQLite User Forum

I want to file a database created in-memory in rust.
Login

I want to file a database created in-memory in rust.

(1) By anonymous on 2022-07-21 07:36:44 [link] [source]

I want to file a database created in-memory with Rust. However, I don't know how to do this without literature. I would like to know how to persist a database in a Rust environment. The crate I am using is rusqlite, but I am open to using other crates. Sample code would be great.

(2) By Ryan Smith (cuz) on 2022-07-21 10:37:12 in reply to 1 [source]

I don't know how to do this without literature

This forum is not the correct place for Rust literature, we do not know Rust's connectors, but we can help with SQLite.

An in-memory Database, like any other SQLite database, can be serialized to an external DB file in a few ways. The most basic ways and their literature are:

The Backup API page has specific examples of saving In-Memory DBs.

Note: Serializing and Backup both happen via APIs, but VACUUM INTO can happen via the SQL/DDL.

(3.2) By Zuurr (zuuurrr) on 2022-07-22 09:23:45 edited from 3.1 in reply to 1 [link] [source]

Rust specific questions like this are possibly better asked in the rusqlite github discussion forum: https://github.com/rusqlite/rusqlite/discussions.