Open the source DB read-only
This commit is contained in:
parent
7d4a1ecd9b
commit
7c72cc0ff3
1 changed files with 8 additions and 2 deletions
10
src/main.rs
10
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
use rusqlite::backup::{Backup, Progress};
|
use rusqlite::backup::{Backup, Progress};
|
||||||
use rusqlite::Connection;
|
use rusqlite::{Connection, OpenFlags};
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::copy;
|
use std::fs::copy;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -19,7 +19,13 @@ fn main() {
|
||||||
println!("{}", src_file.metadata().unwrap().len() / 1000);
|
println!("{}", src_file.metadata().unwrap().len() / 1000);
|
||||||
println!("{}", tmpfile_path.display());
|
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();
|
let mut dest_db = Connection::open(tmpfile_path).unwrap();
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue