Skip to content

Commit

Permalink
fix SQLite3 integrity check
Browse files Browse the repository at this point in the history
  • Loading branch information
scottlamb committed Feb 12, 2021
1 parent fdb6603 commit ed52152
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions server/db/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ pub fn run(conn: &mut rusqlite::Connection, opts: &Options) -> Result<i32, Error
let mut printed_error = false;

info!("Checking SQLite database integrity...");
if let Err(e) = conn.execute("pragma check_integrity", params![]) {
error!("Database integrity error: {}", e);
printed_error = true;
{
let mut stmt = conn.prepare("pragma integrity_check")?;
let mut rows = stmt.query(params![])?;
while let Some(row) = rows.next()? {
let e: String = row.get(0)?;
if e == "ok" { continue; }
error!("{}", e);
printed_error = true;
}
}
info!("...done");

Expand Down

0 comments on commit ed52152

Please sign in to comment.