Skip to content

Commit dc0ad82

Browse files
committed
breaking(mysql): assume all non-binary collations compatible with str
cc #3400 (comment) comment in `sqlx-mysql/src/collation.rs` for explanation fixes #3200 fixes #3387 fixes #3390 fixes #3409
1 parent 1228d24 commit dc0ad82

File tree

22 files changed

+240
-1021
lines changed

22 files changed

+240
-1021
lines changed

.github/workflows/sqlx.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ jobs:
419419
runs-on: ubuntu-24.04
420420
strategy:
421421
matrix:
422-
mariadb: [ verylatest, 11_4, 10_11, 10_4 ]
422+
mariadb: [ verylatest, 11_8, 11_4, 10_11, 10_6 ]
423423
runtime: [ async-std, tokio ]
424424
tls: [ native-tls, rustls-aws-lc-rs, rustls-ring, none ]
425425
needs: check
@@ -446,7 +446,7 @@ jobs:
446446
env:
447447
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
448448
SQLX_OFFLINE_DIR: .sqlx
449-
RUSTFLAGS: --cfg mariadb_${{ matrix.mariadb }}
449+
RUSTFLAGS: --cfg mariadb="${{ matrix.mariadb }}"
450450
451451
# Run the `test-attr` test again to cover cleanup.
452452
- run: >
@@ -457,7 +457,7 @@ jobs:
457457
env:
458458
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
459459
SQLX_OFFLINE_DIR: .sqlx
460-
RUSTFLAGS: --cfg mariadb_${{ matrix.mariadb }}
460+
RUSTFLAGS: --cfg mariadb="${{ matrix.mariadb }}"
461461
462462
# Remove test artifacts
463463
- run: cargo clean -p sqlx
@@ -471,7 +471,7 @@ jobs:
471471
env:
472472
SQLX_OFFLINE: true
473473
SQLX_OFFLINE_DIR: .sqlx
474-
RUSTFLAGS: -D warnings --cfg mariadb_${{ matrix.mariadb }}
474+
RUSTFLAGS: -D warnings --cfg mariadb="${{ matrix.mariadb }}"
475475
476476
# Test macros in offline mode (still needs DATABASE_URL to run)
477477
- run: >
@@ -483,7 +483,7 @@ jobs:
483483
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
484484
SQLX_OFFLINE: true
485485
SQLX_OFFLINE_DIR: .sqlx
486-
RUSTFLAGS: --cfg mariadb_${{ matrix.mariadb }}
486+
RUSTFLAGS: --cfg mariadb="${{ matrix.mariadb }}"
487487
488488
# client SSL authentication
489489

@@ -500,4 +500,4 @@ jobs:
500500
--features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
501501
env:
502502
DATABASE_URL: mysql://root@localhost:3306/sqlx?sslmode=verify_ca&ssl-ca=.%2Ftests%2Fcerts%2Fca.crt&ssl-key=.%2Ftests%2Fcerts%2Fkeys%2Fclient.key&ssl-cert=.%2Ftests%2Fcerts%2Fclient.crt
503-
RUSTFLAGS: --cfg mariadb_${{ matrix.mariadb }}
503+
RUSTFLAGS: --cfg mariadb="${{ matrix.mariadb }}"

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ cast_sign_loss = 'deny'
210210
# See `clippy.toml`
211211
disallowed_methods = 'deny'
212212

213+
[lints.rust]
214+
unexpected_cfgs = { level = 'warn', check-cfg = ['cfg(mariadb, values(any()))'] }
215+
213216
#
214217
# Any
215218
#

sqlx-core/src/raw_sql.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ impl<'q> RawSql<'q> {
245245
///
246246
/// Otherwise, you might want to add `LIMIT 1` to your query.
247247
#[inline]
248-
pub async fn fetch_optional<'e, E, DB>(self, executor: E) -> crate::Result<DB::Row>
248+
pub async fn fetch_optional<'e, E, DB>(self, executor: E) -> crate::Result<Option<DB::Row>>
249249
where
250250
'q: 'e,
251251
DB: Database,
252252
E: Executor<'e, Database = DB>,
253253
{
254-
executor.fetch_one(self).await
254+
executor.fetch_optional(self).await
255255
}
256256
}

0 commit comments

Comments
 (0)