Skip to main content

uqa_execution/statement/
thread_scope.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Restore a thread's statement temporal input and cancellation when the work that entered them ends.
8
9use super::thread_context::StatementThreadContext;
10
11/// Keeps one statement's temporal input and cancellation entered on the invoking thread until it drops, on every exit of the work it covers.
12pub struct StatementThreadScope {
13    _temporal_input: uqa_sql::expr::TemporalInputScope,
14    _cancellation: uqa_sql::expr::StatementCancellationScope,
15}
16
17impl StatementThreadScope {
18    pub(super) fn enter(context: &StatementThreadContext) -> Self {
19        Self {
20            _temporal_input: context.temporal_input.enter(),
21            _cancellation: uqa_sql::expr::StatementCancellationScope::enter(
22                context.cancellation.clone(),
23            ),
24        }
25    }
26}