uqa_sql/binding/production/
resolution.rs1use crate::catalog::resolution::{RelationLookupMode, RelationNameResolution};
8use crate::SQLError;
9use uqa_core::memory::{MemoryReservation, Produced, ProductionControl};
10
11pub struct BindingResolution {
13 value: RelationNameResolution,
14 _memory: Option<MemoryReservation>,
15}
16impl BindingResolution {
17 pub fn from_produced(value: Produced<RelationNameResolution>) -> Self {
18 let (value, memory) = value.into_parts();
19 Self {
20 value,
21 _memory: memory,
22 }
23 }
24 pub fn copy_with_control(&self, control: &ProductionControl<'_>) -> Result<Self, SQLError> {
25 self.value
26 .copy_with_control(control)
27 .map(Self::from_produced)
28 }
29 pub fn set_lookup_mode(&mut self, mode: RelationLookupMode) -> RelationLookupMode {
30 self.value.set_lookup_mode(mode)
31 }
32}
33impl From<RelationNameResolution> for BindingResolution {
34 fn from(value: RelationNameResolution) -> Self {
35 Self {
36 value,
37 _memory: None,
38 }
39 }
40}
41impl Clone for BindingResolution {
42 fn clone(&self) -> Self {
43 self.value.clone().into()
44 }
45}
46impl std::ops::Deref for BindingResolution {
47 type Target = RelationNameResolution;
48 fn deref(&self) -> &Self::Target {
49 &self.value
50 }
51}