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(vastbase): close paged cursors between batch statements

zipgfe509e80c734
diff --git a/crates/dbx-core/src/query.rs b/crates/dbx-core/src/query.rs
index 1467401972..47104670d9 100644
--- a/crates/dbx-core/src/query.rs
+++ b/crates/dbx-core/src/query.rs
@@ -1291,7 +1291,9 @@ fn options_for_sequential_statements(
db_type: Option<DatabaseType>,
) -> QueryExecutionOptions {
let mut statement_options = options.clone();
- if statement_count <= 1 || db_type != Some(DatabaseType::Kingbase) || statement_options.result_session_id.is_some()
+ if statement_count <= 1
+ || !matches!(db_type, Some(DatabaseType::Kingbase | DatabaseType::Vastbase))
+ || statement_options.result_session_id.is_some()
{
return statement_options;
}
@@ -3068,10 +3070,9 @@ pub async fn execute_multi_core_with_options_for_client_and_progress_typed(
.map_err(Into::into);
}
- // Kingbase Go keeps one physical connection per Agent session, so an open
- // result cursor prevents the next statement from acquiring that connection.
- // Multi-result execution therefore reads a bounded first page for each
- // Kingbase statement without retaining cursors.
+ // Some Agent drivers cannot execute another statement while a paged result
+ // cursor remains open on the same physical connection. Multi-result execution
+ // therefore reads a bounded first page without retaining those cursors.
let statement_options = options_for_sequential_statements(&options, statements.len(), db_type);
let mut results = Vec::with_capacity(statements.len());
for (statement_index, stmt) in statements.iter().enumerate() {
@@ -8837,12 +8838,14 @@ for line in sys.stdin:
..Default::default()
};
- let adjusted = options_for_sequential_statements(&options, 2, Some(DatabaseType::Kingbase));
+ for db_type in [DatabaseType::Kingbase, DatabaseType::Vastbase] {
+ let adjusted = options_for_sequential_statements(&options, 2, Some(db_type));
- assert_eq!(adjusted.page_size, None);
- assert_eq!(adjusted.max_rows, Some(100));
- assert_eq!(adjusted.fetch_size, Some(100));
- assert_eq!(adjusted.timeout_secs, Some(30));
+ assert_eq!(adjusted.page_size, None);
+ assert_eq!(adjusted.max_rows, Some(100));
+ assert_eq!(adjusted.fetch_size, Some(100));
+ assert_eq!(adjusted.timeout_secs, Some(30));
+ }
}
#[test]