pub fn try_convert_intermediate_decimal_to_scalar<S: Scalar>(
d: &BigDecimal,
target_precision: Precision,
target_scale: i8,
) -> DecimalResult<S>Expand description
Fallibly attempts to convert an IntermediateDecimal into the
native proof-of-sql Scalar backing store. This function adjusts
the decimal to the specified target_precision and target_scale,
and validates that the adjusted decimal does not exceed the specified precision.
If the conversion is successful, it returns the Scalar representation;
otherwise, it returns a DecimalError indicating the type of failure
(e.g., exceeding precision limits).
§Arguments
d- TheIntermediateDecimalto convert.target_precision- The maximum number of digits the scalar can represent.target_scale- The scale (number of decimal places) to use in the scalar.
§Errors
Returns DecimalError::InvalidPrecision error if the number of digits in
the decimal exceeds the target_precision before or after adjusting for
target_scale, or if the target precision is zero.