sqlx/sqlx-mysql
Aleh Shapo 29549b14c4
fix(mysql): validate parameter count for prepared statements (#3857)
* fix(mysql): validate parameter count for prepared statements

Add validation to ensure the number of provided parameters matches the
expected count for MySQL prepared statements.
This prevents protocol errors by returning an error if the counts do not match before sending
the statement for execution.

* refactor(mysql): use err_protocol macro for error creation

Replace direct Error::Protocol(format!()) calls with err_protocol!
macro in MySQL connection executor.

* test(mysql): add parameter count validation tests

- Add test for too few parameters provided to query
- Add test for too many parameters provided to query
- Add test for parameters provided when none expected
- All tests verify Error::Protocol is returned for mismatches

Covers cases for issue #3774 parameter validation fix.
2025-07-02 17:24:44 -07:00
..
2024-06-20 10:56:08 -07:00
2024-06-20 10:56:08 -07:00