1use uqa_core::{ArrayValue, DecimalValue, TemporalValue, Value};
11
12use crate::ast::{BinaryOp, Expr};
13#[cfg(test)]
14use crate::ast::{ColumnType, FunctionBinding, FunctionDispatch};
15use crate::error::{Result, SQLError};
16use crate::params::SQLParam;
17#[cfg(test)]
18use crate::result::ResultRow;
19
20mod array_access;
21pub(crate) mod array_construction;
22pub use array_access::{
23 eval_array_access_with_catalog_and_control, eval_array_access_with_control,
24};
25pub use array_construction::construct_array_with_control;
26mod array_transform;
27pub mod bit_string;
28pub mod datums;
29mod encoding;
30mod floating;
31mod in_range;
32pub(crate) mod integer_input;
33mod json;
34mod json_strip;
35pub(crate) mod observations;
36pub use observations::sql_null_test_with_control;
37mod random;
38mod range;
39pub(crate) use range::datum as range_datum;
40mod regex;
41pub use regex::{check_constant_similar_translation, RegexMatches, RegexSplit};
42pub use regex::{current_regex_cache, RegexCache, RegexCacheScope};
43mod time;
44mod uuid;
45
46pub use array_transform::{
47 argument_positions as array_transform_argument_positions,
48 argument_positions_with_control as array_transform_argument_positions_with_control,
49};
50pub(crate) use json::{decode_jsonb_datum_with_control, encode_jsonb_datum};
51pub use json::{
52 quote_json_string_with_control, validate_json_object_key_type,
53 validate_json_object_key_type_with_catalog, value_to_json_text,
54 value_to_json_text_with_catalog,
55};
56pub use json_strip::argument_positions as json_strip_nulls_argument_positions;
57pub use range::{
58 declared_multirange_datum_with_control, declared_range_datum_with_control,
59 multirange_from_ranges, multirange_from_ranges_with_operations,
60 multirange_value_from_members_with_control, parse_multirange, parse_multirange_with_operations,
61 parse_range, parse_range_with_operations, range_bound_flags, range_from_bounds_with_operations,
62 range_value_from_bounds_with_control, CanonicalMultirange, CanonicalRange, RangeBoundValues,
63 RangeBoundsInput, RangeComparisonValue, RangeConstruction, RangeValueDescriptor,
64};
65pub use time::IntervalFields;
66use time::{
67 age_between, coerce_temporal, format_pg_number, format_temporal, hex_encode, make_timestamp,
68 parse_timestamp, pg_to_chrono_fmt,
69};
70pub(crate) use uuid::format_uuid;
71use uuid::generate_random_uuid;
72pub use uuid::{format_uuid_with_control, parse_uuid_bytes, parse_uuid_bytes_with_control};
73mod binary;
74mod casting;
75pub use casting::numeric::NumericCast;
76pub use casting::resolved::ResolvedCast;
77mod collation;
78pub use collation::compare_unicode_with_control;
79mod collation_for;
80pub mod composites;
81mod concatenation;
82mod conversion;
83mod current_time;
84pub mod enums;
85pub(crate) mod hashing;
86pub(crate) mod internal_char;
87pub use internal_char::{
88 carrier_with_control as internal_char_value_with_control, value_byte as internal_char_byte,
89};
90pub(crate) mod interval_style;
91mod pattern;
92mod scalar_array;
93mod scalar_core;
94pub(crate) use scalar_core::binds_input_collation_by_name;
95mod scalar_dispatch;
96mod scalar_geospatial;
97mod scalar_helpers;
98mod scalar_json;
99mod scalar_math;
100mod scalar_postgres;
101pub use scalar_postgres::eval_distinct_boolean;
102mod scalar_range;
103mod scalar_temporal;
104mod session_settings;
105mod session_sleep;
106mod statement_cancellation;
107mod temporal_input;
108mod value_catalog;
109pub mod variadic_any;
110pub(crate) use value_catalog::{type_by_oid_with_control, ValueCompositeCatalog};
111pub use value_catalog::{EngineValueCatalog, SQLRecordFields, SQLRecordView, SQLValueCatalog};
112
113#[cfg(test)]
114use binary::eval_comparison_op;
115pub use binary::{
116 compare_btree_inputs_with_catalog_and_control, compare_btree_inputs_with_invocation_state,
117 compare_grouping_values_with_enum_catalog, compare_nullable_with_control,
118 compare_record_images_with_catalog, compare_selected_grouping_values_with_catalog,
119 compare_selected_values_with_catalog, compare_typed_values_with_catalog_and_collation,
120 compare_typed_values_with_control, compare_typed_values_with_enum_catalog,
121 compare_with_control, equal_selected_values_with_catalog, equal_selected_values_with_engine,
122 equal_typed_values_with_catalog_and_collation, equal_typed_values_with_enum_catalog,
123 eval_binary_values, eval_binary_values_with_control, eval_binary_values_with_engine,
124 eval_binary_values_with_integer_width, eval_binary_values_with_integer_width_with_control,
125 eval_comparison_truth, eval_comparison_truth_with_control,
126 eval_comparison_truth_with_deferred_state, eval_comparison_truth_with_engine,
127 eval_comparison_truth_with_enum_catalog, eval_record_comparison_truth_with_engine,
128 eval_value_comparison_truth_with_engine, integer_width_for_literal, integer_width_for_type,
129 truthy, type_comparison_can_fail, validate_legacy_vector_comparison, value_comparison_can_fail,
130 values_equal_nullable_with_control, values_equal_with_control,
131 visit_record_image_fields_with_catalog, with_btree_input, BTreeInput, IntegerWidth,
132};
133pub(crate) use binary::{datetime_out_of_range, division_by_zero, out_of_range};
134pub(crate) use casting::text_input_is_session_independent;
135pub use casting::{
136 array_dimensions, cast_value, cast_value_from, cast_value_from_with_control,
137 invalid_boolean_input, negate_value, negate_value_with_control, parse_boolean_input,
138 parse_pg_array_literal, parse_pg_array_literal_with_control,
139};
140use conversion::{
141 allocation_error, float_to_i64_rounded, float_to_i64_trunc, nonnegative_usize, to_decimal,
142 to_i64,
143};
144pub use conversion::{
145 array_value_to_string, catalog_output_required, invalid_numeric_input, value_to_string,
146 value_to_string_with_control, vector_value_to_string,
147};
148pub(crate) use conversion::{
149 bytea_to_string_with_control, tensor_items, vector_element, vector_element_with_control,
150 vector_items, vector_value_to_string_with_control,
151};
152pub use conversion::{
153 value_to_tensor, value_to_tensor_with_control, value_to_vector, value_to_vector_with_control,
154};
155pub(crate) use current_time::transaction_timestamp_or_clock;
156pub use current_time::{clock_timestamp_micros, transaction_clock_micros, TransactionClockScope};
157pub(crate) use floating::format_real_with_control;
158pub use floating::{
159 eval_float_arithmetic, eval_float_arithmetic_with_control, format_real, FloatWidth,
160};
161pub use in_range::{in_range, in_range_with_engine};
162#[cfg(test)]
163use scalar_dispatch::eval_scalar_function;
164pub(crate) use scalar_helpers::append_sql_literal;
165use scalar_helpers::{point_xy, typeof_value};
166pub use scalar_helpers::{
167 quote_ident, quote_ident_with_control, quote_literal_with_control, CompiledLikePattern,
168};
169pub use statement_cancellation::{
170 check_statement_cancellation, statement_cancellation, StatementCancellationScope,
171};
172pub use temporal_input::{
173 temporal_date_order, temporal_interval_style, DateOrderScope, IntervalStyleScope,
174 TemporalInputContext, TemporalInputScope,
175};
176
177mod builtin;
178mod call_arguments;
179mod call_dispatch;
180mod context;
181mod diagnostics;
182mod evaluator;
183
184pub use builtin::{
185 bound_scalar_function_strictness, builtin_scalar_function_strictness,
186 eval_bound_builtin_function_call,
187};
188pub use call_arguments::{
189 call_argument_name, call_argument_value, evaluate_call_args, validate_named_argument_order,
190 validate_named_argument_order_with_control, variadic_argument_value, wrap_variadic_argument,
191};
192pub use call_dispatch::{
193 builtin_named_args, eval_builtin_function_call, eval_builtin_function_call_with_control,
194 eval_function_call, eval_generated_function_call_with_control,
195};
196pub use context::{
197 cast_value_with_numeric_resolution_with_control, cast_value_with_resolution_with_control,
198 cast_value_with_scoped_resolution, cast_value_with_type_resolution,
199 cast_value_with_type_resolution_with_control, coercion_type_name, format_regtype_value,
200 format_regtype_value_with_control, read_catalog_array_input, read_catalog_input,
201 CatalogCastScope, CatalogInputFunctions, EngineHook, EvalContext, RetainedCatalogCast,
202 RowKeySpace, RowLookup, ScopedCastResult,
203};
204pub(crate) use context::{
205 format_regtype_value_with_catalog_and_control, requires_catalog_constant_input,
206 requires_domain_array_input,
207};
208pub use diagnostics::{unknown_function_error, value_type_name};
209pub use evaluator::eval;
210mod numeric_operator;
211pub use numeric_operator::{
212 eval_numeric_operator, eval_numeric_operator_with_control,
213 eval_numeric_operator_with_resolution, ResolvedNumericOperator,
214};
215
216#[cfg(test)]
217mod tests;
218
219mod json_carrier;
220pub use json_carrier::{core_value_to_json, value_to_text, value_to_text_with_control};