Trait oracle::sql_type::FromSql

source ·
pub trait FromSql {
    fn from_sql(val: &SqlValue) -> Result<Self>
    where
        Self: Sized
; }
Expand description

Conversion from Oracle values to rust values.

Values in Oracle are converted to Rust type as possible as it can. The following table indicates supported conversions.

Oracle TypeRust Type
character data typesString
    “i8, i16, i32, i64, isize, u8, u16, u32, u64, usize, f64, f32 by using String::parse
    “Vec\<u8> (The Oracle value must be in hexadecimal.)
    “Timestamp by String.parse()
    “IntervalDS by String.parse()
    “IntervalYM by String.parse()
numeric data typesi8, i16, i32, i64, isize, u8, u16, u32, u64, usize, f64, f32
    “String
rawVec\<u8>
    “String (The Oracle value is converted to characters in hexadecimal.)
timestamp data typesTimestamp
    “String
interval day to secondIntervalDS
    “std::time::Duration (conversion error for negative durations)
    “String
interval year to monthIntervalYM
    “String
Oracle object except Oracle collectionObject
    “String
Oracle collectionCollection
    “String
rowidString
ref cursorRefCursor
boolean (PL/SQL only)bool (Oracle client version >= 12.1)

When chrono feature is enabled, the following conversions are added.

Oracle TypeRust Type
timestamp data typeschrono::DateTime
    “chrono::Date
    “chrono::naive::NaiveDateTime
    “chrono::naive::NaiveDate
interval day to secondchrono::Duration

This conversion is used also to get values from output parameters.

Required Methods§

source

fn from_sql(val: &SqlValue) -> Result<Self>where
    Self: Sized,

Implementations on Foreign Types§

source§

impl FromSql for DateTime<Utc>

source§

impl FromSql for DateTime<Local>

source§

impl FromSql for DateTime<FixedOffset>

source§

impl FromSql for Date<Utc>

source§

impl FromSql for Date<Local>

source§

impl FromSql for Date<FixedOffset>

source§

impl FromSql for NaiveDateTime

source§

impl FromSql for NaiveDate

source§

impl FromSql for Duration

source§

impl FromSql for i8

source§

impl FromSql for i16

source§

impl FromSql for i32

source§

impl FromSql for i64

source§

impl FromSql for isize

source§

impl FromSql for u8

source§

impl FromSql for u16

source§

impl FromSql for u32

source§

impl FromSql for u64

source§

impl FromSql for usize

source§

impl FromSql for f64

source§

impl FromSql for f32

source§

impl FromSql for bool

source§

impl FromSql for String

source§

impl FromSql for Vec<u8>

source§

impl<T: FromSql> FromSql for Option<T>

Implementors§