diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 94e9804..ed0965c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ impl TagBase { } /// Insert the image at `path` into the data. - fn import_image(&self, path: &Path) -> Result<()> { + fn import_image(&self, path: &Path) -> Result<i32> { if path.is_dir() { return Err(anyhow!("`path` does not name a file.")); } @@ -74,7 +74,12 @@ impl TagBase { params![hash, file_name, parent_directory], )?; - Ok(()) + let id: Vec<std::result::Result<i32, rusqlite::Error>> = self + .conn + .prepare("SELECT id FROM images WHERE blake2 = ?;")? + .query_and_then(params![hash], |row| row.get(0))? + .collect(); + Ok(*id[0].as_ref().unwrap()) } } |