odbc_api

Function decimal_text_to_i128

Source
pub fn decimal_text_to_i128(text: &[u8], scale: usize) -> i128
Expand description

Convert the text representation of a decimal into an integer representation. The integer representation is not truncating the fraction, but is instead the value of the decimal times 10 to the power of scale. E.g. 123.45 of a Decimal with scale 3 is thought of as 123.450 and represented as 123450. This method will regard any non digit character as a radix character with the exception of a + or - at the beginning of the string.

This method is robust against representation which do not have trailing zeroes as well as arbitrary radix character. If you do not write a generic application and now the specific way your database formats decimals you may come up with faster methods to parse decimals.