Skip to content

Commit d02798c

Browse files
authored
Merge pull request #140 from Soblow/fix/mysql_update_rowcount
Fix #138 (Incoherent UPDATE return for MySQL/MariaDB)
2 parents 1ef43d2 + cafb86d commit d02798c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/
77
## [Unreleased]
88

99
* Added type `diesel_async::pooled_connection::mobc::PooledConnection`
10+
* MySQL/MariaDB now use `CLIENT_FOUND_ROWS` capability to allow consistent behavior with PostgreSQL regarding return value of UPDATe commands.
1011

1112
## [0.4.1] - 2023-09-01
1213

@@ -68,3 +69,6 @@ in the pool should be checked if they are still valid
6869
[0.3.0]: https://github.com/weiznich/diesel_async/compare/v0.2.0...v0.3.0
6970
[0.3.1]: https://github.com/weiznich/diesel_async/compare/v0.3.0...v0.3.1
7071
[0.3.2]: https://github.com/weiznich/diesel_async/compare/v0.3.1...v0.3.2
72+
[0.4.0]: https://github.com/weiznich/diesel_async/compare/v0.3.2...v0.4.0
73+
[0.4.1]: https://github.com/weiznich/diesel_async/compare/v0.4.0...v0.4.1
74+
[Unreleased]: https://github.com/weiznich/diesel_async/compare/v0.4.1...main

src/mysql/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ impl AsyncConnection for AsyncMysqlConnection {
5757
.map_err(|e| diesel::result::ConnectionError::InvalidConnectionUrl(e.to_string()))?;
5858
let builder = OptsBuilder::from_opts(opts)
5959
.init(CONNECTION_SETUP_QUERIES.to_vec())
60-
.stmt_cache_size(0); // We have our own cache
60+
.stmt_cache_size(0) // We have our own cache
61+
.client_found_rows(true); // This allows a consistent behavior between MariaDB/MySQL and PostgreSQL (and is already set in `diesel`)
6162

6263
let conn = mysql_async::Conn::new(builder).await.map_err(ErrorHelper)?;
6364

0 commit comments

Comments
 (0)