Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(iotdb): recognize JDBC rpc_compress option

Guoyu Su9962796a0436
diff --git a/agents/drivers/iotdb/README.md b/agents/drivers/iotdb/README.md
index 840babbd20..ed21056db1 100644
--- a/agents/drivers/iotdb/README.md
+++ b/agents/drivers/iotdb/README.md
@@ -35,7 +35,9 @@ The following URL parameters are supported:
- `time_zone`
- `connect_retry_max`
- `connect_timeout_ms`
-- `enable_compression=true`
+- `enable_compression=true` (also accepts `rpc_compression` and the IoTDB JDBC
+ alias `rpc_compress`; when conflicting aliases are present, they take
+ precedence in that order)
- `node_urls=host1:6667,host2:6667` for cluster sessions
- `ssl=true` and `insecure_skip_verify=true`
diff --git a/agents/drivers/iotdb/driver.go b/agents/drivers/iotdb/driver.go
index 1997b37b0e..ae09da4a22 100644
--- a/agents/drivers/iotdb/driver.go
+++ b/agents/drivers/iotdb/driver.go
@@ -187,7 +187,7 @@ func parseConnectionConfig(params connectParams) (connectionConfig, error) {
}
config.ConnectTimeoutMS = parsed
}
- config.EnableCompression = queryBool(query, "enable_compression", "rpc_compression")
+ config.EnableCompression = queryBool(query, "enable_compression", "rpc_compression", "rpc_compress")
config.NodeURLs = parseNodeURLs(firstQueryValue(query, "node_urls", "nodes"))
if len(config.NodeURLs) == 0 {
config.NodeURLs = []string{net.JoinHostPort(config.Host, strconv.Itoa(config.Port))}
diff --git a/agents/drivers/iotdb/main_test.go b/agents/drivers/iotdb/main_test.go
index 544e37c896..4586b52fa0 100644
--- a/agents/drivers/iotdb/main_test.go
+++ b/agents/drivers/iotdb/main_test.go
@@ -70,6 +70,56 @@ func TestParseConnectionConfig(t *testing.T) {
}
}
+func TestParseConnectionConfigCompressionAliases(t *testing.T) {
+ tests := []struct {
+ name string
+ connectionString string
+ urlParams string
+ want bool
+ }{
+ {name: "default disabled"},
+ {name: "documented enabled", urlParams: "enable_compression=true", want: true},
+ {name: "documented disabled", urlParams: "enable_compression=false"},
+ {name: "existing alias enabled", urlParams: "rpc_compression=true", want: true},
+ {name: "existing alias disabled", urlParams: "rpc_compression=false"},
+ {name: "JDBC alias enabled in URL parameters", urlParams: "rpc_compress=true", want: true},
+ {name: "JDBC alias false", urlParams: "rpc_compress=false"},
+ {
+ name: "JDBC alias enabled in connection string",
+ connectionString: "jdbc:iotdb://localhost:6667/?rpc_compress=true",
+ want: true,
+ },
+ {
+ name: "URL parameters override same connection string key",
+ connectionString: "jdbc:iotdb://localhost:6667/?rpc_compress=true",
+ urlParams: "rpc_compress=false",
+ },
+ {
+ name: "documented option takes precedence",
+ urlParams: "enable_compression=false&rpc_compression=true&rpc_compress=true",
+ },
+ {
+ name: "existing alias takes precedence over JDBC alias",
+ urlParams: "rpc_compression=false&rpc_compress=true",
+ },
+ }
+
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ config, err := parseConnectionConfig(connectParams{
+ ConnectionString: test.connectionString,
+ URLParams: test.urlParams,
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ if config.EnableCompression != test.want {
+ t.Fatalf("EnableCompression = %t, want %t", config.EnableCompression, test.want)
+ }
+ })
+ }
+}
+
func TestBundledTimeZoneDatabase(t *testing.T) {
dataSet, err := client.NewIoTDBRpcDataSet(
"", nil, nil, nil, true, false, 0, 0, nil, 0, nil, 0, nil,