Open the source DB read-only

This commit is contained in:
Jake Howard 2023-03-17 16:49:47 +00:00
parent 7d4a1ecd9b
commit 7c72cc0ff3
No known key found for this signature in database
GPG Key ID: 8198AEBFA7E86782
1 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,5 @@
use rusqlite::backup::{Backup, Progress};
use rusqlite::Connection;
use rusqlite::{Connection, OpenFlags};
use std::env;
use std::fs::copy;
use std::path::Path;
@ -19,7 +19,13 @@ fn main() {
println!("{}", src_file.metadata().unwrap().len() / 1000);
println!("{}", tmpfile_path.display());
let src_db = Connection::open(src_file).unwrap();
let src_db = Connection::open_with_flags(
src_file,
OpenFlags::SQLITE_OPEN_READ_ONLY
| OpenFlags::SQLITE_OPEN_NO_MUTEX
| OpenFlags::SQLITE_OPEN_PRIVATE_CACHE,
)
.unwrap();
let mut dest_db = Connection::open(tmpfile_path).unwrap();
{