Skip to content

Commit

Permalink
test: add a parameter type mismatch test case to sql integration test (
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxuuu authored Mar 22, 2024
1 parent 8345f17 commit 24886b9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests-integration/tests/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,23 @@ pub async fn test_mysql_crud(store_type: StorageType) {
assert_eq!(ret, 6);
}

// parameter type mismatch
let query_re = sqlx::query("select i from demo where i = ?")
.bind("test")
.fetch_all(&pool)
.await;
assert!(query_re.is_err());
assert_eq!(
query_re
.err()
.unwrap()
.into_database_error()
.unwrap()
.downcast::<MySqlDatabaseError>()
.code(),
Some("22007")
);

let _ = sqlx::query("delete from demo")
.execute(&pool)
.await
Expand Down

0 comments on commit 24886b9

Please sign in to comment.