feat(query): add manual transaction controls
This commit is contained in:
1 parent
f871e00330
commit
d55a708d6a
27 files changed
+927
-40
No files matched your search
@@ -48,6 +48,7 @@ pub async fn execute_query(
|
||||
client_session_id,
|
||||
timeout_secs,
|
||||
execution_id,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await
|
||||
@@ -68,6 +69,7 @@ pub async fn execute_multi(
|
||||
result_session_id: Option<String>,
|
||||
client_session_id: Option<String>,
|
||||
timeout_secs: Option<u64>,
|
||||
use_transaction: Option<bool>,
|
||||
) -> Result<Vec<db::QueryResult>, String> {
|
||||
let execution_id = execution_id.filter(|id| !id.trim().is_empty());
|
||||
let registered_query = execution_id.as_ref().map(|id| {
|
||||
@@ -103,6 +105,7 @@ pub async fn execute_multi(
|
||||
client_session_id,
|
||||
timeout_secs,
|
||||
execution_id,
|
||||
use_transaction,
|
||||
},
|
||||
)
|
||||
.await;
|
||||
@@ -211,6 +214,52 @@ pub async fn execute_in_transaction(
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn begin_manual_transaction(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
schema: Option<String>,
|
||||
) -> Result<String, String> {
|
||||
dbx_core::query::begin_manual_transaction(&state, &connection_id, &database, schema.as_deref()).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn execute_in_manual_transaction(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
txn_session_id: String,
|
||||
sql: String,
|
||||
database: String,
|
||||
schema: Option<String>,
|
||||
max_rows: Option<usize>,
|
||||
) -> Result<Vec<db::QueryResult>, String> {
|
||||
dbx_core::query::execute_in_manual_transaction(
|
||||
&state,
|
||||
&txn_session_id,
|
||||
&sql,
|
||||
&database,
|
||||
schema.as_deref(),
|
||||
max_rows,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn commit_manual_transaction(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
txn_session_id: String,
|
||||
) -> Result<db::QueryResult, String> {
|
||||
dbx_core::query::commit_manual_transaction(&state, &txn_session_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn rollback_manual_transaction(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
txn_session_id: String,
|
||||
) -> Result<db::QueryResult, String> {
|
||||
dbx_core::query::rollback_manual_transaction(&state, &txn_session_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn analyze_sql_references(
|
||||
sql: String,
|
||||
|
||||
Reference in new issue
Block a user