INNER CODE UNIT · Rust

query_row

rusqlite/rusqlite · src/lib.rs:693

    pub fn query_row<T, P, F>(&self, sql: &str, params: P, f: F) -> Result<T>
    where
        P: Params,
        F: FnOnce(&Row<'_>) -> Result<T>,
    {
        let mut stmt = self.prepare(sql)?;
        stmt.query_row(params, f)
    }

    /// Convenience method to execute a query that is expected to return exactly
    /// one row.
    ///
    /// Returns `Err(QueryReturnedMoreThanOneRow)` if the query returns more than one row.
    ///
    /// Returns `Err(QueryReturnedNoRows)` if no results are returned. If the
    /// query truly is optional, you can call
    /// [`.optional()`](OptionalExtension::optional) on the result of
    /// this to get a `Result<Option<T>>` (requires that the trait

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…