Doctest column name reference (#918)

* Doctest column name reference
* Document rusqlite assumption on column name reference
And move doctest as a test.
* Document when columns metadata should be extracted.
* Rustfmt doc (wrap_comments)
This commit is contained in:
gwenn
2021-04-03 11:03:50 +02:00
committed by GitHub
parent ecbc0aa767
commit c4b398f468
15 changed files with 182 additions and 86 deletions

View File

@@ -114,11 +114,11 @@ impl Statement<'_> {
///
/// # Note
///
/// This function is a convenience wrapper around [`execute()`](Statement::execute) intended for
/// queries that insert a single item. It is possible to misuse this
/// function in a way that it cannot detect, such as by calling it on a
/// statement which _updates_ a single
/// item rather than inserting one. Please don't do that.
/// This function is a convenience wrapper around
/// [`execute()`](Statement::execute) intended for queries that insert a
/// single item. It is possible to misuse this function in a way that it
/// cannot detect, such as by calling it on a statement which _updates_
/// a single item rather than inserting one. Please don't do that.
///
/// # Failure
///
@@ -136,8 +136,9 @@ impl Statement<'_> {
/// rows.
///
/// Due to lifetime restricts, the rows handle returned by `query` does not
/// implement the `Iterator` trait. Consider using [`query_map`](Statement::query_map) or
/// [`query_and_then`](Statement::query_and_then) instead, which do.
/// implement the `Iterator` trait. Consider using
/// [`query_map`](Statement::query_map) or [`query_and_then`](Statement::query_and_then)
/// instead, which do.
///
/// ## Example
///
@@ -396,8 +397,9 @@ impl Statement<'_> {
/// iterator over the result of calling the mapping function over the
/// query's rows.
///
/// Note: This function is deprecated in favor of [`Statement::query_and_then`],
/// which can now take named parameters directly.
/// Note: This function is deprecated in favor of
/// [`Statement::query_and_then`], which can now take named parameters
/// directly.
///
/// If any parameters that were in the prepared statement are not included
/// in `params`, they will continue to use the most-recently bound value
@@ -436,9 +438,10 @@ impl Statement<'_> {
/// ignored.
///
/// Returns `Err(QueryReturnedNoRows)` if no results are returned. If the
/// query truly is optional, you can call [`.optional()`](crate::OptionalExtension::optional) on the result of
/// this to get a `Result<Option<T>>` (requires that the trait `rusqlite::OptionalExtension`
/// is imported).
/// query truly is optional, you can call
/// [`.optional()`](crate::OptionalExtension::optional) on the result of
/// this to get a `Result<Option<T>>` (requires that the trait
/// `rusqlite::OptionalExtension` is imported).
///
/// # Failure
///
@@ -456,16 +459,18 @@ impl Statement<'_> {
/// Convenience method to execute a query with named parameter(s) that is
/// expected to return a single row.
///
/// Note: This function is deprecated in favor of [`Statement::query_and_then`],
/// which can now take named parameters directly.
/// Note: This function is deprecated in favor of
/// [`Statement::query_and_then`], which can now take named parameters
/// directly.
///
/// If the query returns more than one row, all rows except the first are
/// ignored.
///
/// Returns `Err(QueryReturnedNoRows)` if no results are returned. If the
/// query truly is optional, you can call [`.optional()`](crate::OptionalExtension::optional) on the result of
/// this to get a `Result<Option<T>>` (requires that the trait `rusqlite::OptionalExtension`
/// is imported).
/// query truly is optional, you can call
/// [`.optional()`](crate::OptionalExtension::optional) on the result of
/// this to get a `Result<Option<T>>` (requires that the trait
/// `rusqlite::OptionalExtension` is imported).
///
/// # Failure
///