fix: scope query connections by client session
This commit is contained in:
1 parent
ac65508ddb
commit
d326cb0ced
17 files changed
+290
-44
No files matched your search
@@ -21,6 +21,7 @@ pub async fn execute_query(
|
||||
fetch_size: Option<usize>,
|
||||
page_size: Option<usize>,
|
||||
result_session_id: Option<String>,
|
||||
client_session_id: Option<String>,
|
||||
) -> Result<db::QueryResult, String> {
|
||||
let registered_query =
|
||||
execution_id.as_ref().filter(|id| !id.trim().is_empty()).map(|id| state.running_queries.register(id.clone()));
|
||||
@@ -33,7 +34,13 @@ pub async fn execute_query(
|
||||
&sql,
|
||||
schema.as_deref(),
|
||||
cancel_token,
|
||||
dbx_core::query::QueryExecutionOptions { max_rows, fetch_size, page_size, result_session_id },
|
||||
dbx_core::query::QueryExecutionOptions {
|
||||
max_rows,
|
||||
fetch_size,
|
||||
page_size,
|
||||
result_session_id,
|
||||
client_session_id,
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -50,6 +57,7 @@ pub async fn execute_multi(
|
||||
fetch_size: Option<usize>,
|
||||
page_size: Option<usize>,
|
||||
result_session_id: Option<String>,
|
||||
client_session_id: Option<String>,
|
||||
) -> Result<Vec<db::QueryResult>, String> {
|
||||
let registered_query =
|
||||
execution_id.as_ref().filter(|id| !id.trim().is_empty()).map(|id| state.running_queries.register(id.clone()));
|
||||
@@ -71,7 +79,13 @@ pub async fn execute_multi(
|
||||
&sql,
|
||||
schema.as_deref(),
|
||||
cancel_token,
|
||||
dbx_core::query::QueryExecutionOptions { max_rows, fetch_size, page_size, result_session_id },
|
||||
dbx_core::query::QueryExecutionOptions {
|
||||
max_rows,
|
||||
fetch_size,
|
||||
page_size,
|
||||
result_session_id,
|
||||
client_session_id,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
match &result {
|
||||
@@ -97,8 +111,21 @@ pub async fn close_query_session(
|
||||
connection_id: String,
|
||||
database: String,
|
||||
session_id: String,
|
||||
client_session_id: Option<String>,
|
||||
) -> Result<bool, String> {
|
||||
dbx_core::query::close_query_session(&state, &connection_id, &database, &session_id).await
|
||||
dbx_core::query::close_query_session(&state, &connection_id, &database, &session_id, client_session_id.as_deref())
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn close_client_connection_session(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
client_session_id: String,
|
||||
) -> Result<bool, String> {
|
||||
let database = if database.trim().is_empty() { None } else { Some(database.as_str()) };
|
||||
state.close_client_session_pool(&connection_id, database, &client_session_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
Reference in new issue
Block a user