fix(kingbase): honor driver identifier quote for schema context

Closes #7505
This commit is contained in:
t8y2 committed 2026-08-28 09:13:09 +00:00
1 parent 7a4edb6c19
commit f83f707fbc
6 files changed
+159 -19

No files matched your search

+18 -1
View File
@@ -887,6 +887,9 @@ pub struct AgentDriverClient {
shared_runtime: Option<Arc<AgentRuntimeClient>>,
agent_session_id: Option<String>,
cached_query: Option<CachedAgentQuery>,
/// Driver-reported identifier quoting, captured once after connect.
/// Keeping this on the client avoids a connection-info RPC on every query.
identifier_quote: Option<String>,
}
/// Keeps serialized session RPC access separate from the process-level fail-stop handle.
@@ -896,13 +899,19 @@ pub struct PooledAgentClient {
client: tokio::sync::Mutex<AgentDriverClient>,
shared_runtime: Option<Arc<AgentRuntimeClient>>,
agent_session_id: Option<String>,
identifier_quote: Option<String>,
}
impl PooledAgentClient {
pub fn new(client: AgentDriverClient) -> Self {
let shared_runtime = client.shared_runtime.clone();
let agent_session_id = client.agent_session_id.clone();
Self { client: tokio::sync::Mutex::new(client), shared_runtime, agent_session_id }
let identifier_quote = client.identifier_quote.clone();
Self { client: tokio::sync::Mutex::new(client), shared_runtime, agent_session_id, identifier_quote }
}
pub fn identifier_quote(&self) -> Option<&str> {
self.identifier_quote.as_deref()
}
pub async fn lock(&self) -> tokio::sync::MutexGuard<'_, AgentDriverClient> {
@@ -1632,6 +1641,7 @@ impl AgentDriverClient {
shared_runtime: None,
agent_session_id: None,
cached_query: None,
identifier_quote: None,
})
}
@@ -1646,6 +1656,7 @@ impl AgentDriverClient {
shared_runtime: Some(runtime),
agent_session_id: Some(agent_session_id),
cached_query: None,
identifier_quote: None,
}
}
@@ -1947,6 +1958,10 @@ impl AgentDriverClient {
self.call_method_with_timeout(AgentMethod::ConnectionInfo, serde_json::json!({}), timeout_duration).await
}
pub(crate) fn set_identifier_quote(&mut self, identifier_quote: Option<String>) {
self.identifier_quote = identifier_quote.filter(|quote| !quote.trim().is_empty());
}
pub async fn disconnect(&mut self) -> Result<Value, String> {
self.invalidate_cached_query();
if self.shared_runtime.is_some() {
@@ -3345,6 +3360,7 @@ impl AgentDriverClient {
shared_runtime: None,
agent_session_id: None,
cached_query: None,
identifier_quote: None,
}
}
@@ -4070,6 +4086,7 @@ mod tests {
shared_runtime: None,
agent_session_id: None,
cached_query: None,
identifier_quote: None,
};
let started_at = std::time::Instant::now();