Skip to content

Commit 97ac805

Browse files
committed
fix(mssql): map BIT to bool in compile-time type checking
The query! macros resolve a column's Rust type via <Mssql as TypeChecking>::return_type_for_id, which only searches the type list in impl_type_checking!. `bool` was missing from that list, so a BIT column had no built-in mapping and failed to compile: error: no built-in mapping found for type BIT of column ("deleted") error[E0277]: the trait bound `(): sqlx::Decode<'_, Mssql>` is not satisfied The runtime bool/BIT support already exists (types/bool.rs). Add `bool` to the list, placed after the integer types: `bool::compatible` also matches TINYINT/INT/SMALLINT/BIGINT, but the integer types (whose int_compatible does NOT match BIT) claim those first, so only BIT falls through to bool. Fixes the tests/mssql/macros.rs `test_query_simple` test. Author: Pablo Carrera <pabloce@poscye.com>
1 parent e80d798 commit 97ac805

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sqlx-mssql/src/type_checking.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ impl_type_checking!(
1212
i16,
1313
i32,
1414
i64,
15+
16+
// Must come after the integer types: `bool::compatible` also matches
17+
// TINYINT/INT/SMALLINT/BIGINT, but the integer types claim those first;
18+
// BIT is matched only by `bool`.
19+
bool,
20+
1521
f32,
1622
f64,
1723

0 commit comments

Comments
 (0)