Commit Graph
417 Commits
Author SHA1 Message Date
t8y2 a5659d7637 fix(mongodb): support getIndexes shell command 2026-06-08 01:25:44 +08:00
t8y2 e6062b2b07 feat(etcd): add agent-backed etcd support 2026-06-08 00:58:42 +08:00
54de28d583 feat(grid): show column data types in result header (#669) (#820)
The data grid header only showed column names, and column types were
available only via tableMeta (open-table view). Arbitrary query results
(e.g. `select * from pg_depend`) therefore showed no type at all, which
is exactly the case the reporter hit.

Backend: add `column_types` to QueryResult (serde-default, backward
compatible) and populate it for the native drivers where the type is
readily available — PostgreSQL, MySQL, SQL Server, ClickHouse. Other
drivers leave it empty for now (no behavior change); schemaless stores
(Mongo/Redis/ES) have no column types.

Frontend: render a type row under each column name in the grid header,
color-coded by type. The type is resolved from tableMeta first (richer,
includes precision) and falls back to the query result's column_types by
index. Add a `showColumnTypesInHeader` setting (default on) and keep the
msgpack tab-result cache compatible. The source-selection logic is
extracted to lib/dataGridColumnType.ts with unit tests.

Co-authored-by: vrustx <vrustx@vrustxdeMac-mini.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 22:45:46 +08:00
b64e70753a fix(postgres): render internal "char" type as character, not ASCII code (#669) (#811)
PostgreSQL's internal "char" type (OID 18, e.g. pg_depend.deptype,
pg_shdepend.deptype) is a single byte the driver decodes as i8. In
pg_value_to_json it had no dedicated branch and fell through to the i8
arm below, surfacing the raw ASCII code (110 for 'n') instead of the
character.

Add a "char" branch that renders the byte as its character (matching
psql's charout): a zero byte becomes an empty string, any other byte is
interpreted as a Latin-1 code point so the output is always valid UTF-8
and never panics. SQL standard CHAR(n)/character(n) is a different type
("bpchar") and is unaffected. Added a unit test.

Co-authored-by: vrustx <vrustx@vrustxdeMac-mini.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 14:25:04 +08:00
至高吾尚 491e9633e0 fix(grid): polish cell/row/column detail dialogs (#528)
When Chinese text (table data or column comments) was written to MySQL
through a connection using the wrong charset (e.g. latin1/CP1252),
each byte of the correct UTF-8 representation was stored as a separate
CP1252 character, then re-encoded as UTF-8 on read, resulting in
garbled display like "主é"®" instead of "主键".

This commit adds a `fix_potential_double_encoding` function that reverses
the CP1252→UTF-8 double-encoding at read time, with a safety check that
only applies the fix when the decoded result contains CJK characters,
avoiding any impact on legitimate Latin-1 or ASCII text.

Changes:
- Add fix_potential_double_encoding() helper with full CP1252 mapping
  for the 0x80-0x9F range (€, ", ", etc.)
- Apply fix in mysql_value_to_json() to cover all table data display
- Apply fix in get_columns() to cover column comments via
  information_schema.COLUMNS
- Apply fix in get_columns_show() to cover column comments via
  SHOW FULL COLUMNS (fallback path)
- Minor formatting: break long line in columns_sql()
2026-06-07 09:32:31 +08:00
e9ee982843 Preserve ordered SSH and proxy connection layers (#802)
* Preserve ordered SSH and proxy connection layers

Replace separate SSH/proxy connection fields with ordered transport_layers while keeping legacy migration and secret fallback paths intact. The UI now edits SSH tunnel/proxy layers in configured order without a global SSH enable gate.

Constraint: Existing saved SSH tunnels, proxy settings, and secret-store keys must continue to load through migration.
Rejected: Folding proxy fields into SshTunnelConfig | mixes proxy semantics into an SSH-specific structure.
Confidence: high
Scope-risk: moderate
Directive: Keep SSH/proxy structs provider-specific; put cross-layer chaining in transport_layer_tunnel orchestration.
Tested: git diff --check; cargo fmt --check; cargo check --workspace; cargo test -p dbx-core --lib; vue-tsc --noEmit --project apps/desktop/tsconfig.json; tsc -p packages/node-core/tsconfig.json --noEmit; oxlint --vue-plugin apps/desktop/src; tsx --tsconfig apps/desktop/tsconfig.json --test packages/app-tests/*.test.ts; tsx --test packages/node-core/tests/*.test.ts
Not-tested: Live external SSH/proxy/database endpoint integration.

* Keep ordered transport changes CI-format clean

Constraint: CI pnpm check failed only on oxfmt formatting for two desktop TypeScript files
Confidence: high
Scope-risk: narrow
Directive: Keep generated/editor config changes out of this PR fix commit
Tested: PATH="/Volumes/data/code/rust/dbx/node_modules/.bin:/Users/hekx/.codex/tmp/arg0/codex-arg0nuL34n:/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/Users/hekx/Library/pnpm:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin:/opt/homebrew/bin:/opt/podman/bin:/Applications/Ghostty.app/Contents/MacOS" rtk node scripts/run-check.mjs
Not-tested: GitHub Actions rerun not observed locally

* Keep Rust checks warning-clean

Constraint: cargo clippy --workspace --all-targets --all-features -- -D warnings failed across core, web, and tauri crates
Rejected: Broad workspace-level clippy suppression | kept allows local to long-argument command/API boundaries
Confidence: high
Scope-risk: moderate
Directive: Preserve src-tauri/tauri.conf.json as an unrelated local change outside this commit
Tested: rtk cargo clippy --workspace --all-targets --all-features -- -D warnings
Not-tested: Full GitHub Actions rerun not observed locally

* Reuse existing proxy tunnels on retry

Proxy tunnel startup now mirrors SSH tunnel behavior by returning the existing local port for an active connection id instead of replacing the managed handle. A second map check aborts a just-spawned duplicate handle if a concurrent retry won the race before insertion, preventing orphaned listeners while keeping the change narrow.

Constraint: Reviewer requested proxy tunnel behavior align with SSH local-port reuse

Rejected: Always overwrite and abort the previous handle | less consistent with SSH behavior and churns listeners during retries

Confidence: high

Scope-risk: narrow

Tested: cargo fmt --check --all

Tested: cargo test -p dbx-core db::proxy_tunnel::tests::start_tunnel_reuses_existing_local_port

Tested: cargo clippy -p dbx-core --all-targets -- -D warnings

---------

Co-authored-by: hekx <hekx@momandeMac-mini.local>
Co-authored-by: caisin <caisin@caisins-Mac-mini.local>
2026-06-06 23:22:29 +08:00
t8y2 a1d0178a7e fix(postgres): add OpenGauss-compatible index query fallback without WITH ORDINALITY
OpenGauss is based on PostgreSQL 9.2 and does not support WITH ORDINALITY
(PG 9.4+). When the native pg_get_tabledef() path fails, the fallback DDL
builder calls list_indexes() which previously only had two SQL variants, both
using WITH ORDINALITY — causing "syntax error at or near 'WITH'" on OpenGauss.

Add POSTGRES_INDEXES_OPENGAUSS_SQL as a third fallback that uses generate_series
and array_length instead, both available since PG 8.0.
2026-06-06 11:29:16 +08:00
t8y2 249a1ed649 fix(postgres): recover schema session after aborted transaction 2026-06-05 14:46:00 +08:00
t8y2 7283f2b34a fix(sqlserver): handle spatial query results 2026-06-05 11:11:14 +08:00
t8y2 45cb5f4879 feat(tests): add live Postgres geometry test for rendering geometry values 2026-06-05 01:52:54 +08:00
t8y2 0887b96236 feat: add rqlite database support 2026-06-05 01:02:07 +08:00
t8y2 a799958328 feat: add driver runtime manager 2026-06-04 23:20:15 +08:00
t8y2 33175c4acd fix(pg): decode pgvector vector columns that displayed as null
pgvector's vector(N) type uses a custom binary format (4-byte header
+ N×4-byte f32 array) that tokio-postgres doesn't natively support.
Add a PgRawBytes adapter and decoder so vector columns render as
JSON float arrays instead of null.
2026-06-04 12:06:02 +08:00
t8y2 23391dce6b fix(mysql): support catalogless metadata fallback 2026-06-04 11:47:52 +08:00
t8y2 69ecde8fdf perf(doris): speed up metadata browsing 2026-06-04 00:05:14 +08:00
t8y2 94c987c693 fix(metadata): tolerate opengauss column metadata failures 2026-06-03 21:18:34 +08:00
t8y2 e3fec0f5d9 fix(elasticsearch): improve local TLS connection handling 2026-06-03 18:29:30 +08:00
t8y2 175d1def0d fix(grid): support blob downloads 2026-06-03 15:45:50 +08:00
t8y2 84f83d4d49 ci: speed up rust checks 2026-06-03 12:43:08 +08:00
t8y2 cc74fabad7 feat(completion): suggest database routines 2026-06-03 11:27:31 +08:00
t8y2 d952082442 fix(kingbase): prefer IPv4 stack for agent 2026-06-03 02:51:52 +08:00
t8y2 6ef7eba566 fix(mongodb): allow legacy fallback after native timeout 2026-06-03 02:44:02 +08:00
t8y2 2f765fa69c fix(jdbc): honor query execution settings 2026-06-02 20:07:54 +08:00
t8y2 1628f2aed4 fix(postgres): avoid hiding inherited tables as partitions 2026-06-02 19:10:28 +08:00
t8y2 cac90c7b62 fix(opengauss): open table structure editor 2026-06-02 18:50:00 +08:00
t8y2 a54c8cfd93 feat(sql): suggest join conditions from foreign keys 2026-06-02 18:08:06 +08:00
t8y2 b154dcceef fix(mysql): make admin show handling dialect aware 2026-06-02 17:35:14 +08:00
t8y2 c99ee9a31a fix(mysql): handle StarRocks admin show results 2026-06-02 17:21:26 +08:00
t8y2 0e7262eaa3 fix(postgres): display timestamptz in local timezone 2026-06-02 12:04:36 +08:00
t8y2 81e1693c18 fix(mongodb): support restricted database users 2026-06-02 11:09:48 +08:00
t8y2 6b8b2a1009 fix(connection): keep SSH tunnels alive 2026-06-02 10:39:24 +08:00
t8y2 130a33808e feat(desktop): improve table structure editor 2026-06-01 23:52:53 +08:00
t8y2 2f1a6875b7 feat(sqlite): support loading extension libraries 2026-06-01 22:40:29 +08:00
t8y2 7eca75b325 feat: support Oracle package sources 2026-06-01 18:43:20 +08:00
SKZ 76378f3a65 fix(mongo): support string document ids in update/delete
Support MongoDB documents whose _id is stored as a string, including 24-character hex strings that look like ObjectIds. Adds tests for the id filter fallback behavior.
2026-06-01 18:12:20 +08:00
t8y2 46c05b811f feat(connection): support multi-hop ssh tunnels 2026-06-01 14:48:33 +08:00
t8y2 e28495f3c1 perf: optimize table data loading 2026-05-31 22:10:02 +08:00
vrustx 7c0ed986c1 fix: enable SQLite math functions (#553) 2026-05-30 23:22:44 +08:00
vrustx fa08ed56a0 fix: display partition tables hierarchically 2026-05-30 21:51:21 +08:00
t8y2 0eacda465e fix(mysql): preserve session state for multi-statement queries 2026-05-30 17:57:28 +08:00
t8y2 a9e7f3946d fix(redis): support insecure tls connections 2026-05-30 16:00:13 +08:00
t8y2 dcc3e723a7 fix(mysql): retry unsupported prepared statements 2026-05-30 13:10:43 +08:00
t8y2 cd87d2a4e4 fix: normalize MySQL SSL mode URL params 2026-05-29 20:22:31 +08:00
t8y2 ef4baba57a feat: support double-clicking .db/.sqlite/.duckdb files to open in IDE
Add OS file association for database files (.db, .sqlite, .sqlite3, .duckdb)
so double-clicking them in Finder/Explorer automatically creates a connection.
If the same file path is already connected, prompts the user to switch instead.

Also fix 42 pre-existing clippy warnings in dbx-core (needless_borrow,
too_many_arguments, derivable_impls, manual_div_ceil, type_complexity, etc.).

Closes #527
2026-05-29 17:25:52 +08:00
t8y2 bbdb21c1e6 fix: strip JDBC-only MySQL URL parameters before driver parsing
JDBC connection URLs contain MySQL Connector/J-specific parameters
(useUnicode, characterEncoding, zeroDateTimeBehavior, useSSL,
serverTimezone, etc.) that mysql_async::Opts::from_url() does not
recognize, causing "Invalid MySQL URL: Unknown connection URL
parameter" errors. Filter these parameters out in mysql_async_url()
before passing the URL to the driver.

Fixes #524
2026-05-29 16:48:54 +08:00
t8y2 027c39a610 perf: optimize database connection pooling and query execution
- Increase MySQL pool max from 1 to 3 to avoid contention across tabs
- Merge get_columns serial queries into a single LEFT JOIN
- Clone pool handles before health checks in refresh_connections to reduce lock contention
- Skip COUNT(*) when result rows are fewer than the page size
2026-05-29 16:26:19 +08:00
t8y2 b54eda1889 fix: 修复应用长时间挂后台后恢复时表格数据永久加载的问题
三层防护:
- MySQL 连接获取时执行 ping 健康检查,死连接自动重连
- macOS Reopen 事件 + 前端 visibilitychange 触发连接刷新
- 前端 Promise.race 超时保护,确保 loading 状态不会超过 60s
2026-05-29 15:12:14 +08:00
rarnu 51e62d4c60 SSH 隧道连接优化 (#517)
* 1. 增加 SSH 隧道保活
每 30 秒发一次 keepalive 包,防止 NAT/防火墙丢弃空闲连接。

2. SSH 隧道自动重连
整体逻辑为:
  └─ 初始连接(失败则立即报错,防止 credential 错误时无限重试)
  └─ 绑定 TcpListener(端口不变)
  └─ 启动 tunnel_reconnect_loop
      ├─ forward_loop()  ← 转发数据,检测到 session 断开后退出
      ├─ 睡眠 5 秒
      ├─ connect_and_authenticate() 重连
      ├─ 重连失败?→ 继续等 5 秒 → 重试
      └─ 重连成功 → 回到 forward_loop()

* 修复rust代码风格

* 1:指数退避
延迟序列: 5s → 10s → 20s → 40s → 60s → 60s → ...(封顶 60s)
不再是固定 5 秒重试,避免临时故障时刷屏。

2:最大重试次数
连续失败 10 次后放弃,打一条 fatal 日志 max reconnect attempts exhausted, giving up,然后隧道任务退出。不再无限循环。

3:日志改进
失败日志现在带进度:SSH reconnect failed (host:port, attempt 3/10): error
成功重连日志也带 (attempt N) 方便排查。
2026-05-29 13:31:31 +08:00
t8y2 39b960c46c fix(mysql): select database during URL connection setup 2026-05-28 23:02:44 +08:00
徐文彬 5ea146e08e fix(mongodb): guard aggregate execution paths 2026-05-28 21:29:08 +08:00