This commit is contained in:
Sebastian Hugentobler 2024-05-06 14:17:25 +02:00
parent ead3672570
commit 6d949bb21e
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
10 changed files with 74 additions and 18 deletions

View file

@ -90,6 +90,11 @@ impl Calibre {
let conn = self.pool.get()?;
Author::has_more_authors(&conn, author_sort)
}
pub fn scalar_author(&self, id: u64) -> Result<Author, DataStoreError> {
let conn = self.pool.get()?;
Author::scalar_author(&conn, id)
}
}
#[cfg(test)]

View file

@ -47,6 +47,12 @@ impl Author {
Ok(stmt.query_row(params, Self::from_row)?)
}
pub fn scalar_author(conn: &Connection, id: u64) -> Result<Self, DataStoreError> {
let mut stmt = conn.prepare("SELECT id, name, sort FROM authors WHERE id = (:id)")?;
let params = named_params! { ":id": id };
Ok(stmt.query_row(params, Self::from_row)?)
}
pub fn has_previous_authors(
conn: &Connection,
sort_name: &str,