#[repr(C)]pub struct Numeric {
pub precision: u8,
pub scale: i8,
pub sign: u8,
pub val: [u8; 16],
}Expand description
Equivalent of SQL_NUMERIC_STRUCT in the ODBC C API.
§Examples
§Store value in Numeric
use odbc_sys::Numeric;
/// Store 123.45 in `Numeric`
let mut num = Numeric {
precision: 5, // 123.45 uses five digits
scale: 2, // two digits after the decimal point
sign: 1, // positive number
val: 12345u128.to_le_bytes(), // store 12345 as little-endian bytes
};Fields§
§precision: u8Number of significant digits. precision and scale are ignored then using Numeric as
input.
scale: i8Number of decimal digits to the right of the decimal point. precision and scale are
ignored then using Numeric as input.
sign: u81 if positive, 0 if negative
val: [u8; 16]The value of the numeric as a little-endian array of bytes. The value is stored as an unsigned integer without any decimal point. For example, the number -123.45 with precision 5 and scale 2 is stored as 12345 (0x39 0x30 0x00 0x00 …).
Trait Implementations§
impl Copy for Numeric
impl Eq for Numeric
impl StructuralPartialEq for Numeric
Auto Trait Implementations§
impl Freeze for Numeric
impl RefUnwindSafe for Numeric
impl Send for Numeric
impl Sync for Numeric
impl Unpin for Numeric
impl UnwindSafe for Numeric
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more