* 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 implements `FromSql` for `u64`, `usize` and `f32`, and `ToSql` for `f32`.
I also updated the documentation to describe how it currently works, and changed the implementation to use `try_from` for integral casts rather rather than custom code.
Test added.
Replace `Row::get` by `Row::get_checked`,
And rename original `Row::get` to `Row::get_unwrap`.
`Stmt::query_map`, `Stmt::query_map_named`, `Stmt::query_row`,
`Conn::query_row` and `Conn::query_row_named` callback parameter must return a `Result`.
We implement `ToSql` and `FromSql` for `time::Timespec` values. Our
documentation indicates that we store the value in the same format
used by SQLite's built-in date/time functions, but this was not
correct.
We were using the format:
%Y-%m-%d %H:%M:%S:%f %Z
This format cannot be interpreted at all by SQLite's built-in
date/time functions. There are three reasons for this:
- SQLite supports only two timezone formats: `[+-]HH:MM` and the
literal character `Z` (indicating UTC)
- SQLite does not support a space before the timezone indicator
- SQLite supports a period (`.`) between the seconds field and the
fractional seconds field, but not a colon (`:`)
SQLite does support the RFC 3339 date/time format, which is standard
in many other places. As we're always storing a UTC value, we'll
simply use a trailing `Z` to indicate the timezone, as allowed by RFC
3339. The new format is:
%Y-%m-%dT%H:%M:%S.%fZ
To avoid breaking applications using databases with values in the old
format, we'll continue to support it as a fallback for `FromSql`.
[1] https://www.sqlite.org/lang_datefunc.html
[2] https://tools.ietf.org/html/rfc3339
Recent versions of bindgen use `std::os::raw` over `libc`, but currently
`libsqlite3-sys` is overriding that. `std::os::raw` is a subset of
`libc` that exports only the relevant type definitions, but not any
functions which require additional linking. This enables
`libsqlite3-sys` to be more easily used on targets that may not have a
libc available (presumably sqlite itself would have been compiled with
musl in that case)