* We reorder the changelog a bit to highlight important possibly
breaking changes
* We add the missing 1.4.x releases (copied from the 1.4.x branch)
* We add a note about the minimal supported rust version
Add Sqlite support for the `RETURNING` clause by leveraging
the implementation for Postgres. So this change is essentially
just adjusting the build system to enable the support if a
Sqlite version which supports the `RETURNING` clause [1] is
complied against.
The "insert record with returning" unit tests for Postgres
couldn't be re-used because Sqlite doesn't support batch insert.
Because those tests provide value for Postgres, new versions
for Sqlite have been created which don't use batch insert.
[1] https://sqlite.org/releaselog/3_35_0.html
`libsqlite3-sys` is built with the `bundled_bindings`
feature enabled which was introduced in commit [1]
which in turn is part of `libsqlite3-sys` 0.17.2.
Versions below 0.17.2 will hence fail to compile.
Therefore, tighten the minimum required version.
[1] c70d148542
The main motivation of this change is to allow third party backends like
diesel-oci to speciaize `QueryFragment` impls without using the unstable
`specialization` feature. This is done by introducing a new marker trait
`SqlDialect` that has an associated type for each specializable
`QueryFragment` impl.
Beside of that this allows us to fix a few long standing issues:
* `eq_any` can now use `= ANY()` on postgres
* We can now support batch inserts for sqlite as long as there is no
default value in the insert values
Fixes#2898Fixes#2694 (by deprecating the corresponding functions)
* Cache insert statments from queries, as those are safe to cache if the
query itself is safe to cache
* Add a way to directly insert from a statically sized array
* Decouple default values from insert expressions and allow to generate
insertable implementations that do not use the default values.
+ This unblocks real batch inserts on sqlite
+ This allows cache the prepared statements for insert from statically sized arrays as we know the size at compile time here
* Update the benchmarks to use the statically compile time variant.
Other implementations also use prepared statements here, so this is
just fair
This commit adds support for generating SQL type definitions for unknown
types to `diesel print-schema`. The basic idea is to generate the
corresponding marker type to always end up with an existing schema.
Especially this does not generate any code that is required for
serializing/deserializing rust values.
This commit changes all connection implementations to take `&mut self`
on all methods that interact with the database.
This unblocks the following features:
* Returnig a cursor/iterator from a `RunQueryDsl` method
* Removing some unsafe code and interior mutability inside the current
connection implementations
* Possibly the first step of a async `Connection` variant to workaround
the `Future` not `Send` issues there.
This fixes the handling of panics in custom SQLite functions
by having a `catch_unwind` before ffi the boundary and by correctly
setting the required `UnwindSafe` trait bounds in a similar way as it is
done by rusqlite.
We enforce now that the order clause matches the corresponding
distinct_on clause. I've choosen to gate setting a distinct on clause on
having a corresponding order clause.
d2af2263c7 had to roll back the impl of `AsExpression<Nullable<sql_types::Bool>>` for `E: AsExpression<sql_types::Bool>`, to allow for more type inference, but forgot to remove the corresponding line in the changelog.
Similar to how `#[diesel(deserialize_as)]` can be used for `Queryable`
structs to customize which type is being constructed, we add support
for doing the same thing for `Insertable` structs.
The conversion happens using the std trait `Into` which takes ownership
during conversion. As such, as soon as any field within an `Insertable`
struct has a `#[diesel(serialize_as)]` attribute, we no longer generate
an implementation of `Insertable` for borrowed versions of this struct.
Fields annotated with `#[diesel(serialize_as)]` are also incompatible
with `#[diesel(embed)]`. Using both on the same field will result in
a compile-error.