feat(uxdb): add UXDB database support
This commit is contained in:
65 files changed
+697
-96
No files matched your search
@@ -74,6 +74,13 @@ const AGENT_CATALOG: &[AgentCatalogEntry] = &[
|
||||
store_visible: true,
|
||||
profiles: &[],
|
||||
},
|
||||
AgentCatalogEntry {
|
||||
db_type: DatabaseType::Uxdb,
|
||||
key: "uxdb",
|
||||
label: "优炫 UXDB",
|
||||
store_visible: true,
|
||||
profiles: &[],
|
||||
},
|
||||
AgentCatalogEntry {
|
||||
db_type: DatabaseType::Vastbase,
|
||||
key: "vastbase",
|
||||
|
||||
@@ -12,7 +12,10 @@ pub fn agent_connect_params(config: &ConnectionConfig, host: &str, port: u16, da
|
||||
mongo_agent_database(config, database)
|
||||
} else if matches!(config.db_type, DatabaseType::Oracle | DatabaseType::OceanbaseOracle) {
|
||||
oracle_agent_database(config, database)
|
||||
} else if matches!(config.db_type, DatabaseType::Kingbase | DatabaseType::Highgo | DatabaseType::Vastbase) {
|
||||
} else if matches!(
|
||||
config.db_type,
|
||||
DatabaseType::Kingbase | DatabaseType::Highgo | DatabaseType::Uxdb | DatabaseType::Vastbase
|
||||
) {
|
||||
postgres_like_agent_database(config, database).to_string()
|
||||
} else if is_h2_file_connection(config) {
|
||||
h2_agent_database(config)
|
||||
@@ -25,7 +28,10 @@ pub fn agent_connect_params(config: &ConnectionConfig, host: &str, port: u16, da
|
||||
oracle_jdbc_connection_string(config, host, port, database)
|
||||
} else if config.db_type == DatabaseType::OceanbaseOracle {
|
||||
oceanbase_oracle_jdbc_connection_string(config, host, port, database)
|
||||
} else if matches!(config.db_type, DatabaseType::Kingbase | DatabaseType::Highgo | DatabaseType::Vastbase) {
|
||||
} else if matches!(
|
||||
config.db_type,
|
||||
DatabaseType::Kingbase | DatabaseType::Highgo | DatabaseType::Uxdb | DatabaseType::Vastbase
|
||||
) {
|
||||
postgres_like_agent_jdbc_connection_string(config, host, port, database)
|
||||
} else if config.db_type == DatabaseType::SapHana {
|
||||
sap_hana_jdbc_connection_string(config, host, port, database)
|
||||
@@ -408,6 +414,7 @@ fn postgres_like_agent_jdbc_connection_string(
|
||||
let scheme = match config.db_type {
|
||||
DatabaseType::Kingbase => "kingbase8",
|
||||
DatabaseType::Highgo => "highgo",
|
||||
DatabaseType::Uxdb => "uxdb",
|
||||
DatabaseType::Vastbase => "vastbase",
|
||||
_ => unreachable!("postgres-like agent JDBC URL requested for {:?}", config.db_type),
|
||||
};
|
||||
@@ -727,6 +734,16 @@ mod tests {
|
||||
assert_eq!(params["connection_string"], "jdbc:vastbase://vastbase.example.com:5432/postgres");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uxdb_agent_params_use_vendor_jdbc_url() {
|
||||
let cfg = config(DatabaseType::Uxdb, Some("uxdb"));
|
||||
|
||||
let params = agent_connect_params(&cfg, "uxdb.example.com", 52025, "uxdb");
|
||||
|
||||
assert_eq!(params["database"], "uxdb");
|
||||
assert_eq!(params["connection_string"], "jdbc:uxdb://uxdb.example.com:52025/uxdb");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zookeeper_agent_params_preserve_configured_connect_string() {
|
||||
let mut cfg = config(DatabaseType::ZooKeeper, None);
|
||||
|
||||
@@ -139,6 +139,7 @@ macro_rules! agent_connection_pool_database_type {
|
||||
DatabaseType::Dameng
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Goldendb
|
||||
| DatabaseType::Databend
|
||||
@@ -4978,6 +4979,10 @@ mod tests {
|
||||
config.db_type = DatabaseType::Sqlite;
|
||||
config.host = db_path.to_string_lossy().to_string();
|
||||
config.port = 0;
|
||||
// This exercises a plain SQLite file. The shared MySQL fixture carries
|
||||
// credentials, and a SQLite password intentionally opts into SQLCipher.
|
||||
config.username.clear();
|
||||
config.password.clear();
|
||||
|
||||
state.configs.write().await.insert(config.id.clone(), config);
|
||||
|
||||
|
||||
@@ -2716,6 +2716,7 @@ fn is_postgres_like_pattern_database(database_type: Option<DatabaseType>) -> boo
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::OpenGauss
|
||||
)
|
||||
@@ -2829,6 +2830,7 @@ fn uses_keyless_row_predicate(database_type: Option<DatabaseType>) -> bool {
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Goldendb
|
||||
| DatabaseType::Yashandb
|
||||
|
||||
@@ -22,6 +22,7 @@ pub fn is_single_connection_pool(db_type: &DatabaseType) -> bool {
|
||||
| DatabaseType::Dameng
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Goldendb
|
||||
| DatabaseType::Yashandb
|
||||
|
||||
@@ -258,6 +258,7 @@ pub fn supports_create_schema_target(database_type: Option<DatabaseType>) -> boo
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Yashandb
|
||||
| DatabaseType::Dameng
|
||||
@@ -294,6 +295,7 @@ pub fn supports_database_property_comment(database_type: Option<DatabaseType>) -
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Yashandb
|
||||
@@ -369,6 +371,7 @@ fn supports_drop_table_cascade(database_type: Option<DatabaseType>) -> bool {
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::OpenGauss
|
||||
)
|
||||
@@ -397,6 +400,7 @@ pub fn build_drop_table_child_object_sql(options: DropTableChildObjectSqlOptions
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Questdb
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Oracle
|
||||
@@ -429,6 +433,7 @@ pub fn build_drop_table_child_object_sql(options: DropTableChildObjectSqlOptions
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Questdb
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Kingbase
|
||||
)
|
||||
@@ -488,6 +493,7 @@ fn supports_truncate_table_cascade(database_type: Option<DatabaseType>) -> bool
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::OpenGauss
|
||||
)
|
||||
@@ -706,6 +712,7 @@ fn is_postgres_like_rename(database_type: DatabaseType) -> bool {
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
)
|
||||
}
|
||||
|
||||
@@ -468,6 +468,7 @@ pub enum DatabaseType {
|
||||
Dameng,
|
||||
Kingbase,
|
||||
Highgo,
|
||||
Uxdb,
|
||||
Vastbase,
|
||||
Goldendb,
|
||||
Gaussdb,
|
||||
@@ -852,6 +853,7 @@ impl ConnectionConfig {
|
||||
DatabaseType::Kwdb => Some("defaultdb"),
|
||||
DatabaseType::Vastbase => Some("postgres"),
|
||||
DatabaseType::Highgo => Some("highgo"),
|
||||
DatabaseType::Uxdb => Some("uxdb"),
|
||||
DatabaseType::Yashandb => Some("yasdb"),
|
||||
DatabaseType::Oscar => Some("osrdb"),
|
||||
DatabaseType::Firebird => Some("employee"),
|
||||
@@ -994,6 +996,7 @@ impl ConnectionConfig {
|
||||
DatabaseType::Dameng => format!("dm://{host}:{port}{db_part}"),
|
||||
DatabaseType::Kingbase => format!("kingbase://{host}:{port}{db_part}"),
|
||||
DatabaseType::Highgo => format!("highgo://{host}:{port}{db_part}"),
|
||||
DatabaseType::Uxdb => format!("uxdb://{host}:{port}{db_part}"),
|
||||
DatabaseType::Vastbase => format!("vastbase://{host}:{port}{db_part}"),
|
||||
DatabaseType::Goldendb => format!("goldendb://{host}:{port}{db_part}"),
|
||||
DatabaseType::Gaussdb => format!("gaussdb://{host}:{port}{db_part}"),
|
||||
@@ -1147,6 +1150,9 @@ impl ConnectionConfig {
|
||||
DatabaseType::Highgo => {
|
||||
format!("highgo://{}:{}@{host}:{port}{db_part}", username, password)
|
||||
}
|
||||
DatabaseType::Uxdb => {
|
||||
format!("uxdb://{}:{}@{host}:{port}{db_part}", username, password)
|
||||
}
|
||||
DatabaseType::Vastbase => {
|
||||
format!("vastbase://{}:{}@{host}:{port}{db_part}", username, password)
|
||||
}
|
||||
@@ -2544,6 +2550,15 @@ mod tests {
|
||||
assert_eq!(config.connection_url(), "vastbase://vastbase:secret@10.1.2.3:5432/postgres");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uxdb_connection_url_uses_uxdb_scheme() {
|
||||
let mut config = mysql_config("uxdb", "secret", Some("warehouse"));
|
||||
config.db_type = DatabaseType::Uxdb;
|
||||
config.port = 52025;
|
||||
|
||||
assert_eq!(config.connection_url(), "uxdb://uxdb:secret@10.1.2.3:52025/warehouse");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clickhouse_tls_uses_https_from_ssl_or_secure_param() {
|
||||
let mut config = mysql_config("default", "", None);
|
||||
|
||||
@@ -302,6 +302,7 @@ fn is_postgres_like(database_type: DatabaseType) -> bool {
|
||||
| DatabaseType::Questdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
)
|
||||
}
|
||||
|
||||
@@ -402,6 +402,7 @@ fn schema_first_qualifier_type(db_type: &DatabaseType) -> bool {
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Yashandb
|
||||
| DatabaseType::Oracle
|
||||
|
||||
@@ -258,6 +258,7 @@ fn is_postgresql_family_database(database_type: DatabaseType) -> bool {
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Kwdb
|
||||
)
|
||||
|
||||
@@ -3437,6 +3437,7 @@ mod tests {
|
||||
assert!(!is_agent_postgres_metadata_fallback_config(&test_connection_config(DatabaseType::Kingbase)));
|
||||
assert!(is_agent_postgres_metadata_fallback_config(&test_connection_config(DatabaseType::Highgo)));
|
||||
assert!(is_agent_postgres_metadata_fallback_config(&test_connection_config(DatabaseType::Vastbase)));
|
||||
assert!(!is_agent_postgres_metadata_fallback_config(&test_connection_config(DatabaseType::Uxdb)));
|
||||
assert!(!is_agent_postgres_metadata_fallback_config(&test_connection_config(DatabaseType::Postgres)));
|
||||
assert!(!is_agent_postgres_metadata_fallback_config(&test_connection_config(DatabaseType::Mysql)));
|
||||
}
|
||||
@@ -4535,8 +4536,9 @@ fn filter_completion_objects(objects: Vec<db::ObjectInfo>) -> Vec<db::ObjectInfo
|
||||
}
|
||||
|
||||
fn is_agent_postgres_metadata_fallback_config(config: &ConnectionConfig) -> bool {
|
||||
// Kingbase has dedicated agent metadata SQL and may carry JDBC-specific URL
|
||||
// parameters that the native PostgreSQL driver cannot parse.
|
||||
// HighGo and Vastbase can use the native PostgreSQL metadata path when their
|
||||
// agent returns no rows. UXDB is JDBC-only; opening a PostgreSQL fallback
|
||||
// connection there turns valid empty schemas into misleading DB errors.
|
||||
matches!(config.db_type, DatabaseType::Highgo | DatabaseType::Vastbase)
|
||||
}
|
||||
|
||||
@@ -6038,6 +6040,7 @@ async fn get_object_source_once(
|
||||
| DatabaseType::Questdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
)
|
||||
}) {
|
||||
|
||||
@@ -199,7 +199,7 @@ fn normalize_clickhouse_join_order_for_parser(sql: &str) -> String {
|
||||
|
||||
fn normalize_dialect(dialect: Option<&str>) -> String {
|
||||
match dialect.unwrap_or("generic").to_ascii_lowercase().as_str() {
|
||||
"postgres" | "postgresql" | "redshift" | "opengauss" | "gaussdb" | "highgo" | "questdb" => {
|
||||
"postgres" | "postgresql" | "redshift" | "opengauss" | "gaussdb" | "highgo" | "uxdb" | "questdb" => {
|
||||
"postgres".to_string()
|
||||
}
|
||||
"mysql" | "mariadb" | "doris" | "starrocks" | "manticoresearch" | "oceanbase" => "mysql".to_string(),
|
||||
|
||||
@@ -34,6 +34,7 @@ pub fn is_schema_aware(database_type: DatabaseType) -> bool {
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Yashandb
|
||||
| DatabaseType::Oscar
|
||||
|
||||
@@ -41,8 +41,8 @@ impl std::fmt::Display for SqlRisk {
|
||||
/// Mirrors the logic in `sql_analysis::normalize_dialect`.
|
||||
fn normalize_dialect(dialect: &str) -> &'static str {
|
||||
match dialect.to_ascii_lowercase().as_str() {
|
||||
"postgres" | "postgresql" | "redshift" | "opengauss" | "gaussdb" | "kingbase" | "highgo" | "vastbase"
|
||||
| "kwdb" => "postgres",
|
||||
"postgres" | "postgresql" | "redshift" | "opengauss" | "gaussdb" | "kingbase" | "highgo" | "uxdb"
|
||||
| "vastbase" | "kwdb" => "postgres",
|
||||
"mysql" | "mariadb" | "doris" | "starrocks" | "manticoresearch" | "oceanbase" => "mysql",
|
||||
"sqlite" => "sqlite",
|
||||
"sqlserver" | "mssql" => "sqlserver",
|
||||
@@ -766,6 +766,7 @@ fn supports_select_into_table_creation(database_type: DatabaseType) -> bool {
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::SqlServer
|
||||
|
||||
@@ -3280,6 +3280,7 @@ fn decimal_data_type(db_type: &DatabaseType) -> &'static str {
|
||||
| DatabaseType::Redshift
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Vastbase => "DOUBLE PRECISION",
|
||||
DatabaseType::Sqlite | DatabaseType::Rqlite | DatabaseType::Turso | DatabaseType::CloudflareD1 => "REAL",
|
||||
@@ -3335,6 +3336,7 @@ fn json_data_type(db_type: &DatabaseType) -> &'static str {
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Vastbase => "JSONB",
|
||||
DatabaseType::Mysql | DatabaseType::Databend => "JSON",
|
||||
|
||||
@@ -111,6 +111,7 @@ pub(super) fn capabilities_for(database_type: Option<DatabaseType>) -> TableStru
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::OpenGauss
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Vastbase
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Firebird,
|
||||
|
||||
@@ -501,6 +501,7 @@ fn is_postgres_family_target(target_db: &DatabaseType) -> bool {
|
||||
| DatabaseType::Redshift
|
||||
| DatabaseType::Kingbase
|
||||
| DatabaseType::Highgo
|
||||
| DatabaseType::Uxdb
|
||||
| DatabaseType::Kwdb
|
||||
| DatabaseType::Vastbase
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user