1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Session-control planner IR rows (ISO/IEC 39075:2024 section 7).
use selene_core::DbString;
use crate::{GqlType, SessionSetGraphTarget, SourceSpan, ValueExpr};
/// Session-control operation lowered from a `SESSION` command.
#[derive(Clone, Debug)]
pub enum SessionOp {
/// `SESSION SET VALUE <param> [<type>] = <value expression>` (ISO feature GS03).
///
/// The value is evaluated against an empty binding row at execution time
/// (restricted to a `<value specification>`; see GS14 rationale).
SetValue {
/// Database-string parameter name without the leading `$`.
param: DbString,
/// Optional declared type for the target session parameter.
declared_type: Option<GqlType>,
/// Value expression bound to the parameter.
value: Box<ValueExpr>,
/// When set, leave an existing binding untouched (`IF NOT EXISTS`).
if_not_exists: bool,
/// Source span.
span: SourceSpan,
},
/// `SESSION SET TIME ZONE <time zone string>` (ISO feature GS15).
SetTimeZone {
/// Decoded IANA region name or fixed-offset string.
zone: String,
/// Source span.
span: SourceSpan,
},
/// `SESSION SET [PROPERTY] GRAPH <current graph>` (ISO/IEC 39075:2024 section 7.1).
SetGraph {
/// Current-graph expression selected by the command.
target: SessionSetGraphTarget,
/// Source span.
span: SourceSpan,
},
/// `SESSION RESET [ALL] CHARACTERISTICS` / bare `SESSION RESET` (GS04).
ResetAllCharacteristics {
/// Source span.
span: SourceSpan,
},
/// `SESSION RESET [ALL] PARAMETERS` (ISO feature GS08).
ResetParameters {
/// Source span.
span: SourceSpan,
},
/// `SESSION RESET TIME ZONE` (ISO feature GS07).
ResetTimeZone {
/// Source span.
span: SourceSpan,
},
/// `SESSION RESET [PARAMETER] <param>` (ISO feature GS16).
ResetParameter {
/// Database-string parameter name without the leading `$`.
param: DbString,
/// Source span.
span: SourceSpan,
},
/// `SESSION CLOSE` (ISO/IEC 39075:2024 section 7.3).
Close {
/// Source span.
span: SourceSpan,
},
}