fix(connection): use bare mysql options for oceanbase

This commit is contained in:
t8y2 2026-05-15 12:36:52 +08:00
parent 12500c0b2a
commit 339081af35
1 changed files with 10 additions and 1 deletions

View File

@ -171,7 +171,7 @@ impl ConnectionConfig {
.driver_profile
.as_deref()
.map(|p| p.to_lowercase())
.is_some_and(|p| matches!(p.as_str(), "doris" | "starrocks" | "selectdb" | "tdengine"))
.is_some_and(|p| matches!(p.as_str(), "doris" | "starrocks" | "selectdb" | "tdengine" | "oceanbase"))
}
pub fn connection_url(&self) -> String {
@ -634,6 +634,15 @@ mod tests {
);
}
#[test]
fn oceanbase_profile_uses_bare_mysql_connection_options() {
let mut config = mysql_config("user@tenant#cluster", "secret", None);
config.driver_profile = Some("oceanbase".to_string());
assert!(config.needs_bare_mysql());
assert_eq!(config.connection_url(), "mysql://user%40tenant%23cluster:secret@10.1.2.3:2883?ssl-mode=disabled");
}
#[test]
fn mysql_url_encodes_password_and_database() {
let config = mysql_config("root", "p@ss:word#1", Some("db/name"));