Skip to content

Commit

Permalink
Merge pull request #17 from ginkgobioworks/simple-transaction
Browse files Browse the repository at this point in the history
Add in simple transactions
  • Loading branch information
Chris7 authored Aug 27, 2024
2 parents e455722 + 77fc26c commit 1eac034
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,31 @@ fn main() {
name,
db,
shallow,
}) => import_fasta(fasta, name, *shallow, &mut get_connection(db)),
}) => {
let mut conn = get_connection(db);
conn.execute("BEGIN TRANSACTION", []).unwrap();
import_fasta(fasta, name, *shallow, &mut conn);
conn.execute("END TRANSACTION", []).unwrap();
}
Some(Commands::Update {
name,
db,
fasta,
vcf,
genotype,
sample,
}) => update_with_vcf(
vcf,
name,
genotype.clone().unwrap_or("".to_string()),
sample.clone().unwrap_or("".to_string()),
&mut get_connection(db),
),
}) => {
let mut conn = get_connection(db);
conn.execute("BEGIN TRANSACTION", []).unwrap();
update_with_vcf(
vcf,
name,
genotype.clone().unwrap_or("".to_string()),
sample.clone().unwrap_or("".to_string()),
&mut conn,
);
conn.execute("END TRANSACTION", []).unwrap();
}
None => {}
}
}
Expand Down

0 comments on commit 1eac034

Please sign in to comment.