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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(jdbc): report deferred CLOB byte size as unknown
efeiree0a685f5c0f0
diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.tsindex f473fbfb99..97abe0fbab 100644--- a/apps/desktop/src/types/database.ts+++ b/apps/desktop/src/types/database.ts@@ -1837,7 +1837,13 @@ export interface QueryResult {total_is_exact?: boolean;truncated?: boolean;/** Variable-length cells represented by bounded previews in `rows`. */- large_value_cells?: Array<{ row_index: number; column_index: number; original_bytes: number; value_ref?: string }>;+ large_value_cells?: Array<{+ row_index: number;+ column_index: number;+ /** With value_ref, zero can mean an unknown byte size, not an empty value. */+ original_bytes: number;+ value_ref?: string;+ }>;/** Frontend-only original result connection, independent of the currently active tab. */large_value_context?: { connectionId: string; database: string; clientSessionId?: string; txnSessionId?: string; catalog?: string };/** Retained result refs also cover cells already hydrated into complete local values. */diff --git a/crates/dbx-types/src/types.rs b/crates/dbx-types/src/types.rsindex f453ec3694..c547711890 100644--- a/crates/dbx-types/src/types.rs+++ b/crates/dbx-types/src/types.rs@@ -595,6 +595,7 @@ impl QueryMessage {pub struct LargeValueCell {pub row_index: usize,pub column_index: usize,+ /// With `value_ref`, zero can mean an unknown byte size, not an empty value.pub original_bytes: usize,/// Opaque original-result locator. Absent for legacy preview/re-query drivers.#[serde(default, skip_serializing_if = "Option::is_none")]@@ -2011,16 +2012,19 @@ mod tests {#[test]fn query_result_receives_deferred_cells_without_serializing_a_second_metadata_field() {- let mut wire = serde_json::to_value(bigint_result_sample()).unwrap();- wire["large_value_cells"] = serde_json::json!([{- "row_index": 0, "column_index": 0, "original_bytes": 67108864, "value_ref": "original-lob"- }]);- let result: super::QueryResult = serde_json::from_value(wire).unwrap();- assert_eq!(result.deferred_large_value_cells.len(), 1);- assert_eq!(result.deferred_large_value_cells[0].value_ref.as_deref(), Some("original-lob"));- let serialized = serde_json::to_value(&result).unwrap();- assert!(serialized.get("large_value_cells").is_none());- assert!(serialized.get("deferred_large_value_cells").is_none());+ for original_bytes in [0, 67108864] {+ let mut wire = serde_json::to_value(bigint_result_sample()).unwrap();+ wire["large_value_cells"] = serde_json::json!([{+ "row_index": 0, "column_index": 0, "original_bytes": original_bytes, "value_ref": "original-lob"+ }]);+ let result: super::QueryResult = serde_json::from_value(wire).unwrap();+ assert_eq!(result.deferred_large_value_cells.len(), 1);+ assert_eq!(result.deferred_large_value_cells[0].value_ref.as_deref(), Some("original-lob"));+ assert_eq!(result.deferred_large_value_cells[0].original_bytes, original_bytes);+ let serialized = serde_json::to_value(&result).unwrap();+ assert!(serialized.get("large_value_cells").is_none());+ assert!(serialized.get("deferred_large_value_cells").is_none());+ }}fn bigint_result_sample() -> super::QueryResult {diff --git a/plugins/jdbc/README.md b/plugins/jdbc/README.mdindex 2178c380f9..b82afacf92 100644--- a/plugins/jdbc/README.md+++ b/plugins/jdbc/README.md@@ -62,3 +62,9 @@ per-connection opt-in in the connection dialog.Some high-privilege extensions require optional runtime libraries that JDBCX deliberately does not bundle. Installthose libraries in the JDBC driver store and select them for the same connection. For JDBCX 0.8.0, MCP requires`io.github.jdbcx:io.modelcontextprotocol:1.0.1`; use the dependency version declared by the selected JDBCX release.++## Oracle cancellation++Oracle JDBC connections default to `oracle.net.disableOob=true`, so statement cancellation uses in-band rather than+out-of-band signaling. This keeps the tested Oracle connection usable after a cancelled query or LOB read. An explicit+connection property takes precedence. This default does not change OceanBase connections or JVM-wide settings.diff --git a/plugins/jdbc/src/main/java/app/dbx/jdbc/DeferredLobValues.java b/plugins/jdbc/src/main/java/app/dbx/jdbc/DeferredLobValues.javaindex 32ff357f6c..90350cebb9 100644--- a/plugins/jdbc/src/main/java/app/dbx/jdbc/DeferredLobValues.java+++ b/plugins/jdbc/src/main/java/app/dbx/jdbc/DeferredLobValues.java@@ -67,7 +67,8 @@ final class DeferredLobValues {retained = true;String prefix = entry.binary ? "0x" + text.substring(0, PREVIEW * 2): text.substring(0, text.offsetByCodePoints(0, PREVIEW));- return new Preview(prefix, ref, entry.binary ? length : 64L * 1024 * 1024);+ // With a locator, zero means unknown byte size; Clob.length() is not a UTF-8 byte count.+ return new Preview(prefix, ref, entry.binary ? length : 0);} finally {if (!retained) free(entry);}diff --git a/plugins/jdbc/src/test/java/app/dbx/jdbc/DeferredLobValuesTest.java b/plugins/jdbc/src/test/java/app/dbx/jdbc/DeferredLobValuesTest.javaindex a191ee3fd5..dc310616b3 100644--- a/plugins/jdbc/src/test/java/app/dbx/jdbc/DeferredLobValuesTest.java+++ b/plugins/jdbc/src/test/java/app/dbx/jdbc/DeferredLobValuesTest.java@@ -12,6 +12,27 @@ import static org.junit.jupiter.api.Assertions.*;final class DeferredLobValuesTest {public interface InternalStatement { void setInternal(); }+ @Test+ void deferredTextByteSizeIsUnknownWithoutReadingTheWholeValue() throws Exception {+ for (String value : new String[]{"a".repeat(300), "中".repeat(300), "🙂".repeat(300)}) {+ var registry = new DeferredLobValues(CallableStatement::execute, () -> false);+ var connection = connection();+ var preview = registry.capture(connection, new SerialClob(value.toCharArray()), false);+ assertNotNull(preview.ref());+ assertEquals(0, preview.originalBytes());+ var result = new StringBuilder();+ long offset = 0;+ while (true) {+ var chunk = registry.fetch(connection, preview.ref(), offset, 113);+ result.append(chunk.data());+ offset = chunk.next_offset();+ if (chunk.eof()) break;+ }+ assertEquals(value, result.toString());+ registry.clear();+ }+ }+@Testvoid nullAndEmptyValuesStayInline() throws Exception {var registry = new DeferredLobValues(CallableStatement::execute, () -> false);