mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 08:11:06 +00:00
Add query cancellation controls (#41)
Co-authored-by: SuLe <sule@SuLedeMacBook-Air.local> Co-authored-by: skyler <77960507+t8y2@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export interface QueryExecutionStateLike {
|
||||
isExecuting: boolean;
|
||||
isCancelling?: boolean;
|
||||
executionId?: string;
|
||||
}
|
||||
|
||||
export function canCancelQueryExecution(state: QueryExecutionStateLike): boolean {
|
||||
return state.isExecuting && !!state.executionId && !state.isCancelling;
|
||||
}
|
||||
|
||||
export function queryExecutionLabelKey(state: Pick<QueryExecutionStateLike, "isCancelling">): "common.loading" | "common.stopping" {
|
||||
return state.isCancelling ? "common.stopping" : "common.loading";
|
||||
}
|
||||
+6
-2
@@ -95,8 +95,12 @@ export async function getColumns(
|
||||
return invoke("get_columns", { connectionId, database, schema, table });
|
||||
}
|
||||
|
||||
export async function executeQuery(connectionId: string, database: string, sql: string): Promise<QueryResult> {
|
||||
return invoke("execute_query", { connectionId, database, sql });
|
||||
export async function executeQuery(connectionId: string, database: string, sql: string, executionId?: string): Promise<QueryResult> {
|
||||
return invoke("execute_query", { connectionId, database, sql, executionId });
|
||||
}
|
||||
|
||||
export async function cancelQuery(executionId: string): Promise<boolean> {
|
||||
return invoke("cancel_query", { executionId });
|
||||
}
|
||||
|
||||
export async function executeBatch(connectionId: string, database: string, statements: string[]): Promise<QueryResult> {
|
||||
|
||||
Reference in New Issue
Block a user