fix(mysql): retry unsupported prepared statements

This commit is contained in:
t8y2 2026-05-30 13:10:43 +08:00
parent 6481af3ed8
commit dcc3e723a7
1 changed files with 8 additions and 0 deletions

View File

@ -522,6 +522,7 @@ fn mysql_error_should_retry_without_ssl(error: &str) -> bool {
fn mysql_error_should_retry_with_text_protocol(error: &str) -> bool {
let lower = error.to_ascii_lowercase();
(lower.contains("1105") && lower.contains("hy000"))
|| lower.contains("com_stmt_prepare")
|| lower.contains("prepared statement protocol")
|| lower.contains("this command is not supported in the prepared statement protocol yet")
}
@ -1314,6 +1315,13 @@ mod tests {
assert!(mysql_error_should_retry_with_text_protocol(error));
}
#[test]
fn mysql_unsupported_prepare_command_can_retry_with_text_protocol() {
let error = "ERROR PX000 (3000): [a2jupsonbbv6zai1gomo5whu36ndqy] Unsupported command: COM_STMT_PREPARE";
assert!(mysql_error_should_retry_with_text_protocol(error));
}
#[test]
fn mysql_setup_queries_select_requested_database_before_session_init() {
let queries = mysql_setup_queries("mysql://root:secret@localhost:3306/app?charset=utf8mb4");