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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//
// Unified Query Algebra
//
// Copyright (c) 2023-2026 Cognica, Inc.
//
//! Statement and retained-resource adapters for catalog-aware host value input.
use crate::Engine;
use uqa_core::memory::{Produced, ProductionControl};
use uqa_sql::{SQLError, SQLParam};
impl Engine {
/// Construct typed range bounds with the native statement scope; SQL owns endpoint conversion and Execution invokes selected catalog support.
pub fn create_range_parameter_with_control(
&self,
type_name: &str,
bounds: uqa_sql::params::RangeParameterBounds<'_>,
control: &ProductionControl<'_>,
) -> Result<Produced<SQLParam>, SQLError> {
self.with_direct_query_snapshot(
false,
|engine| {
uqa_sql::params::create_range_parameter_with_control(
type_name, bounds, engine, engine, control,
)
},
std::convert::identity,
)
}
/// Normalize typed range members and validate an enclosing domain in the native statement scope.
pub fn create_multirange_parameter_with_control(
&self,
type_name: &str,
members: &[SQLParam],
control: &ProductionControl<'_>,
) -> Result<Produced<SQLParam>, SQLError> {
self.with_direct_query_snapshot(
false,
|engine| {
uqa_sql::params::create_multirange_parameter_with_control(
type_name, members, engine, engine, control,
)
},
std::convert::identity,
)
}
/// Construct a typed host record in the native statement scope. SQL owns attribute selection, source binding, scalar casts and domain checks.
pub fn create_record_parameter_with_control(
&self,
type_name: &str,
fields: &[SQLParam],
control: &ProductionControl<'_>,
) -> Result<Produced<SQLParam>, SQLError> {
self.with_direct_query_snapshot(
false,
|engine| {
uqa_sql::params::create_record_parameter_with_control(
type_name, fields, engine, engine, control,
)
},
std::convert::identity,
)
}
/// Construct a typed host array in the session's native statement/catalog scope. SQL owns parameter identities, scalar conversion, dimensions and domain constraints.
pub fn create_array_parameter_with_control(
&self,
type_name: &str,
dimensions: &[usize],
lower_bounds: &[i32],
elements: &[SQLParam],
control: &ProductionControl<'_>,
) -> Result<Produced<SQLParam>, SQLError> {
self.with_direct_query_snapshot(
false,
|engine| {
uqa_sql::params::create_array_parameter_with_control(
type_name,
dimensions,
lower_bounds,
elements,
engine,
engine,
control,
)
},
std::convert::identity,
)
}
/// Create a typed parameter from external text, or a typed SQL NULL from `None`. Type input runs with the session's current catalog, privileges and presentation settings. Domain checks and input callbacks share native transaction admission, commit and failure recovery; the returned parameter retains the supplied production allowance.
pub fn create_typed_parameter_with_control(
&self,
type_name: &str,
text: Option<&str>,
control: &ProductionControl<'_>,
) -> Result<Produced<SQLParam>, SQLError> {
self.with_direct_query_snapshot(
false,
|engine| {
uqa_sql::params::create_typed_parameter_with_control(
type_name, text, engine, engine, control,
)
},
std::convert::identity,
)
}
}