1use crate::Engine;
10use uqa_core::memory::{Produced, ProductionControl};
11use uqa_sql::{SQLError, SQLParam};
12
13impl Engine {
14 pub fn create_range_parameter_with_control(
16 &self,
17 type_name: &str,
18 bounds: uqa_sql::params::RangeParameterBounds<'_>,
19 control: &ProductionControl<'_>,
20 ) -> Result<Produced<SQLParam>, SQLError> {
21 self.with_direct_query_snapshot(
22 false,
23 |engine| {
24 uqa_sql::params::create_range_parameter_with_control(
25 type_name, bounds, engine, engine, control,
26 )
27 },
28 std::convert::identity,
29 )
30 }
31
32 pub fn create_multirange_parameter_with_control(
34 &self,
35 type_name: &str,
36 members: &[SQLParam],
37 control: &ProductionControl<'_>,
38 ) -> Result<Produced<SQLParam>, SQLError> {
39 self.with_direct_query_snapshot(
40 false,
41 |engine| {
42 uqa_sql::params::create_multirange_parameter_with_control(
43 type_name, members, engine, engine, control,
44 )
45 },
46 std::convert::identity,
47 )
48 }
49
50 pub fn create_record_parameter_with_control(
52 &self,
53 type_name: &str,
54 fields: &[SQLParam],
55 control: &ProductionControl<'_>,
56 ) -> Result<Produced<SQLParam>, SQLError> {
57 self.with_direct_query_snapshot(
58 false,
59 |engine| {
60 uqa_sql::params::create_record_parameter_with_control(
61 type_name, fields, engine, engine, control,
62 )
63 },
64 std::convert::identity,
65 )
66 }
67
68 pub fn create_array_parameter_with_control(
70 &self,
71 type_name: &str,
72 dimensions: &[usize],
73 lower_bounds: &[i32],
74 elements: &[SQLParam],
75 control: &ProductionControl<'_>,
76 ) -> Result<Produced<SQLParam>, SQLError> {
77 self.with_direct_query_snapshot(
78 false,
79 |engine| {
80 uqa_sql::params::create_array_parameter_with_control(
81 type_name,
82 dimensions,
83 lower_bounds,
84 elements,
85 engine,
86 engine,
87 control,
88 )
89 },
90 std::convert::identity,
91 )
92 }
93
94 pub fn create_typed_parameter_with_control(
96 &self,
97 type_name: &str,
98 text: Option<&str>,
99 control: &ProductionControl<'_>,
100 ) -> Result<Produced<SQLParam>, SQLError> {
101 self.with_direct_query_snapshot(
102 false,
103 |engine| {
104 uqa_sql::params::create_typed_parameter_with_control(
105 type_name, text, engine, engine, control,
106 )
107 },
108 std::convert::identity,
109 )
110 }
111}