move transaction handling to rust code

master
Tom Alexander 5 years ago
parent 2248cdeaad
commit 523a3f6ec4

@ -13,8 +13,10 @@ impl DbHandle {
.as_ref()
.map(|path: &String| PathBuf::from(path))
.unwrap_or_else(|| dirs::home_dir().unwrap().join(".foil").to_path_buf());
let conn: Connection = Connection::open(path).unwrap();
conn.execute_batch(DB_INIT_QUERY).unwrap();
let mut conn: Connection = Connection::open(path).unwrap();
let tx = conn.transaction().unwrap();
tx.execute_batch(DB_INIT_QUERY).unwrap();
tx.commit();
DbHandle { conn: conn }
}
}

@ -1,5 +1,3 @@
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS encrypted_values (
id INTEGER PRIMARY KEY AUTOINCREMENT,
iv TEXT,
@ -23,5 +21,3 @@ CREATE TABLE IF NOT EXISTS accounts(
user INTEGER NOT NULL,
password INTEGER NOT NULL
);
END TRANSACTION;

Loading…
Cancel
Save