Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: diesel-rs/diesel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.1.0
Choose a base ref
...
head repository: diesel-rs/diesel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.1.1
Choose a head ref

Commits on Aug 15, 2023

  1. Merge pull request #3657 from aumetra/master

    Enable `distinct_on` with `postgres_backend` instead of `postgres`
    weiznich committed Aug 15, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    faf8e56 View commit details
  2. Merge pull request #3676 from weiznich/fix/3673

    Correctly quote the table name in one of the `print-schema` queries
    weiznich committed Aug 15, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1d7ba1d View commit details
  3. Merge pull request #3650 from tp-woven/talp/issue-3646

    add test reproducing #3646
    weiznich committed Aug 15, 2023
    Copy the full SHA
    6cd70ff View commit details
  4. Merge pull request #3681 from DannyGoldberg/patch-1

    fix(diesel_cli): use separate lines for multiple annotations
    weiznich committed Aug 15, 2023
    Copy the full SHA
    cb0abc0 View commit details
  5. Merge pull request #3677 from weiznich/bump/bigdecimal

    Bump bigdecimal to 0.4
    weiznich committed Aug 15, 2023
    Copy the full SHA
    2641aad View commit details
  6. Merge pull request #3696 from weiznich/upstream/fix_new_beta_lint2

    Fix a new lint on beta
    pksunkara authored and weiznich committed Aug 15, 2023
    Copy the full SHA
    eee14ad View commit details
  7. Merge pull request #3691 from caido/fix/expose-push-bind-value

    Expose push_bind_param_value_only to backends
    weiznich committed Aug 15, 2023
    Copy the full SHA
    5b4fec1 View commit details
  8. Merge pull request #3699 from cr0sh/fix-unused-import

    Suppress unused_import if no backend is enabled
    weiznich committed Aug 15, 2023
    Copy the full SHA
    6eede35 View commit details
  9. Merge pull request #3708 from weiznich/table_fixes

    Emit a better error message if a user writes a `table!` macro without
    weiznich committed Aug 15, 2023
    Copy the full SHA
    e353ece View commit details
  10. Merge pull request #3713 from dsp/dsp/3579

    Fix #3579: Unexpected end of row when setup diesel
    weiznich committed Aug 15, 2023
    Copy the full SHA
    145ac82 View commit details
  11. Merge pull request #3704 from hasezoey/fixREADME2

    Update main README to have more consistent style
    weiznich committed Aug 15, 2023
    Copy the full SHA
    1f02b6c View commit details
  12. Merge pull request #3718 from weiznich/diesel_async_changes

    Expose more of the transaction manager
    weiznich committed Aug 15, 2023
    Copy the full SHA
    2d775af View commit details
  13. Copy the full SHA
    eeb46ce View commit details
  14. Merge pull request #3729 from weiznich/fix/nightly_breaking_tests

    Fix broken tests
    Ten0 authored and weiznich committed Aug 15, 2023
    Copy the full SHA
    0a7babd View commit details
  15. Merge pull request #3734 from surban/fix-datetimeproxy

    time: sql_type for DateTimeProxy without backend
    weiznich committed Aug 15, 2023
    Copy the full SHA
    a41f979 View commit details
  16. Merge pull request #3716 from weiznich/fix/nullable_binds_with_multic…

    …onnection
    
    Fix nullable binds in the `#[derive(Multiconnection)]` implementation
    weiznich committed Aug 15, 2023
    Copy the full SHA
    fd12318 View commit details
  17. Merge pull request #3694 from caido/fix/sqlite-timestamp-parsing

    Fix sqlite timestamps
    weiznich committed Aug 15, 2023
    Copy the full SHA
    bd6584c View commit details
  18. Merge pull request #3737 from weiznich/fix/cli_error_invalid

    Tweak the creation of database connections in diesel_CLI
    weiznich committed Aug 15, 2023
    Copy the full SHA
    87c928d View commit details

Commits on Aug 16, 2023

  1. Merge pull request #3725 from gmanninglive/fix/3717

    Fix/3717 filter table on `diesel migration --diff-schema`
    weiznich committed Aug 16, 2023
    Copy the full SHA
    4e72855 View commit details
  2. Merge pull request #3747 from BlackDex/add-bool-type-to-multiconnection

    Add `Bool` type to MultiConnection
    weiznich committed Aug 16, 2023
    Copy the full SHA
    9056ab3 View commit details

Commits on Aug 18, 2023

  1. Copy the full SHA
    3281c86 View commit details
  2. Merge pull request #3643 from weiznich/fix/broken_distinct_on_with_cu…

    …stom_expressions
    
    Try to hack around a breaking change in diesel 2.1
    weiznich committed Aug 18, 2023
    Copy the full SHA
    181a62a View commit details
  3. Copy the full SHA
    45c0102 View commit details
Showing with 1,970 additions and 491 deletions.
  1. +1 −1 .github/workflows/ci.yml
  2. +26 −6 CHANGELOG.md
  3. +11 −9 README.md
  4. +4 −2 diesel/Cargo.toml
  5. +2 −2 diesel/src/connection/mod.rs
  6. +35 −2 diesel/src/connection/transaction_manager.rs
  7. +8 −0 diesel/src/internal/derives.rs
  8. +4 −5 diesel/src/mysql/connection/bind.rs
  9. +65 −10 diesel/src/pg/query_builder/distinct_on.rs
  10. +8 −0 diesel/src/query_builder/ast_pass.rs
  11. +1 −1 diesel/src/query_dsl/mod.rs
  12. +1 −0 diesel/src/row.rs
  13. +2 −2 diesel/src/sql_types/mod.rs
  14. +1 −1 diesel/src/sqlite/connection/raw.rs
  15. +111 −76 diesel/src/sqlite/types/date_and_time/chrono.rs
  16. +309 −0 diesel/src/sqlite/types/date_and_time/mod.rs
  17. +63 −42 diesel/src/sqlite/types/date_and_time/time.rs
  18. +9 −1 diesel/src/type_impls/date_and_time.rs
  19. +1 −1 diesel_cli/Cargo.toml
  20. +26 −1 diesel_cli/src/cli.rs
  21. +109 −3 diesel_cli/src/config.rs
  22. +14 −2 diesel_cli/src/database.rs
  23. +10 −0 diesel_cli/src/infer_schema_internals/inference.rs
  24. +19 −0 diesel_cli/src/infer_schema_internals/load_foreign_keys.sql
  25. +101 −71 diesel_cli/src/infer_schema_internals/pg.rs
  26. +46 −31 diesel_cli/src/infer_schema_internals/sqlite.rs
  27. +5 −19 diesel_cli/src/main.rs
  28. +10 −3 diesel_cli/src/migrations/diff_schema.rs
  29. +1 −1 diesel_cli/src/migrations/mod.rs
  30. +11 −103 diesel_cli/src/print_schema.rs
  31. +10 −10 diesel_cli/tests/database_url_errors.rs
  32. +2 −0 diesel_cli/tests/generate_migrations/diff_except_tables/diesel.toml
  33. +9 −0 diesel_cli/tests/generate_migrations/diff_except_tables/mysql/down.sql/expected.snap
  34. +3 −0 diesel_cli/tests/generate_migrations/diff_except_tables/mysql/initial_schema.sql
  35. +13 −0 diesel_cli/tests/generate_migrations/diff_except_tables/mysql/schema_out.rs/expected.snap
  36. +9 −0 diesel_cli/tests/generate_migrations/diff_except_tables/mysql/up.sql/expected.snap
  37. +9 −0 diesel_cli/tests/generate_migrations/diff_except_tables/postgres/down.sql/expected.snap
  38. +3 −0 diesel_cli/tests/generate_migrations/diff_except_tables/postgres/initial_schema.sql
  39. +13 −0 diesel_cli/tests/generate_migrations/diff_except_tables/postgres/schema_out.rs/expected.snap
  40. +9 −0 diesel_cli/tests/generate_migrations/diff_except_tables/postgres/up.sql/expected.snap
  41. +6 −0 diesel_cli/tests/generate_migrations/diff_except_tables/schema.rs
  42. +9 −0 diesel_cli/tests/generate_migrations/diff_except_tables/sqlite/down.sql/expected.snap
  43. +3 −0 diesel_cli/tests/generate_migrations/diff_except_tables/sqlite/initial_schema.sql
  44. +13 −0 diesel_cli/tests/generate_migrations/diff_except_tables/sqlite/schema_out.rs/expected.snap
  45. +9 −0 diesel_cli/tests/generate_migrations/diff_except_tables/sqlite/up.sql/expected.snap
  46. +2 −0 diesel_cli/tests/generate_migrations/diff_only_tables/diesel.toml
  47. +9 −0 diesel_cli/tests/generate_migrations/diff_only_tables/mysql/down.sql/expected.snap
  48. +3 −0 diesel_cli/tests/generate_migrations/diff_only_tables/mysql/initial_schema.sql
  49. +13 −0 diesel_cli/tests/generate_migrations/diff_only_tables/mysql/schema_out.rs/expected.snap
  50. +9 −0 diesel_cli/tests/generate_migrations/diff_only_tables/mysql/up.sql/expected.snap
  51. +9 −0 diesel_cli/tests/generate_migrations/diff_only_tables/postgres/down.sql/expected.snap
  52. +3 −0 diesel_cli/tests/generate_migrations/diff_only_tables/postgres/initial_schema.sql
  53. +13 −0 diesel_cli/tests/generate_migrations/diff_only_tables/postgres/schema_out.rs/expected.snap
  54. +9 −0 diesel_cli/tests/generate_migrations/diff_only_tables/postgres/up.sql/expected.snap
  55. +6 −0 diesel_cli/tests/generate_migrations/diff_only_tables/schema.rs
  56. +9 −0 diesel_cli/tests/generate_migrations/diff_only_tables/sqlite/down.sql/expected.snap
  57. +3 −0 diesel_cli/tests/generate_migrations/diff_only_tables/sqlite/initial_schema.sql
  58. +13 −0 diesel_cli/tests/generate_migrations/diff_only_tables/sqlite/schema_out.rs/expected.snap
  59. +9 −0 diesel_cli/tests/generate_migrations/diff_only_tables/sqlite/up.sql/expected.snap
  60. +31 −3 diesel_cli/tests/migration_generate.rs
  61. +23 −0 diesel_cli/tests/print_schema.rs
  62. +3 −0 diesel_cli/tests/print_schema/print_schema_multiple_annotations/diesel.toml
  63. +15 −0 diesel_cli/tests/print_schema/print_schema_multiple_annotations/postgres/expected.snap
  64. +4 −0 diesel_cli/tests/print_schema/print_schema_multiple_annotations/postgres/schema.sql
  65. +3 −0 diesel_cli/tests/print_schema/print_schema_quoted_schema_and_table_name/diesel.toml
  66. +14 −0 diesel_cli/tests/print_schema/print_schema_quoted_schema_and_table_name/postgres/expected.snap
  67. +5 −0 diesel_cli/tests/print_schema/print_schema_quoted_schema_and_table_name/postgres/schema.sql
  68. +2 −0 diesel_cli/tests/print_schema/print_schema_quoted_table_name/diesel.toml
  69. +12 −0 diesel_cli/tests/print_schema/print_schema_quoted_table_name/postgres/expected.snap
  70. +3 −0 diesel_cli/tests/print_schema/print_schema_quoted_table_name/postgres/schema.sql
  71. +12 −0 diesel_cli/tests/print_schema/print_schema_quoted_table_name/sqlite/expected.snap
  72. +3 −0 diesel_cli/tests/print_schema/print_schema_quoted_table_name/sqlite/schema.sql
  73. +1 −1 diesel_cli/tests/support/mod.rs
  74. +2 −2 diesel_cli/tests/support/project_builder.rs
  75. +10 −0 diesel_compile_tests/tests/fail/distinct_on_requires_matching_order_clause.rs
  76. +45 −45 diesel_compile_tests/tests/fail/distinct_on_requires_matching_order_clause.stderr
  77. +10 −0 diesel_compile_tests/tests/fail/table_without_primary_key.rs
  78. +14 −0 diesel_compile_tests/tests/fail/table_without_primary_key.stderr
  79. +3 −1 diesel_derives/Cargo.toml
  80. +111 −21 diesel_derives/src/multiconnection.rs
  81. +1 −1 diesel_derives/src/selectable.rs
  82. +32 −1 diesel_derives/src/table.rs
  83. +3 −0 diesel_derives/tests/helpers.rs
  84. +322 −10 diesel_derives/tests/multiconnection.rs
  85. +27 −0 diesel_derives/tests/selectable.rs
  86. +1 −1 diesel_tests/Cargo.toml
  87. +14 −0 diesel_tests/tests/distinct.rs
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -221,7 +221,7 @@ jobs:
- name: Test diesel-derives (nightly)
if: matrix.rust == 'nightly'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} diesel/unstable"
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} diesel/unstable diesel/time time diesel/chrono chrono"

- name: Test diesel-derives
shell: bash
32 changes: 26 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,25 @@ Increasing the minimal supported Rust version will always be coupled at least wi

## Unreleased

## [2.1.1] 2023-08-xx

## Fixed

* Fixed an issue in diesel-cli that lead to using unquoted table names in one of the internal queries
* Fixed a bug in `diesel print-schema` that lead to generating invalid `table!` macros if both the `#[sql_name]` and the `#[max_lenght]` attribute are present
* Fixed an issue in diesel-cli that lead to ignoring certain foreign key constraints for postgresql
* Fixed an crash while using `diesel print-schema` with really old sqlite versions
* Fixed an issue where `#[diesel(check_for_backend)]` ignored `#[diesel(deserialize_as)]` attributes
* Fixed several issues with the new `#[derive(MultiConnection)]` feature
* Fixed some edge cases in our sqlite timestamp parsing behaviour
* `diesel migration generate --diff-schema` now respects table filters as setup for `print-schema` via `diesel.toml`
* Fixed a potential breaking change around queries containing `DISTINCT ON` and `ORDER BY` clauses consisting of custom sql expressions (e.g. `diesel::dsl::sql`)

## Added

* Support for bigdecimal 0.4


## [2.1.0] 2023-05-26

### Changed
@@ -2018,10 +2037,11 @@ queries or set `PIPES_AS_CONCAT` manually.
[1.4.8]: https://github.com/diesel-rs/diesel/compare/v1.4.7...v1.4.8
[2.0.0 Rc0]: https://github.com/diesel-rs/diesel/compare/v.1.4.0...v2.0.0-rc0
[2.0.0 Rc1]: https://github.com/diesel-rs/diesel/compare/v.2.0.0-rc0...v2.0.0-rc1
[2.0.0]: https://github.com/diesel-rs/diesel/compare/v.1.4.0...v2.0.0
[2.0.1]: https://github.com/diesel-rs/diesel/compare/v.2.0.0...v2.0.1
[2.0.2]: https://github.com/diesel-rs/diesel/compare/v.2.0.1...v2.0.2
[2.0.0]: https://github.com/diesel-rs/diesel/compare/v1.4.0...v2.0.0
[2.0.1]: https://github.com/diesel-rs/diesel/compare/v2.0.0...v2.0.1
[2.0.2]: https://github.com/diesel-rs/diesel/compare/v2.0.1...v2.0.2
[diesel_derives 2.0.2]: https://github.com/diesel-rs/diesel/compare/v.2.0.2...diesel_derives_v2.0.2
[2.0.3]: https://github.com/diesel-rs/diesel/compare/v.2.0.2...v2.0.3
[2.0.4]: https://github.com/diesel-rs/diesel/compare/v.2.0.3...v2.0.4
[2.1.0]: https://github.com/diesel-rs/diesel/compare/v.2.0.0...v2.1.0
[2.0.3]: https://github.com/diesel-rs/diesel/compare/v2.0.2...v2.0.3
[2.0.4]: https://github.com/diesel-rs/diesel/compare/v2.0.3...v2.0.4
[2.1.0]: https://github.com/diesel-rs/diesel/compare/v2.0.0...v2.1.0
[2.1.1]: https://github.com/diesel-rs/diesel/compare/v2.1.0...v2.1.1
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![](https://diesel.rs/assets/images/diesel_logo_stacked_black.png)](https://diesel.rs)
[![diesel logo](https://diesel.rs/assets/images/diesel_logo_stacked_black.png)](https://diesel.rs)

# A safe, extensible ORM and Query Builder for Rust

A safe, extensible ORM and Query Builder for Rust
==========================================================
[![Build Status](https://github.com/diesel-rs/diesel/workflows/CI%20Tests/badge.svg)](https://github.com/diesel-rs/diesel/actions?query=workflow%3A%22CI+Tests%22+branch%3Amaster)
[![Gitter](https://badges.gitter.im/diesel-rs/diesel.svg)](https://gitter.im/diesel-rs/diesel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Crates.io](https://img.shields.io/crates/v/diesel.svg)](https://crates.io/crates/diesel)
@@ -21,6 +21,7 @@ Supported databases:
3. [SQLite](https://docs.diesel.rs/master/diesel/sqlite/index.html)

You can configure the database backend in `Cargo.toml`:

```toml
[dependencies]
diesel = { version = "<version>", features = ["<postgres|mysql|sqlite>"] }
@@ -33,19 +34,19 @@ Find our extensive Getting Started tutorial at
Guides on more specific features are coming soon.

## Getting help

If you run into problems, Diesel has a very active Gitter room.
You can come ask for help at
[gitter.im/diesel-rs/diesel](https://gitter.im/diesel-rs/diesel).
For help with longer questions and discussion about the future of Diesel,
open a discussion on [GitHub Discussions](https://github.com/diesel-rs/diesel/discussions).

## Usage
## Usage

### Simple queries
### Simple queries

Simple queries are a complete breeze. Loading all users from a database:


```rust
users::table.load(&mut connection)
```
@@ -86,6 +87,7 @@ let downloads = version_downloads
```

Executed SQL:

```sql
SELECT version_downloads.*
WHERE date > (NOW() - '90 days')
@@ -172,7 +174,6 @@ INSERT INTO users (name, hair_color) VALUES

If you need data from the rows you inserted, just change `execute` to `get_result` or `get_results`. Diesel will take care of the rest.


```rust
let new_users = vec![
NewUser { name: "Sean", hair_color: Some("Black") },
@@ -194,6 +195,7 @@ INSERT INTO users (name, hair_color) VALUES
```

### Updating data

Diesel's codegen can generate several ways to update a row, letting you encapsulate your logic in the way that makes sense for your app.

Modifying a struct:
@@ -219,7 +221,7 @@ update(Settings::belonging_to(current_user))
.execute(&mut connection)
```

### Raw SQL
### Raw SQL

There will always be certain queries that are just easier to write as raw SQL, or can't be expressed with the query builder. Even in these cases, Diesel provides an easy to use API for writing raw SQL.

@@ -242,7 +244,6 @@ sql_query(include_str!("complex_users_by_organization.sql"))
.load::<User>(&mut conn)?;
```


## Code of conduct

Anyone who interacts with Diesel in any space, including but not limited to
@@ -258,6 +259,7 @@ Licensed under either of these:
https://opensource.org/licenses/MIT)

### Contributing

Before contributing, please read the [contributors guide](https://github.com/diesel-rs/diesel/blob/master/CONTRIBUTING.md)
for useful information about setting up Diesel locally, coding style and common abbreviations.

6 changes: 4 additions & 2 deletions diesel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diesel"
version = "2.1.0"
version = "2.1.1"
license = "MIT OR Apache-2.0"
description = "A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL"
readme = "README.md"
@@ -29,7 +29,7 @@ ipnet = { version = "2.5.0", optional = true }
num-bigint = { version = ">=0.2.0, <0.5.0", optional = true }
num-traits = { version = "0.2.0", optional = true }
num-integer = { version = "0.1.39", optional = true }
bigdecimal = { version = ">=0.0.13, < 0.4.0", optional = true }
bigdecimal = { version = ">=0.0.13, < 0.5.0", optional = true }
bitflags = { version = "2.0.0", optional = true }
r2d2 = { version = ">= 0.8.2, < 0.9.0", optional = true }
itoa = { version = "1.0.0", optional = true }
@@ -68,6 +68,8 @@ returning_clauses_for_sqlite_3_35 = []
i-implement-a-third-party-backend-and-opt-into-breaking-changes = []
nightly-error-messages = []
r2d2 = ["diesel_derives/r2d2", "dep:r2d2"]
chrono = ["diesel_derives/chrono", "dep:chrono"]
time = ["diesel_derives/time", "dep:time"]

[package.metadata.docs.rs]
features = ["postgres", "mysql", "sqlite", "extras"]
4 changes: 2 additions & 2 deletions diesel/src/connection/mod.rs
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ use crate::result::*;
use std::fmt::Debug;

pub use self::transaction_manager::{
AnsiTransactionManager, TransactionDepthChange, TransactionManager, TransactionManagerStatus,
ValidTransactionManagerStatus,
AnsiTransactionManager, InTransactionStatus, TransactionDepthChange, TransactionManager,
TransactionManagerStatus, ValidTransactionManagerStatus,
};

#[diesel_derives::__diesel_public_if(
37 changes: 35 additions & 2 deletions diesel/src/connection/transaction_manager.rs
Original file line number Diff line number Diff line change
@@ -170,13 +170,29 @@ impl TransactionManagerStatus {
*self = TransactionManagerStatus::InError
}

fn transaction_state(&mut self) -> QueryResult<&mut ValidTransactionManagerStatus> {
/// Expose access to the inner transaction state
///
/// This function returns an error if the Transaction manager is in a broken
/// state
#[diesel_derives::__diesel_public_if(
feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
)]
pub(self) fn transaction_state(&mut self) -> QueryResult<&mut ValidTransactionManagerStatus> {
match self {
TransactionManagerStatus::Valid(valid_status) => Ok(valid_status),
TransactionManagerStatus::InError => Err(Error::BrokenTransactionManager),
}
}

/// This function allows to flag a transaction manager
/// in such a way that it contains a test transaction.
///
/// This will disable some checks in regards to open transactions
/// to allow `Connection::begin_test_transaction` to work with
/// pooled connections as well
#[diesel_derives::__diesel_public_if(
feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
)]
pub(crate) fn set_test_transaction_flag(&mut self) {
if let TransactionManagerStatus::Valid(ValidTransactionManagerStatus {
in_transaction: Some(s),
@@ -190,17 +206,34 @@ impl TransactionManagerStatus {
/// Valid transaction status for the manager. Can return the current transaction depth
#[allow(missing_copy_implementations)]
#[derive(Debug, Default)]
#[diesel_derives::__diesel_public_if(
feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes",
public_fields(in_transaction)
)]
pub struct ValidTransactionManagerStatus {
/// Inner status, or `None` if no transaction is runnin
in_transaction: Option<InTransactionStatus>,
}

/// Various status fields to track the status of
/// a transaction manager with a started transaction
#[allow(missing_copy_implementations)]
#[derive(Debug)]
struct InTransactionStatus {
#[diesel_derives::__diesel_public_if(
feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes",
public_fields(
test_transaction,
transaction_depth,
requires_rollback_maybe_up_to_top_level
)
)]
pub struct InTransactionStatus {
/// The current depth of nested transactions
transaction_depth: NonZeroU32,
/// If that is registered, savepoints rollbacks will still be attempted, but failure to do so
/// will not result in an error. (Some may succeed, some may not.)
requires_rollback_maybe_up_to_top_level: bool,
/// Is this transaction manager status marked as test-transaction?
test_transaction: bool,
}

8 changes: 8 additions & 0 deletions diesel/src/internal/derives.rs
Original file line number Diff line number Diff line change
@@ -69,4 +69,12 @@ pub mod multiconnection {

#[doc(hidden)]
pub use crate::query_builder::select_statement::SelectStatementAccessor;

#[doc(hidden)]
#[cfg(feature = "chrono")]
pub use chrono;

#[doc(hidden)]
#[cfg(feature = "time")]
pub use time;
}
9 changes: 4 additions & 5 deletions diesel/src/mysql/connection/bind.rs
Original file line number Diff line number Diff line change
@@ -734,16 +734,15 @@ fn known_buffer_size_for_ffi_type(tpe: ffi::enum_field_types) -> Option<usize> {

#[cfg(test)]
mod tests {
#[cfg(feature = "bigdecimal")]
use bigdecimal::FromPrimitive;

use super::MysqlValue;
use super::*;
use crate::connection::statement_cache::MaybeCached;
use crate::deserialize::FromSql;
use crate::mysql::connection::stmt::Statement;
use crate::prelude::*;
use crate::sql_types::*;
#[cfg(feature = "bigdecimal")]
use std::str::FromStr;

fn to_value<ST, T>(
bind: &BindData,
@@ -935,7 +934,7 @@ mod tests {
assert!(!numeric_col.flags.contains(Flags::UNSIGNED_FLAG));
assert_eq!(
to_value::<Numeric, bigdecimal::BigDecimal>(numeric_col).unwrap(),
bigdecimal::BigDecimal::from_f32(-999.999).unwrap()
bigdecimal::BigDecimal::from_str("-999.99900").unwrap()
);

let decimal_col = &results[8].0;
@@ -947,7 +946,7 @@ mod tests {
assert!(!decimal_col.flags.contains(Flags::UNSIGNED_FLAG));
assert_eq!(
to_value::<Numeric, bigdecimal::BigDecimal>(decimal_col).unwrap(),
bigdecimal::BigDecimal::from_f32(3.14).unwrap()
bigdecimal::BigDecimal::from_str("3.14000").unwrap()
);

let float_col = &results[9].0;
Loading