Skip to content

Commit 7db08dc

Browse files
committed
fix(test): fix mismatched type error in MySQL type tests
1 parent 87e1d1a commit 7db08dc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

sqlx-test/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ macro_rules! __test_prepared_type {
197197
#[macro_export]
198198
macro_rules! MySql_query_for_test_prepared_type {
199199
() => {
200-
"SELECT {0} <=> ?, {0}, ?"
200+
// MySQL 8.0.27 changed `<=>` to return an unsigned integer
201+
"SELECT CAST({0} <=> ? AS SIGNED INTEGER), {0}, ?"
201202
};
202203
}
203204

tests/mysql/types.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ mod json_tests {
235235

236236
test_type!(json<JsonValue>(
237237
MySql,
238-
"SELECT CAST({0} AS BINARY) <=> CAST(? AS BINARY), CAST({0} AS BINARY) as _2, ? as _3",
238+
// MySQL 8.0.27 changed `<=>` to return an unsigned integer
239+
"SELECT CAST(CAST({0} AS BINARY) <=> CAST(? AS BINARY) AS SIGNED INTEGER), CAST({0} AS BINARY) as _2, ? as _3",
239240
"'\"Hello, World\"'" == json!("Hello, World"),
240241
"'\"😎\"'" == json!("😎"),
241242
"'\"🙋‍♀️\"'" == json!("🙋‍♀️"),
@@ -250,7 +251,8 @@ mod json_tests {
250251

251252
test_type!(json_struct<Json<Friend>>(
252253
MySql,
253-
"SELECT CAST({0} AS BINARY) <=> CAST(? AS BINARY), CAST({0} AS BINARY) as _2, ? as _3",
254+
// MySQL 8.0.27 changed `<=>` to return an unsigned integer
255+
"SELECT CAST(CAST({0} AS BINARY) <=> CAST(? AS BINARY) AS SIGNED INTEGER), CAST({0} AS BINARY) as _2, ? as _3",
254256
"\'{\"name\":\"Joe\",\"age\":33}\'" == Json(Friend { name: "Joe".to_string(), age: 33 })
255257
));
256258

0 commit comments

Comments
 (0)