mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-27 20:58:56 -05:00
update "moonfire-nvr check" for new schema
This commit is contained in:
10
db/raw.rs
10
db/raw.rs
@@ -30,12 +30,13 @@
|
||||
|
||||
//! Raw database access: SQLite statements which do not touch any cached state.
|
||||
|
||||
use db::{self, CompositeId};
|
||||
use db::{self, CompositeId, FromSqlUuid};
|
||||
use failure::Error;
|
||||
use fnv::FnvHashSet;
|
||||
use recording;
|
||||
use rusqlite;
|
||||
use std::ops::Range;
|
||||
use uuid::Uuid;
|
||||
|
||||
const INSERT_RECORDING_SQL: &'static str = r#"
|
||||
insert into recording (composite_id, stream_id, open_id, run_offset, flags,
|
||||
@@ -89,6 +90,13 @@ const LIST_OLDEST_RECORDINGS_SQL: &'static str = r#"
|
||||
composite_id
|
||||
"#;
|
||||
|
||||
pub(crate) fn get_db_uuid(conn: &rusqlite::Connection) -> Result<Uuid, Error> {
|
||||
conn.query_row("select uuid from meta", &[], |row| -> Result<Uuid, Error> {
|
||||
let uuid: FromSqlUuid = row.get_checked(0)?;
|
||||
Ok(uuid.0)
|
||||
})?
|
||||
}
|
||||
|
||||
/// Inserts the specified recording (for from `try_flush` only).
|
||||
pub(crate) fn insert_recording(tx: &rusqlite::Transaction, o: &db::Open, id: CompositeId,
|
||||
r: &db::RecordingToInsert) -> Result<(), Error> {
|
||||
|
||||
Reference in New Issue
Block a user